parent
d3f26d4bb0
commit
43661ee07f
@ -0,0 +1,24 @@ |
||||
#pragma once |
||||
class Crawler; |
||||
|
||||
class State_GameRun; |
||||
|
||||
namespace States{ |
||||
enum State{ |
||||
GAME_RUN |
||||
}; |
||||
}; |
||||
|
||||
class GameState{ |
||||
public: |
||||
inline static GameState*STATE=nullptr; |
||||
inline static std::map<States::State,GameState*>states; |
||||
virtual void OnStateChange(GameState*prevState)=0; |
||||
virtual void OnUserUpdate(Crawler*game)=0; |
||||
virtual void Draw(Crawler*game)=0; |
||||
static inline void ChangeState(States::State newState){ |
||||
GameState*prevState=STATE; |
||||
STATE=states[newState]; |
||||
STATE->OnStateChange(prevState); |
||||
} |
||||
}; |
@ -0,0 +1,15 @@ |
||||
#pragma once |
||||
|
||||
#include "GameState.h" |
||||
|
||||
class State_GameRun:public GameState{ |
||||
inline virtual void OnStateChange(GameState*prevState)override{ |
||||
|
||||
}; |
||||
inline virtual void OnUserUpdate(Crawler*game)override{ |
||||
|
||||
}; |
||||
inline virtual void Draw(Crawler*game)override{ |
||||
|
||||
}; |
||||
}; |
Loading…
Reference in new issue