shops
Ivory 2023-07-01 15:31:07 -04:00
parent dd775f6d9c
commit 4bf7a092aa
5 changed files with 8 additions and 14 deletions

View File

@ -2,6 +2,7 @@ package xyz.valnet.engine;
import static xyz.valnet.engine.util.Math.lerp; import static xyz.valnet.engine.util.Math.lerp;
import xyz.valnet.engine.graphics.Drawing;
import xyz.valnet.engine.math.Matrix4f; import xyz.valnet.engine.math.Matrix4f;
import xyz.valnet.engine.math.Vector2i; import xyz.valnet.engine.math.Vector2i;
import xyz.valnet.engine.scenegraph.IScene; import xyz.valnet.engine.scenegraph.IScene;
@ -29,6 +30,7 @@ public abstract class Game {
} }
public void render() { public void render() {
Drawing.setLayer(0);
scene.render(); scene.render();
} }

View File

@ -15,6 +15,7 @@ public class SimpleShader extends Shader {
public SimpleShader(String vertPath, String fragPath) { public SimpleShader(String vertPath, String fragPath) {
super(vertPath, fragPath); super(vertPath, fragPath);
pushColor(Color.white);
} }
public void pushColor(Color color) { public void pushColor(Color color) {

View File

@ -2,35 +2,24 @@ package xyz.valnet.hadean;
import xyz.valnet.engine.App; import xyz.valnet.engine.App;
import xyz.valnet.engine.Game; import xyz.valnet.engine.Game;
import xyz.valnet.engine.graphics.Color;
import xyz.valnet.engine.graphics.Drawing;
import xyz.valnet.engine.math.Matrix4f; import xyz.valnet.engine.math.Matrix4f;
import xyz.valnet.hadean.scenes.GameScene; import xyz.valnet.hadean.scenes.GameScene;
import xyz.valnet.hadean.util.Assets; import xyz.valnet.hadean.util.Assets;
public class HadeanGame extends Game { public class HadeanGame extends Game {
public static final HadeanGame Hadean = new HadeanGame(); public static final HadeanGame HADEAN_GAME = new HadeanGame();
public static boolean debugView = false; public static boolean debugView = false;
public static void main(String[] args) { public static void main(String[] args) {
new App(Hadean).run(); new App(HADEAN_GAME).run();
} }
@Override @Override
public void start() { public void start() {
Assets.flat.pushColor(Color.white);
changeScene(new GameScene()); changeScene(new GameScene());
} }
@Override
public void render() {
Drawing.setLayer(0);
super.render();
if(!debugView) return;
}
// receive the updated matrix every frame for the actual window. // receive the updated matrix every frame for the actual window.
@Override @Override
public void updateViewMatrix(Matrix4f matrix) { public void updateViewMatrix(Matrix4f matrix) {

View File

@ -64,6 +64,8 @@ public class Assets {
flat = new SimpleShader("res/shaders/base.vert", "res/shaders/flat.frag"); flat = new SimpleShader("res/shaders/base.vert", "res/shaders/flat.frag");
depth = new SimpleShader("res/shaders/base.vert", "res/shaders/depth.frag"); depth = new SimpleShader("res/shaders/base.vert", "res/shaders/depth.frag");
flat.enable();
atlas = new Texture("res/textures.png"); atlas = new Texture("res/textures.png");
whiteBox = new Sprite(atlas, 0, 88, 8, 8); whiteBox = new Sprite(atlas, 0, 88, 8, 8);