Added dynamic labels for gamepad controls input helper. Fixed wrapping bug for pressing right on monster loot scrollable container. Added XP gain sound effect. Release Build 7112.

This commit is contained in:
2024-02-11 20:25:24 -06:00
parent 8afd66632a
commit bacd879e12
14 changed files with 192 additions and 35 deletions
+16 -1
View File
@@ -38,6 +38,7 @@ All rights reserved.
#include "InputHelper.h"
#include "AdventuresInLestoria.h"
#include "Menu.h"
#include "MenuComponent.h"
INCLUDE_game
INCLUDE_GFX
@@ -70,8 +71,22 @@ void InputHelper::Draw(){
std::vector<std::variant<Decal*,std::string>>buttonImgs; //Store decals for buttons that actually have images, and strings for buttons that have labels.
std::vector<std::string>buttonDescriptions;
#pragma region Populate all buttons to display
for(auto&[group,displayName]:inputGroups){
for(auto&[group,display]:inputGroups){
auto&primaryKey=group.GetPrimaryKey(mode);
std::string displayName;
if(std::holds_alternative<std::string>(display))displayName=std::get<std::string>(display);
else
if(std::holds_alternative<std::function<std::string(MenuFuncData)>>(display)){
std::weak_ptr<ScrollableWindowComponent>parentComponent;
if(!Menu::stack.back()->GetSelection().expired()){
parentComponent=Menu::stack.back()->GetSelection().lock()->parentComponent;
}
displayName=std::get<std::function<std::string(MenuFuncData)>>(display)(MenuFuncData{*Menu::stack.back(),game,Menu::stack.back()->GetSelection(),parentComponent});
}
else ERR("WARNING! display contains a variant alternative that does not exist. THIS SHOULD NOT BE HAPPENING!");
if(displayName.length()>0&&primaryKey.has_value()){
if(primaryKey.value().HasIcon()){
buttonImgWidth+=primaryKey.value().GetIcon().Sprite()->width+"Interface.InputHelperSpacing"_I;