Confirm and Back Buttons added.
This commit is contained in:
parent
02c7165b37
commit
598ce523e9
@ -4,6 +4,7 @@
|
||||
#include "Menu.h"
|
||||
#include "MenuLabel.h"
|
||||
#include "MenuAnimatedIconButton.h"
|
||||
#include "GameState.h"
|
||||
|
||||
INCLUDE_game
|
||||
typedef Attribute A;
|
||||
@ -22,6 +23,13 @@ void Menu::InitializeClassSelectionWindow(){
|
||||
|
||||
classSelectionWindow->AddComponent("Outline Border",outline);
|
||||
|
||||
vf2d navigationButtonSize={24*2.5f,16};
|
||||
|
||||
MenuComponent*backButton=new MenuComponent(CLASS_SELECTION,{{4+2,outlineSize.y+4-navigationButtonSize.y-2},navigationButtonSize},"Back",[](MenuFuncData data){Menu::CloseMenu();});
|
||||
classSelectionWindow->AddComponent("Back Button",backButton);
|
||||
MenuComponent*confirmButton=new MenuComponent(CLASS_SELECTION,{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+4-navigationButtonSize.y-2},navigationButtonSize},"Confirm",[](MenuFuncData data){GameState::ChangeState(States::GAME_RUN);});
|
||||
classSelectionWindow->AddComponent("Confirm",confirmButton);
|
||||
|
||||
vf2d buttonPadding={2,2};
|
||||
vf2d buttonSize={floor(outlineSize.y/3-buttonPadding.y*3),outlineSize.y/9-buttonPadding.y*3}; //The floor is for fixing a small pixel rounding bug.
|
||||
|
||||
|
@ -640,3 +640,11 @@ void Menu::CloseMenu(){
|
||||
std::pair<MenuType,std::string>Menu::GetMemoryLeakReportInfo(){
|
||||
return {lastMenuTypeCreated,lastRegisteredComponent};
|
||||
}
|
||||
|
||||
void Menu::CloseAllMenus(){
|
||||
if(stack.size()<=0){
|
||||
std::cout<<"WARNING! Trying to close out no menu?? Why are we doing this?"<<std::endl;
|
||||
throw;
|
||||
}
|
||||
stack.clear();
|
||||
}
|
@ -43,6 +43,7 @@ public:
|
||||
static void InitializeMenus();
|
||||
static void OpenMenu(MenuType menu);
|
||||
static void CloseMenu();
|
||||
static void CloseAllMenus();
|
||||
static std::vector<Menu*>stack;
|
||||
static std::string themeSelection;
|
||||
static safeunorderedmap<std::string,Theme>themes;
|
||||
|
@ -7,7 +7,7 @@
|
||||
INCLUDE_MONSTER_LIST
|
||||
|
||||
void State_GameRun::OnStateChange(GameState*prevState){
|
||||
Menu::stack.clear();
|
||||
Menu::CloseAllMenus();
|
||||
};
|
||||
void State_GameRun::OnUserUpdate(Crawler*game){
|
||||
game->bossDisplayTimer=std::max(0.f,game->bossDisplayTimer-game->GetElapsedTime());
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 2391
|
||||
#define VERSION_BUILD 2393
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Loading…
x
Reference in New Issue
Block a user