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 xyz.valnet.engine.graphics.Drawing;
import xyz.valnet.engine.math.Matrix4f;
import xyz.valnet.engine.math.Vector2i;
import xyz.valnet.engine.scenegraph.IScene;
@ -29,6 +30,7 @@ public abstract class Game {
}
public void render() {
Drawing.setLayer(0);
scene.render();
}

View File

@ -50,7 +50,7 @@ public class Shader {
}
public int create(String vert, String frag) {
int program = glCreateProgram();
int program = glCreateProgram();
int vertID = glCreateShader(GL_VERTEX_SHADER);
int fragID = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(vertID, vert);

View File

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

View File

@ -2,35 +2,24 @@ package xyz.valnet.hadean;
import xyz.valnet.engine.App;
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.hadean.scenes.GameScene;
import xyz.valnet.hadean.util.Assets;
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 void main(String[] args) {
new App(Hadean).run();
new App(HADEAN_GAME).run();
}
@Override
public void start() {
Assets.flat.pushColor(Color.white);
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.
@Override
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");
depth = new SimpleShader("res/shaders/base.vert", "res/shaders/depth.frag");
flat.enable();
atlas = new Texture("res/textures.png");
whiteBox = new Sprite(atlas, 0, 88, 8, 8);