#pragma once #include #include #include "Crawler.h" #include "Error.h" INCLUDE_game namespace States{ enum State{ GAME_RUN, OVERWORLD_MAP, MAIN_MENU, }; }; class GameState{ public: inline static GameState*STATE=nullptr; inline static std::mapstates; virtual ~GameState(); static void Initialize(); 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; if(!states.count(newState)){ ERR("WARNING! State not defined for state "<camera.SetTarget(game->GetPlayer()->GetPos()); STATE->OnStateChange(prevState); } };