/*! -------------------------------------------------------------------- \file world.h \brief Encapsulate game objects \author Roy Thompson \date 2002-11-09 // -------------------------------------------------------------------*/ #ifndef __WORLD_H__ #define __WORLD_H__ #include "game.h" #include "skybox.h" #include "enemyship.h" #include "spacejunk.h" #include struct Enemy { float damage; float speed; Math3d::M3d startPos; int killPoints; }; struct Level { int numEnemies; Enemy *enemies; }; //! convenience definition for the World singleton #define theWorld World::getInstance() //--------------------------------------------------------------------- // World // //! Class to encapsulate game objects // //--------------------------------------------------------------------- class World { public: World() {} virtual ~World() {} //! returns a handle to the singleton instance of World (use "theWorld") static World& getInstance() { if (!s_pWorld) s_pWorld = new World(); return *s_pWorld; } //! Initialize the world bool Init(const char* skyboxPath); //! Render the world bool Render(); void OrthoMode(int left, int top, int right, int bottom); void PerspectiveMode(); //! update world state for single game loop iteration // timeElapsed is in seconds void UpdateState(float timeElapsed); // const CameraState& GetStartCamera() // { }//return _course.GetStart(player); } bool _ReadLevel(istream &is); void NewLevel(int levelNum); bool LevelComplete(); int GetState() { return _state; } enum WorldState { COUNTDOWN = 0, PLAYING, GAMEOVER, WINNER, CHANGELEVEL, NUM_WORLDSTATES}; protected: //! singleton instance static World *s_pWorld; private: // Data void RestartLevel(); void RestartGame(); Skybox _skybox; //!< textured skybox cube EnemyShip *_enemies; int _numEnemies; Spacejunk *_spacejunk; double _totalTime; float _lastShot; Level *_levels; int _numLevels; int _curLevel; bool *_enemiesAlive; bool _levelChange; bool _justDied; int _state; float _countTime; int _livesLeft; int _score; }; #endif // __WORLD_H__