Newer
Older
JumpingGame / src / main / java / GameEngine.java
import static org.lwjgl.opengl.GL11.*;

public abstract class GameEngine {

    private GLWindow glWindow = new GLWindow();

    protected void init() {
    }

    protected void update(long window) {
    }

    protected void destroy() {
    }

    protected void run() {

        glWindow.init();
        init();

        while (!glWindow.windowShouldClose()) {
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
            update(glWindow.getWindow());
            glWindow.swapWindow();
        }

        destroy();
        glWindow.destroyWindow();
    }
}