GameScene.h

Go to the documentation of this file.
00001 
00005 /* Copyright © 2009, 2010 James Legg.
00006     This program is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 */
00011 #ifndef GAMESCENE_H_
00012 #define GAMESCENE_H_
00013 
00014 #include "Scene.h"
00015 #include "../Graphics/SkyBox.h"
00016 #include "../Graphics/SkyParticles.h"
00017 #include "Physics/World.h"
00018 #include "GameObjects/Car.h"
00019 #include "CarCamera.h"
00020 #include "InputHandler.h"
00021 #include "../UI/PauseMenu.h"
00022 
00023 #include <libtrack/OcclusionTester.h>
00024 #include <libtrack/Track.h>
00025 #include <libtrack/Mesh/BulletMesh.h>
00026 
00027 #include <sstream>
00028 
00029 namespace Engine
00030 {
00031 
00032 class GameScene : public Engine::Scene
00033 {
00034 public:
00040     GameScene(std::vector<std::pair<InputHandler::iterator, unsigned int> > input_devices,
00041               const Track::Track & track);
00042     
00043     virtual ~GameScene();
00044     
00049     virtual void take_input(InputReport & report);
00050     
00054     virtual void update_logic(unsigned int milliseconds_elapsed);
00055     
00059     virtual void draw();
00060     
00063     virtual void do_sound();
00064     
00066     Physics::World & get_world();
00067     
00074     void set_save_replay(bool value = true);
00075 private:
00077     std::vector<std::pair<InputHandler::iterator, unsigned int> > m_input_devices;
00078     std::stringstream m_replay_header;
00079     Graphics::SkyBox sky;
00080     Graphics::SkyParticles m_sky_particles;
00081     Track::OcclusionTester occlusion_tester;
00082     std::vector<GameObjects::Car *> cars;
00084     std::vector<unsigned int> m_humans;
00086     std::vector<bool> car_skip;
00088     std::vector<CarCamera *> car_cameras;
00089     btRigidBody * track_body;
00090     btRigidBody * floor_body;
00091     boost::shared_ptr<btCollisionShape> track_shape;
00092     boost::shared_ptr<btCollisionShape> floor_shape;
00093     
00095     const Track::Track & track;
00096     
00097     Physics::World world;
00098     
00100     bool save_replay;
00101     
00104     float fps;
00105     
00109     std::vector<int> car_ranks;
00110     
00112     void draw_paused_screen();
00118     void draw_for_player(unsigned int player, float aspect);
00119     void draw_world(unsigned int player, float aspect);
00120     void draw_hud(unsigned int player);
00121     void draw_speedometer(unsigned int player);
00122     void draw_lap_info(unsigned int player);
00123     void draw_rank(unsigned int player);
00125     void draw_disqualified(unsigned int player);
00127     void draw_finished(unsigned int player);
00129     void draw_reverse_sign(unsigned int player);
00131     void draw_countdown();
00132     
00134     void rank_cars();
00135     
00137     btVector3 start_point;
00139     btVector3 start_plane_normal;
00141     btScalar start_plane_distance;
00142     
00144     Track::Texture * m_speedometer_texture;
00146     Track::Texture * m_best_lap_texture;
00148     Track::Texture * m_finish_border_texture;
00150     Track::Texture * m_finish_text_texture;
00152     Track::Texture * m_disqualified_text_texture;
00154     Track::Texture * m_reverse_texture;
00156     Track::Texture * m_countdown_texture;
00157     
00161     int countdown_timer;
00162     
00164     bool paused;
00166     UI::PauseMenu m_pause_menu;
00168     void unpause();
00169     
00170     bool show_debug;
00171 
00172 #ifndef NDEBUG
00174     unsigned int m_debug_list_name;
00176     unsigned int m_debug_texture_name;
00177     Track::DrawableMesh ai_mesh;
00178     
00180     unsigned int m_total_frames;
00182     unsigned int m_total_time;
00183 #endif
00184 };
00185 
00186 }
00187 
00188 #endif /*GAMESCENE_H_*/

Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:12 2010 by Doxygen version 1.4.7 for Racer version svn335.