00001 #ifndef _GAMESTATE_H 00002 #define _GAMESTATE_H 00003 00004 #include "level.h" 00005 00006 enum State { 00007 MAIN = 0, 00008 LEVEL_LOADING, 00009 GAMEPLAY, 00010 END_LEVEL, 00011 END_GAME, 00012 LEVEL_SELECT, 00013 HELP, 00014 OPTIONS_VIDEO_SOUND, 00015 OPTIONS_CONTROLS, 00016 ESC_DIALOG, 00017 RUN_SIM 00018 }; 00019 00020 class GameState { 00021 public: 00022 static GameState* get_gamestate() { return _gamestate; } 00023 00024 GameState( void ); 00025 00026 ~GameState( void ); 00027 00028 const State get_current_state( void ) const { return _current_state; } 00029 const State get_previous_state( void ) const { return _previous_state; } 00030 00031 void set_current_state( const State state ) { _current_state = state; } 00032 void set_previous_state( const State state ) { _previous_state = state; } 00033 00034 void change_state( const State state ); 00035 00036 void load_level( const string filename ); 00037 00038 Level* get_level( void ); 00039 00040 void tick( double t ); 00041 00042 void stop_sim( void ); 00043 00044 void reset_level( void ); 00045 public: 00046 00047 Level* _current_level; 00048 00049 State _current_state, _previous_state; 00050 00051 private: 00052 00053 static GameState* _gamestate; 00054 }; 00055 00056 #endif // header guard