commenting

This commit is contained in:
EvilMuffinHa 2020-05-25 17:30:50 -04:00
parent e3a33d946c
commit fca84badb8

View File

@ -8,6 +8,7 @@ import org.lwjgl.glfw.GLFW;
public class Test { public class Test {
// Defining original parts of the game
public final static int WIDTH = 640, HEIGHT = 480; public final static int WIDTH = 640, HEIGHT = 480;
public final String windowName = "Game!"; public final String windowName = "Game!";
public Display display; public Display display;
@ -27,6 +28,8 @@ public class Test {
}, new Material(new Texture("resources/textures/thonk.png"))); }, new Material(new Texture("resources/textures/thonk.png")));
public void run() throws Exception { public void run() throws Exception {
setup(); setup();
i = new Input(display); i = new Input(display);
@ -45,18 +48,30 @@ public class Test {
public void setup() throws Exception { public void setup() throws Exception {
// System.out.println("Initializing Game "); //First, set up the display
display = new Display(WIDTH, HEIGHT, windowName); display = new Display(WIDTH, HEIGHT, windowName);
display.create(); display.create();
// Open the shaders (not necessary there are textures)
shader = new Shader("/resources/shaders/mainVertex.glsl", "/resources/shaders/mainFragment.glsl"); shader = new Shader("/resources/shaders/mainVertex.glsl", "/resources/shaders/mainFragment.glsl");
// Set up the renderer
renderer = new Renderer(shader); renderer = new Renderer(shader);
// Changing the background color
display.setBackgroundColor(1F, 1F, 1F); display.setBackgroundColor(1F, 1F, 1F);
// Creating / displaying the mesh
mesh.create(); mesh.create();
// Creating the shader
shader.create(); shader.create();
} }
// Updating
private void update() { private void update() {
// System.out.println("Updating "); // Just updating lmfao
int frames = display.update(); int frames = display.update();
display.setWindowName(display.getWindowName().substring(0, 4) + " (Frames : " + frames + ")"); display.setWindowName(display.getWindowName().substring(0, 4) + " (Frames : " + frames + ")");
@ -65,19 +80,22 @@ public class Test {
} }
private void render() { private void render() {
// System.out.println("Rendering "); // rendering the mesh
renderer.renderMesh(mesh); renderer.renderMesh(mesh);
//swap buffers so the new one will appear
display.swapBuffers(); display.swapBuffers();
} }
private void close() { private void close() {
// Removing everything
display.destroy(); display.destroy();
mesh.destroy(); mesh.destroy();
shader.destroy(); shader.destroy();
} }
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
//Running
new Test().run(); new Test().run();
} }
} }