Add functional Equipment and Skills Tab toggle functionality.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m43s

This commit is contained in:
sigonasr2 2025-06-02 07:55:15 -05:00
parent 667c5d2da6
commit 93fb1fd48e

View File

@ -165,17 +165,6 @@ void Menu::InitializeCharacterMenuWindow(){
return attrStr;
};
auto equipmentTab = characterMenuWindow->ADD("Equipment Tab",MenuComponent)(geom2d::rect<float>{{2,30},{58,10}},"Equipment",[](MenuFuncData data){
return true;
},ButtonAttr::FIT_TO_LABEL)END;
equipmentTab->SetSelectionType(HIGHLIGHT);
equipmentTab->SetSelected(true);
auto skillsTab = characterMenuWindow->ADD("Skills Tab",MenuComponent)(geom2d::rect<float>{{62,30},{56,10}},"Skills",[](MenuFuncData data){
return true;
},ButtonAttr::FIT_TO_LABEL)END;
skillsTab->SetSelectionType(HIGHLIGHT);
skillsTab->SetSelected(false);
int equipSlot=1;
for(int i=0;i<8;i++){
float x=31+(i%2)*33;
@ -347,6 +336,36 @@ void Menu::InitializeCharacterMenuWindow(){
Menu::AddEquipStatListener(equipmentSlot);
}
enum class ClickedTab{
EQUIPMENT,
SKILLS
};
//Used in conjunction with the onClick events of MenuComponents tab.
auto OnTabClick=[](const ClickedTab tabClicked,const MenuFuncData&data){
using enum ClickedTab;
for(int i=0;i<8;i++){
auto slot{Component<EquipSlotButton>(data.menu.GetType(),CharacterMenuWindow::slotNames[i])};
if(tabClicked==EQUIPMENT)slot->Enable();
else slot->Disable();
Component<MenuComponent>(data.menu.GetType(),"Equipment Tab")->SetSelected(tabClicked==EQUIPMENT);
Component<MenuComponent>(data.menu.GetType(),"Skills Tab")->SetSelected(tabClicked==SKILLS);
}
};
auto equipmentTab = characterMenuWindow->ADD("Equipment Tab",MenuComponent)(geom2d::rect<float>{{2,30},{58,10}},"Equipment",[&OnTabClick](MenuFuncData data){
OnTabClick(ClickedTab::EQUIPMENT,data);
return true;
},ButtonAttr::FIT_TO_LABEL)END;
equipmentTab->SetSelectionType(HIGHLIGHT);
equipmentTab->SetSelected(true);
auto skillsTab = characterMenuWindow->ADD("Skills Tab",MenuComponent)(geom2d::rect<float>{{62,30},{56,10}},"Skills",[&OnTabClick](MenuFuncData data){
OnTabClick(ClickedTab::SKILLS,data);
return true;
},ButtonAttr::FIT_TO_LABEL)END;
skillsTab->SetSelectionType(HIGHLIGHT);
skillsTab->SetSelected(false);
characterMenuWindow->ADD("Stat Display Outline",MenuComponent)(geom2d::rect<float>{{245,28},{62,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END;
int yOffset=0;