diff options
Diffstat (limited to 'src/client/view.cc')
-rw-r--r-- | src/client/view.cc | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index d9b5f42..af9037b 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -1,35 +1,34 @@ -/* view.cc +/* + view.cc This file is part of the Osirion project and is distributed under the terms and conditions of the GNU General Public License version 2 */ -// C++ headers -#include <iostream> - -// SDL headers -#include <SDL/SDL.h> - -// project headers -#include "osirion.h" -#include "common/functions.h" - -#include "game/game.h" -#include "gl/osiriongl.h" - +#include "view.h" #include "video.h" #include "camera.h" #include "shipdrawer.h" #include "stardrawer.h" +#include "gl/osiriongl.h" +#include "game/game.h" +#include "common/functions.h" +#include "osirion.h" -namespace view +#include <SDL/SDL.h> + +#include <iostream> + +namespace client { +using namespace common; + ShipDrawer *shipdrawer = 0; StarDrawer *stardrawer = 0; -Ship *target =0; // the view's target +game::Ship *target =0; // the view's target -void init() { +void View::init() { // draw scene if (!shipdrawer) { stardrawer = new StarDrawer(&game::star); @@ -39,7 +38,7 @@ void init() { } -void shutdown() +void View::shutdown() { delete stardrawer; stardrawer = 0; @@ -47,14 +46,14 @@ void shutdown() shipdrawer = 0; } -void reset() { +void View::reset() { // Change to the projection matrix and set our viewing volume. gl::matrixmode( GL_PROJECTION ); gl::loadidentity(); //glu::perspective( 64.0, video::ratio, 1.0, 1024.0 ); const float frustumsize=0.5f; - gl::frustum( -frustumsize * video::ratio, frustumsize * video::ratio, -frustumsize, frustumsize, 1.0f, 1024.0f); + gl::frustum( -frustumsize * Video::ratio, frustumsize * Video::ratio, -frustumsize, frustumsize, 1.0f, 1024.0f); /* map world coordinates to GL coordinates @@ -65,7 +64,7 @@ void reset() { gl::rotate(90.0f, 0, 1.0, 0); } -void draw_background() +void View::draw_background(float elapsed) { using namespace gl; @@ -116,7 +115,7 @@ void draw_background() gl::disable(GL_BLEND); } -void draw_world(float elapsed) +void View::draw_world(float elapsed) { // draw the world gl::push(); @@ -135,7 +134,7 @@ void draw_world(float elapsed) } -void draw(float elapsed) +void View::draw(float elapsed) { // Clear the color and depth buffers. gl::clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); @@ -145,15 +144,15 @@ void draw(float elapsed) gl::loadidentity(); // Camera transformation - camera::draw(elapsed); + Camera::draw(elapsed); // draw the world draw_world(elapsed); // draw the semi-static background - draw_background(); + draw_background(elapsed); - SDL_GL_SwapBuffers( ); + SDL_GL_SwapBuffers(); } } // namespace view |