diff --git a/README.md b/README.md index a52213c..486143b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # pixels -x, y - 2D Game engine in the works... \ No newline at end of file +x, y - 2D Game engine in the works... + +idk why i use java for everything... \ No newline at end of file diff --git a/pixels/bin/bz/bronze/pixels/AbstractGame.class b/pixels/bin/bz/bronze/pixels/AbstractGame.class new file mode 100644 index 0000000..9c81b9a Binary files /dev/null and b/pixels/bin/bz/bronze/pixels/AbstractGame.class differ diff --git a/pixels/bin/bz/bronze/pixels/Gameloop.class b/pixels/bin/bz/bronze/pixels/Gameloop.class index 1d2cb5b..d6558f5 100644 Binary files a/pixels/bin/bz/bronze/pixels/Gameloop.class and b/pixels/bin/bz/bronze/pixels/Gameloop.class differ diff --git a/pixels/bin/bz/bronze/pixels/Init.class b/pixels/bin/bz/bronze/pixels/Init.class index 07ee485..f45f13b 100644 Binary files a/pixels/bin/bz/bronze/pixels/Init.class and b/pixels/bin/bz/bronze/pixels/Init.class differ diff --git a/pixels/bin/bz/bronze/pixels/Window.class b/pixels/bin/bz/bronze/pixels/Window.class index 4d5dee5..6de8b33 100644 Binary files a/pixels/bin/bz/bronze/pixels/Window.class and b/pixels/bin/bz/bronze/pixels/Window.class differ diff --git a/pixels/src/bz/bronze/pixels/AbstractGame.java b/pixels/src/bz/bronze/pixels/AbstractGame.java new file mode 100644 index 0000000..9bcdcf9 --- /dev/null +++ b/pixels/src/bz/bronze/pixels/AbstractGame.java @@ -0,0 +1,6 @@ +package bz.bronze.pixels; + +public abstract class AbstractGame { + public abstract void update(float dt); + public abstract void render(Renderer r); +} \ No newline at end of file diff --git a/pixels/src/bz/bronze/pixels/Gameloop.java b/pixels/src/bz/bronze/pixels/Gameloop.java index 732a242..34a91a7 100644 --- a/pixels/src/bz/bronze/pixels/Gameloop.java +++ b/pixels/src/bz/bronze/pixels/Gameloop.java @@ -6,12 +6,17 @@ public class Gameloop implements Runnable { private Thread thread; private Renderer renderer; private Input input; + private AbstractGame game; private boolean running = false; private final double TPS = 1.0/60.0; private String metrics; + public Gameloop(AbstractGame game) { + this.game = game; + } + public void start() { renderer = new Renderer(); input = new Input(); @@ -53,6 +58,8 @@ public class Gameloop implements Runnable { render = true; //TODO: Gameloop + game.update((float)TPS); + metrics = "TPS: " + tps + " | " + "Mouse X: " + input.mouseX + " | " + "Mouse Y: " + input.mouseY + " | " + "Scroll: " + input.scroll; Window.window.setTitle(Window.title + " | " + metrics); @@ -68,6 +75,7 @@ public class Gameloop implements Runnable { if (render) { renderer.test(); //renderer.clear(); + game.render(renderer); Window.update(); ticks++; diff --git a/pixels/src/bz/bronze/pixels/Window.java b/pixels/src/bz/bronze/pixels/Window.java index 95f4ef3..9e653c0 100644 --- a/pixels/src/bz/bronze/pixels/Window.java +++ b/pixels/src/bz/bronze/pixels/Window.java @@ -15,7 +15,7 @@ public class Window { static int width = 800; static int height = 600; static int scale = 1; - static String title = "pixels | v0.02"; + static String title = "pixels | v0.03"; static BufferedImage pixels = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); static Canvas viewport = new Canvas();