Skip to content

Commit

Permalink
Name changes and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
PanJohnny committed Aug 26, 2024
1 parent e57913e commit fa7464d
Show file tree
Hide file tree
Showing 71 changed files with 18 additions and 34 deletions.
Empty file modified .github/workflows/maven.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
11 changes: 8 additions & 3 deletions pom.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<lwjgl.version>3.3.2</lwjgl.version>
<lwjgl.natives>natives-windows</lwjgl.natives>
<lwjgl.version>3.3.3</lwjgl.version>
<lwjgl.natives>natives-linux</lwjgl.natives>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -90,10 +90,15 @@
<artifactId>gson</artifactId>
<version>2.10</version>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<version>33.0.0-jre</version>
</dependency>
<dependency>
<groupId>com.github.PanJohnny</groupId>
Expand Down
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/Adaptation.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/desktop/G2DRenderer.java
100644 → 100755
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/desktop/JDKeyboard.java
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/main/java/com/panjohnny/pjgl/adapt/desktop/JDMouse.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void mouseMoved(MouseEvent e) {
}

@Override
public boolean isKeyDown(int keyCode) {
public boolean isButtonDown(int keyCode) {
return keys[keyCode];
}

Expand Down
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/desktop/JDRenderer.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/desktop/JDWindow.java
100644 → 100755
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/lwjgl/GLFWKeyboard.java
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/main/java/com/panjohnny/pjgl/adapt/lwjgl/GLFWMouse.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@Adaptation("lwjgl@pjgl")
public class GLFWMouse implements MouseAdapter {
@Override
public boolean isKeyDown(int keyCode) {
public boolean isButtonDown(int keyCode) {
return glfwGetMouseButton(WINDOW.get(), keyCode) == GLFW_PRESS;
}

Expand Down
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/lwjgl/GLFWWindow.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/lwjgl/package-info.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/adapt/package-info.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/PJGL.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/PJGLEvents.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/PJGLInitializer.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/asset/Animation.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/asset/Drawable.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/asset/Sprite.java
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions src/main/java/com/panjohnny/pjgl/api/asset/SpriteRegistry.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public final class SpriteRegistry {
* @deprecated Please refrain from using this method as it does not differ from adaptation currently in use and only registers image sprites.
* @see SpriteRegistry technical details
*/
@Deprecated
public static <T> void registerSprite(String id, T t) {
if (t instanceof String s) {
registerImageSprite(id, s);
Expand Down
Empty file.
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/asset/package-info.java
100644 → 100755
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/camera/package-info.java
100644 → 100755
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/event/PJGLEvent.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/event/PJGLHook.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/event/PJGLOneUseEvent.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/event/package-info.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/object/Component.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/object/GameObject.java
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/object/package-info.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/package-info.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/util/FileUtil.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/util/MathUtil.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/util/Pair.java
100644 → 100755
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/util/SpriteUtil.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/util/Track.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/api/util/package-info.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/core/EngineOptions.java
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/main/java/com/panjohnny/pjgl/core/PJGLCore.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PJGLCore implements Runnable {
private final WindowAdapter window;
private final RendererAdapter renderer;
private final GameObjectManager manager;
public int fpsSetting = 60;
public int fpsSetting = -1;

public int lastFPS = 0;

Expand Down
Empty file.
6 changes: 3 additions & 3 deletions src/main/java/com/panjohnny/pjgl/core/adapters/MouseAdapter.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public interface MouseAdapter {
int BUTTON_MIDDLE = 1;
int BUTTON_RIGHT = 2;

boolean isKeyDown(int keyCode);
boolean isButtonDown(int button);

default boolean isKeyUp(int keyCode) {
return !isKeyDown(keyCode);
default boolean isButtonUp(int button) {
return !isButtonDown(button);
}

double getX();
Expand Down
Empty file.
Empty file.
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/core/package-info.java
100644 → 100755
Empty file.
Empty file modified src/main/java/com/panjohnny/pjgl/package-info.java
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions src/main/java/module-info.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
requires org.lwjgl.opengl;
requires com.google.gson;
requires org.lwjgl.stb;
requires jdk.httpserver;
requires org.java_websocket;

exports com.panjohnny.pjgl.adapt;
exports com.panjohnny.pjgl.adapt.desktop;
Expand Down
Empty file modified src/main/resources/.properties
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/test/java/com/panjohnny/test/Example.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static void main(String[] args) {
PJGL.init(new JDInitializer("Apple!"));
PJGL pjgl = PJGL.getInstance();

SpriteRegistry.registerImageSprite("apple", "apple.png");
SpriteRegistry.registerImageSprite("apple", "./assets/apple.png");

GameObject apple = new GameObject() {
public final Position position = addComponent(new Position(this, 10, 10));
Expand Down
24 changes: 0 additions & 24 deletions src/test/java/com/panjohnny/test/GLFWExample.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,13 @@ public static void main(String[] args) {
PJGLEvents.VISIBLE.listen(() -> {
SpriteRegistry.registerTextureSprite("apple", "./assets/apple.png");

// Juan is sprite map
TextureAtlas atlas = SpriteRegistry.registerTextureSpriteAsAtlas("juan", "./assets/juan-map.png");
AtlasRegion j0 = atlas.defineRegion(0, 0, 16, 16);

Animation juanAnimation;

Animation a;
try {
a = Animation.loadFromJson("./assets/animation.json", SpriteRegistry::registerTextureSprite);
juanAnimation = new Animation.AnimationBuilder("juan_test").frames(j0, atlas.defineRegion(16, 0, 16, 16)).simpleTiming(1000).order(0, 1).build();
} catch (Animation.AnimationBuilder.AnimationBuilderException | FileNotFoundException e) {
PJGL.LOGGER.log(System.Logger.Level.ERROR, "Failed to load animations");
e.printStackTrace();
return;
}
GameObject apple = new GameObject() {
public final Position position = addComponent(new Position(this, 10, 10));
public final Size size = addComponent(new Size(this, 100, 100));
public final SpriteRenderer renderer = addComponent(new SpriteRenderer(this, "apple"));
public final Animator animator = addComponent(new Animator(this, a));
};

GameObject juan = new GameObject() {
public final Position position = addComponent(new Position(this, 200, 200));
public final Size size = addComponent(new Size(this, 100, 100));
public final SpriteRenderer renderer = addComponent(new SpriteRenderer(this, j0));
public final Animator animator = addComponent(new Animator(this, juanAnimation));
};

pjgl.getManager().queueAddition(apple);
pjgl.getManager().queueAddition(juan);
});

GLFWKeyboard keyboard = pjgl.getKeyboard();
Expand Down
Empty file modified src/test/java/module-info.java
100644 → 100755
Empty file.
Empty file modified src/test/resources/apple.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fa7464d

Please sign in to comment.