Compare commits

...

2 Commits

Author SHA1 Message Date
9b252334e5 Proper implementation of skill and ability displays in the Character menu. Ready for merge. Release Build 12245.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m2s
2025-08-01 13:46:33 -05:00
ad28ead6d5 Ability icons and label default visibility and toggle visibility taken care of. 2025-07-30 08:45:28 -05:00
5 changed files with 31 additions and 12 deletions

View File

@ -137,8 +137,12 @@ void Menu::InitializeCharacterMenuWindow(){
->Disable();
characterMenuWindow->ADD("Equip List",ScrollableWindowComponent)(geom2d::rect<float>{{123,28},{120,windowSize.y-37-24}})DEPTH -1 END
->Disable();
characterMenuWindow->ADD("Equip Selection Bottom Outline",MenuComponent)(geom2d::rect<float>{{123,28+(windowSize.y-37-24)},{120,24}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END
characterMenuWindow->ADD("Equip Selection Bottom Outline",MenuComponent)(geom2d::rect<float>{{123,28+(windowSize.y-37-24)},{120,24}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)DEPTH 2 END
->Disable();
auto abilitySelectionOutline{characterMenuWindow->ADD("Ability Selection Outline",MenuComponent)(geom2d::rect<float>{{123,28},{120,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)DEPTH 0 END};
abilitySelectionOutline->Disable();
auto equipSelectionSelectButton=characterMenuWindow->ADD("Equip Selection Select Button",MenuComponent)(geom2d::rect<float>{{123+12,28+(windowSize.y-37-24)+6},{96,12}},"Select",
[](MenuFuncData data){
Component<MenuComponent>(data.component.lock()->parentMenu,"Equip Selection Outline")->Disable();
@ -339,8 +343,9 @@ void Menu::InitializeCharacterMenuWindow(){
}
#pragma endregion
auto abilityNameLabel{characterMenuWindow->ADD("Ability Name Text",MenuLabel)(geom2d::rect<float>{{125,30},{116,windowSize.y-39}},"",1.f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW)END};
auto abilityDescriptionLabel{characterMenuWindow->ADD("Ability Description Text",MenuLabel)(geom2d::rect<float>{{125,30+16},{116,windowSize.y-39-16}},"",1.f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW)END};
auto abilityNameLabel{characterMenuWindow->ADD("Ability Name Text",MenuLabel)(geom2d::rect<float>{{123,28},{116,12}},"",1.f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)DEPTH -1 END};
auto abilityDescriptionLabel{characterMenuWindow->ADD("Ability Description Text",MenuLabel)(geom2d::rect<float>{{125,30+16},{116,windowSize.y-39-16}},"",1.f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW)DEPTH -1 END};
abilityNameLabel->Disable();
#pragma region Skill Selection Boxes
const std::array abilityBoxes{
@ -359,11 +364,23 @@ void Menu::InitializeCharacterMenuWindow(){
auto skillNameLabel{characterMenuWindow->ADD(std::format("Skill Name Label {}",i),MenuLabel)(geom2d::rect<float>{{labelX+4,labelY-6},{96,24}},ability.get().GetNameWithPlayerModifiers())END};
skillBox->SetHoverFunc([slot](MenuFuncData data){
const auto&ability{game->GetPlayer()->GetAbility(slot)};
Component<MenuLabel>(data.menu.GetType(),"Ability Name Text")->SetLabel(ability.GetNameWithPlayerModifiers());
Component<MenuLabel>(data.menu.GetType(),"Ability Description Text")->SetLabel(ability.GetDescriptionWithPlayerModifiers());
auto abilityNameTextLabel{Component<MenuLabel>(data.menu.GetType(),"Ability Name Text")};
auto abilityDescriptionTextLabel{Component<MenuLabel>(data.menu.GetType(),"Ability Description Text")};
abilityNameTextLabel->SetLabel(ability.GetNameWithPlayerModifiers());
abilityDescriptionTextLabel->SetLabel(ability.GetDescriptionWithPlayerModifiers());
abilityNameTextLabel->Enable();
abilityDescriptionTextLabel->Enable();
Component<MenuComponent>(data.menu.GetType(),"Ability Selection Outline")->Enable();
return true;
});
skillBox->SetMouseOutFunc([](MenuFuncData data){
Component<MenuLabel>(data.menu.GetType(),"Ability Name Text")->Disable();
Component<MenuLabel>(data.menu.GetType(),"Ability Description Text")->Disable();
Component<MenuComponent>(data.menu.GetType(),"Ability Selection Outline")->Disable();
return true;
});
skillBox->Disable(); //Hide these by default.
skillNameLabel->Disable(); //Hide these by default.
i++;
}
#pragma endregion
@ -397,8 +414,10 @@ void Menu::InitializeCharacterMenuWindow(){
abilityIcon->SetIcon(GFX[ability.get().icon].Decal());
abilityText->SetLabel(ability.get().GetNameWithPlayerModifiers());
if(tabClicked==SKILLS){
abilityIcon->Enable();
abilityText->Enable();
if(abilityText->GetLabel()!="???"){ //Unknown abilities should remain hidden for the player's surprise.
abilityIcon->Enable();
abilityText->Enable();
}
}else{
abilityIcon->Disable();
abilityText->Disable();

View File

@ -67,9 +67,9 @@ using ToggleFunc=std::function<bool(ToggleFuncData)>;
#define END )
#define DEPTH ,
#define DEFAULT_DEPTH -999999
#define STARTING_DEPTH 999999
#define MAX_MENUS 64
constexpr int DEFAULT_DEPTH = -999999;
constexpr int STARTING_DEPTH = 999999;
constexpr uint16_t MAX_MENUS = 64;
using Data=std::variant<ButtonName,std::weak_ptr<MenuComponent>>;
using MenuDataFunc=std::function<void(MenuType,Data&)>;

View File

@ -99,7 +99,7 @@ private:
std::weak_ptr<MenuComponent>subcomponentParent; //For subcomponents, this value provides the actual component this subcomponent was spawned from.
protected:
int depth=0;
int depth=0; //Higher depth (positive) means in front. Lower depth (negative) means behind.
float hoverEffect=0;
std::string name="";
geom2d::rect<float>rect;

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 12212
#define VERSION_BUILD 12245
#define stringify(a) stringify_(a)
#define stringify_(a) #a