Implemented User ID screen, added a text change callback function for text entry labels.
This commit is contained in:
+23
-1
@@ -39,10 +39,32 @@ All rights reserved.
|
||||
#include "Menu.h"
|
||||
#include "MenuLabel.h"
|
||||
#include "TextEntryLabel.h"
|
||||
#include "SaveFile.h"
|
||||
|
||||
using A=Attribute;
|
||||
|
||||
void Menu::InitializeUserIDWindow(){
|
||||
Menu*userIDWindow=CreateMenu(USER_ID,CENTERED,vi2d{168,120});
|
||||
|
||||
userIDWindow->ADD("User ID Creation Explanation",MenuLabel)({{0,-4},{168,92}},"user_id_message"_FS+"\n\n"+"user_id_message2"_FS,1.f,ComponentAttr::SHADOW|ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE)END;
|
||||
userIDWindow->ADD("User ID Input",TextEntryLabel)({{36,94},{96,12}},true,24U,1.f,ComponentAttr::BACKGROUND|ComponentAttr::FIT_TO_LABEL|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END;
|
||||
userIDWindow->ADD("User ID Input",TextEntryLabel)({{36,94},{96,12}},[](std::string_view newLabel){
|
||||
Component<MenuComponent>(USER_ID,"Submit Button")->SetGrayedOut(newLabel.length()==0);
|
||||
},true,24U,1.f,ComponentAttr::BACKGROUND|ComponentAttr::FIT_TO_LABEL|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END;
|
||||
userIDWindow->ADD("Back Button",MenuComponent)({{18,110},{48,12}},"Back",[](MenuFuncData data){
|
||||
Menu::CloseMenu();
|
||||
return true;
|
||||
})END;
|
||||
userIDWindow->ADD("Submit Button",MenuComponent)({{102,110},{48,12}},"Submit",[](MenuFuncData data){
|
||||
SaveFile::SetUserID(Component<TextEntryLabel>(USER_ID,"User ID Input")->GetLabel());
|
||||
if(Menu::menus[MAIN_MENU]->S(A::NEXT_MENU)=="New Game"){
|
||||
Component<MenuComponent>(MAIN_MENU,"New Game Button")->Click();
|
||||
}else
|
||||
if(Menu::menus[MAIN_MENU]->S(A::NEXT_MENU)=="Load Game"){
|
||||
Component<MenuComponent>(MAIN_MENU,"Load Game Button")->Click();
|
||||
}else{
|
||||
ERR("WARNING! Unknown Next Menu set! Current Value:"<<std::quoted(Menu::menus[MAIN_MENU]->S(A::NEXT_MENU)));
|
||||
}
|
||||
return true;
|
||||
})END
|
||||
->SetGrayedOut(true);
|
||||
}
|
||||
Reference in New Issue
Block a user