diff --git a/First Game Engine Project/res/font/Thumbs.db b/First Game Engine Project/res/font/Thumbs.db new file mode 100644 index 0000000..17d31bd Binary files /dev/null and b/First Game Engine Project/res/font/Thumbs.db differ diff --git a/First Game Engine Project/src/mrdev023/opengl/DisplayManager.java b/First Game Engine Project/src/mrdev023/opengl/DisplayManager.java index 83eacda..b133733 100644 --- a/First Game Engine Project/src/mrdev023/opengl/DisplayManager.java +++ b/First Game Engine Project/src/mrdev023/opengl/DisplayManager.java @@ -6,6 +6,7 @@ import static org.lwjgl.opengl.GL11.*; public class DisplayManager { public static void clear(){ + glClearColor(1,1,1,1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } diff --git a/First Game Engine Project/src/mrdev023/opengl/VAO.java b/First Game Engine Project/src/mrdev023/opengl/VAO.java new file mode 100644 index 0000000..4b696e7 --- /dev/null +++ b/First Game Engine Project/src/mrdev023/opengl/VAO.java @@ -0,0 +1,89 @@ +package mrdev023.opengl; + +import static org.lwjgl.opengl.GL15.*; +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL30.*; + +import java.nio.*; + +import org.lwjgl.*; + + +public class VAO { + + public int vao,vertexBuffer,colorBuffer,texBuffer; + + public VAO(){ + vao = glGenVertexArrays(); + vertexBuffer = glGenBuffers(); + colorBuffer = glGenBuffers(); + texBuffer = glGenBuffers(); + } + + + public void setVertexBuffer(float... a){ + FloatBuffer buffer = BufferUtils.createFloatBuffer(8); + for(float c : a)buffer.put(c); + buffer.flip(); + + glBindVertexArray(vao); + glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer); + glBufferData(GL_ARRAY_BUFFER,buffer,GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER,0); + glBindVertexArray(0); + } + + public void setColorBuffer(float... a){ + FloatBuffer buffer = BufferUtils.createFloatBuffer(16); + for(float c : a)buffer.put(c); + buffer.flip(); + + glBindVertexArray(vao); + glBindBuffer(GL_ARRAY_BUFFER,colorBuffer); + glBufferData(GL_ARRAY_BUFFER,buffer,GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER,0); + glBindVertexArray(0); + } + + public void setTexBuffer(float... a){ + FloatBuffer buffer = BufferUtils.createFloatBuffer(8); + for(float c : a)buffer.put(c); + buffer.flip(); + + glBindVertexArray(vao); + glBindBuffer(GL_ARRAY_BUFFER,texBuffer); + glBufferData(GL_ARRAY_BUFFER,buffer,GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER,0); + glBindVertexArray(0); + } + + public void render(){ + + glBindVertexArray(vao); + + glBindBuffer(GL_ARRAY_BUFFER,vertexBuffer); + glVertexPointer(2, GL_FLOAT, 8, 0); + + glBindBuffer(GL_ARRAY_BUFFER,colorBuffer); + glColorPointer(4,GL_FLOAT,16,0); + + glBindBuffer(GL_ARRAY_BUFFER,texBuffer); + glTexCoordPointer(2,GL_FLOAT,8,0); + + glDrawArrays(GL_QUADS,0,4); + + glBindBuffer(GL_ARRAY_BUFFER,0); + + glBindVertexArray(0); + + } + + + public void destroy(){ + glDeleteBuffers(vertexBuffer); + glDeleteBuffers(colorBuffer); + glDeleteBuffers(texBuffer); + glDeleteVertexArrays(vao); + } + +} diff --git a/First Game Engine Project/src/mrdev023/opengl/gui/Button.java b/First Game Engine Project/src/mrdev023/opengl/gui/Button.java new file mode 100644 index 0000000..3bfb6b8 --- /dev/null +++ b/First Game Engine Project/src/mrdev023/opengl/gui/Button.java @@ -0,0 +1,5 @@ +package mrdev023.opengl.gui; + +public class Button extends GUIComponent{ + +} diff --git a/First Game Engine Project/src/mrdev023/opengl/gui/GUIComponent.java b/First Game Engine Project/src/mrdev023/opengl/gui/GUIComponent.java new file mode 100644 index 0000000..3890b39 --- /dev/null +++ b/First Game Engine Project/src/mrdev023/opengl/gui/GUIComponent.java @@ -0,0 +1,5 @@ +package mrdev023.opengl.gui; + +public abstract class GUIComponent { + +} diff --git a/First Game Engine Project/src/mrdev023/opengl/gui/Message.java b/First Game Engine Project/src/mrdev023/opengl/gui/Message.java index c658620..4b285be 100644 --- a/First Game Engine Project/src/mrdev023/opengl/gui/Message.java +++ b/First Game Engine Project/src/mrdev023/opengl/gui/Message.java @@ -2,7 +2,7 @@ package mrdev023.opengl.gui; import mrdev023.opengl.*; -public class Message { +public class Message{ public static final int TIME_OUT = 5000; private long current, previous, time = 0;