From 79b8fb11967aa1637e0a0bfaeafab2d77f83ca82 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Fri, 21 May 2010 01:51:44 +0200 Subject: Added a basic player class with movements. --- application.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'application.cpp') diff --git a/application.cpp b/application.cpp index f7ddaae..15b68de 100644 --- a/application.cpp +++ b/application.cpp @@ -146,6 +146,7 @@ void Application::run() { background = new TextureSDL("textures/background.png"); texture = new TextureSDL("textures/shot1.png"); shader = new GLShaderProgram(); + player = new Player(); patterns.push_back(new BulletPattern()); for(int i = 0; i < 8; i++) { @@ -191,6 +192,8 @@ void Application::main_loop(unsigned int tick, unsigned int step) { for(std::vector::iterator it = patterns.begin(); it < patterns.end(); it++) { (*it)->update(elapsed, step); } + + player->update(); } glClearColor(0, 0, 0, 0); @@ -243,7 +246,7 @@ void Application::main_loop(unsigned int tick, unsigned int step) { glClearColor(0.2, 0.2, 0.2, 0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - + glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, (float)660 / (float)740, 1, 100); @@ -282,9 +285,12 @@ void Application::main_loop(unsigned int tick, unsigned int step) { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - + glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); + + player->draw(); + shader->use(); glPointSize(32.0); glEnable(GL_TEXTURE_2D); -- cgit v1.2.3