diff --git a/Crawler/Menu.h b/Crawler/Menu.h index 706f9486..69aaaed5 100644 --- a/Crawler/Menu.h +++ b/Crawler/Menu.h @@ -9,8 +9,6 @@ class Crawler; class MenuComponent; -#define COMPONENT(type,menu,componentName) ((type*)Menu::menus[menu]->components.at(componentName)) - enum MenuType{ TEST, TEST_2, @@ -24,6 +22,11 @@ enum MenuType{ /////////////////////////////////////////////////////////// }; +template +T*Component(MenuType menu,std::string componentName){ + return (T*)Menu::menus[menu]->components[componentName]; +} + class Menu:IAttributable{ friend class Crawler; friend class Player; diff --git a/Crawler/State_OverworldMap.cpp b/Crawler/State_OverworldMap.cpp index 3d9e49a8..84dde5ed 100644 --- a/Crawler/State_OverworldMap.cpp +++ b/Crawler/State_OverworldMap.cpp @@ -27,10 +27,10 @@ void State_OverworldMap::OnStateChange(GameState*prevState){ game->GetPlayer()->SetState(State::FORCE_WALK); game->GetPlayer()->SetSizeMult(1); game->camera.MoveCamera(currentConnectionPoint->rect.middle()+vf2d{game->GetScreenSize().x/6.0f,0}); - COMPONENT(MenuLabel,OVERWORLD_LEVEL_SELECT,"Chapter Label")->SetLabel("Chapter "+std::to_string(game->GetCurrentChapter())); - COMPONENT(MenuLabel,OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name); - COMPONENT(EncountersSpawnListScrollableWindowComponent,OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns); - COMPONENT(MenuComponent,OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists); + Component(OVERWORLD_LEVEL_SELECT,"Chapter Label")->SetLabel("Chapter "+std::to_string(game->GetCurrentChapter())); + Component(OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name); + Component(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns); + Component(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists); Menu::OpenMenu(OVERWORLD_LEVEL_SELECT,false); }; void State_OverworldMap::OnUserUpdate(Crawler*game){ @@ -66,9 +66,9 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){ }else{ game->GetPlayer()->UpdateWalkingAnimation(LEFT); } - COMPONENT(MenuLabel,OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name); - COMPONENT(EncountersSpawnListScrollableWindowComponent,OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns); - COMPONENT(MenuComponent,OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists); + Component(OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name); + Component(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns); + Component(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists); break; } } diff --git a/Crawler/Version.h b/Crawler/Version.h index 37d04f82..ded51223 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 2790 +#define VERSION_BUILD 2794 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/Campaigns/1_2.tmx b/Crawler/assets/Campaigns/1_2.tmx index abb93488..2c8b833c 100644 --- a/Crawler/assets/Campaigns/1_2.tmx +++ b/Crawler/assets/Campaigns/1_2.tmx @@ -1,5 +1,5 @@ - + diff --git a/x64/Release/Crawler.exe b/x64/Release/Crawler.exe index b3f90901..5abf6308 100644 Binary files a/x64/Release/Crawler.exe and b/x64/Release/Crawler.exe differ