GameState.h
Go to the documentation of this file.00001 00010 #ifndef __GameState_H__ 00011 #define __GameState_H__ 00012 00013 // Includes 00014 #include "GameStateManager.h" 00015 00016 // Forward declares 00017 00018 00019 // GameState 00020 class GameState 00021 { 00022 public: 00023 virtual ~GameState(); 00024 00025 virtual void Update(float deltaTime); 00026 00027 void SwitchState(StringId state, float transitionOutTime = 0, float transitionInTime = 0); 00028 }; 00029 00030 00031 // Helper macros for creating gamestates 00032 #define GAMESTATE_IMPLEMENTATION(className) \ 00033 private: \ 00034 static GameState* Create##className##Instance() \ 00035 { \ 00036 return new className; \ 00037 } \ 00038 public: \ 00039 static void Register() \ 00040 { \ 00041 GameStateManager::GetInstance()->RegisterGameState( \ 00042 StringId(#className), \ 00043 Create##className##Instance); \ 00044 } \ 00045 00046 #endif /* __GameState_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
