parent
43661ee07f
commit
773f72a45c
@ -0,0 +1,10 @@ |
||||
#include "GameState.h" |
||||
|
||||
#define NEW_STATE(state,class) GameState::states[state]=new class(); |
||||
|
||||
void GameState::Initialize(){ |
||||
NEW_STATE(States::GAME_RUN,State_GameRun); |
||||
NEW_STATE(States::MAIN_MENU,State_MainMenu); |
||||
|
||||
GameState::ChangeState(States::GAME_RUN); |
||||
} |
@ -0,0 +1,36 @@ |
||||
#include "GameState.h" |
||||
#include "Crawler.h" |
||||
#include "DEFINES.h" |
||||
#include "Menu.h" |
||||
|
||||
INCLUDE_MONSTER_LIST |
||||
|
||||
void State_GameRun::OnStateChange(GameState*prevState){ |
||||
Menu::stack.clear(); |
||||
}; |
||||
void State_GameRun::OnUserUpdate(Crawler*game){ |
||||
game->bossDisplayTimer=std::max(0.f,game->bossDisplayTimer-game->GetElapsedTime()); |
||||
if(game->encounterStarted&&game->totalBossEncounterMobs>0){ |
||||
game->encounterDuration+=game->GetElapsedTime(); |
||||
} |
||||
game->HandleUserInput(game->GetElapsedTime()); |
||||
|
||||
if(game->GetKey(T).bPressed){ |
||||
GameState::ChangeState(States::MAIN_MENU); |
||||
} |
||||
|
||||
game->UpdateEffects(game->GetElapsedTime()); |
||||
game->GetPlayer()->Update(game->GetElapsedTime()); |
||||
for(Monster&m:MONSTER_LIST){ |
||||
m.Update(game->GetElapsedTime()); |
||||
} |
||||
for(Monster&m:game->monstersToBeSpawned){ |
||||
MONSTER_LIST.push_back(m); |
||||
} |
||||
game->monstersToBeSpawned.clear(); |
||||
|
||||
game->UpdateBullets(game->GetElapsedTime()); |
||||
game->UpdateCamera(game->GetElapsedTime()); |
||||
}; |
||||
void State_GameRun::Draw(Crawler*game){ |
||||
}; |
@ -1,15 +0,0 @@ |
||||
#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{ |
||||
|
||||
}; |
||||
}; |
@ -0,0 +1,16 @@ |
||||
#include "GameState.h" |
||||
#include "Crawler.h" |
||||
#include "Menu.h" |
||||
|
||||
void State_MainMenu::OnStateChange(GameState*prevState){ |
||||
Menu::OpenMenu(MenuType::TEST); |
||||
}; |
||||
void State_MainMenu::OnUserUpdate(Crawler*game){ |
||||
|
||||
if(game->GetKey(T).bPressed){ |
||||
GameState::ChangeState(States::GAME_RUN); |
||||
} |
||||
}; |
||||
void State_MainMenu::Draw(Crawler*game){ |
||||
game->DrawShadowStringDecal({0,0},"This will eventually be\nMain Menu stuff",BLACK,WHITE,{1,1},1); |
||||
}; |
Loading…
Reference in new issue