aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Belle-Isle <abelleisle@roadrunner.com>2015-09-08 18:22:44 -0400
committerAndy Belle-Isle <abelleisle@roadrunner.com>2015-09-08 18:27:00 -0400
commit7bd5f9dd60204fa7bfc9a1b5d6fa982be0bfe3ec (patch)
treedc7213f81387a754e25e247a1dd6e112507375ca /src
parenta56f129b316f62668816a5e0b8f5d99770630140 (diff)
Added windowClass files
Diffstat (limited to 'src')
-rw-r--r--src/windowClass.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/windowClass.cpp b/src/windowClass.cpp
new file mode 100644
index 0000000..942ba86
--- /dev/null
+++ b/src/windowClass.cpp
@@ -0,0 +1,38 @@
+#include <windowClass.h>
+
+void Window::setupRender(){
+ glClearColor(0,0,0,0); //set the background color
+
+}
+
+void Window::render(){
+
+ glMatrixMode(GL_PROJECTION); //set the matrix mode as projection so we can set the ortho size and the camera settings later on
+ glPushMatrix(); //load the settings into the matrix
+ glLoadIdentity(); //save the matrix
+
+ glOrtho(0,SCREEN_WIDTH, 0,SCREEN_HEIGHT, -1,1); //set the the size of the screen
+
+ glMatrixMode(GL_MODELVIEW); //set the matrix to modelview so we can draw objects
+ glPushMatrix(); //load
+ glLoadIdentity(); //save
+
+ glPushMatrix(); //start a new matrix
+ glClear(GL_COLOR_BUFFER_BIT); //clear the screen
+
+ /**************************
+ **** RENDER STUFF HERE ****
+ **************************/
+ glColor3f(1.0f, 0.0f, 0.0f);
+ glRectf(0,0, 50,50); //draw a test rectangle
+ glColor3f(0.0f, 1.0f, 0.0f);
+ glRectf(50,0, 100,50);
+ glColor3f(0.0f, 0.0f, 1.0f);
+ glRectf(100,0,150,50);
+ /**************************
+ **** CLOSE THE LOOP ****
+ **************************/
+
+ glPopMatrix(); //see ya' matrix
+ SDL_GL_SwapWindow(window); //give the render to SDL to display it
+} \ No newline at end of file