Added proper icon return based on button style game setting and proper icon translation when a current graphic of that button exists by default. Release Build 8336.

mac-build
sigonasr2 8 months ago
parent b9c89e5715
commit 3e35645b09
  1. 51
      Adventures in Lestoria/Key.cpp
  2. 1
      Adventures in Lestoria/Key.h
  3. 2
      Adventures in Lestoria/Version.h
  4. BIN
      x64/Release/Adventures in Lestoria.exe

@ -664,6 +664,15 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
void InputGroup::DrawPrimaryInput(const std::variant<AiL*const,TileTransformedView*const,ViewPort*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,InputType type,vf2d textScale)const{
std::optional<Input>primaryKey;
auto OriginalGameIcon=[](std::optional<Input>input)->bool{
if(input.has_value()){
EInputActionOrigin action=Input::steamGameInputToOrigin.at(Steam::SteamInput(input.value().key)).second[0];
return Input::steamIconToGameIcon.count(action);
}
return true;
};
switch(type){
case CONTROLLER:{
if(SteamInput()){
@ -709,8 +718,10 @@ void InputGroup::DrawPrimaryInput(const std::variant<AiL*const,TileTransformedVi
}else
if(primaryKey.value().HasIcon()){
float alteredIconScale=1.f;
if(type==STEAM)alteredIconScale/=2.85f; //They are initially 32x32.
if(type==STEAM&&!OriginalGameIcon(primaryKey)){
alteredIconScale/=2.85f; //They are initially 32x32.
}
buttonImgSize.x+=primaryKey.value().GetIcon().Sprite()->width*alteredIconScale*textScale.x+"Interface.InputHelperSpacing"_F;
buttonImgSize.y=std::max(buttonImgSize.y,float(primaryKey.value().GetIcon().Sprite()->height*alteredIconScale));
@ -733,7 +744,7 @@ void InputGroup::DrawPrimaryInput(const std::variant<AiL*const,TileTransformedVi
#define Render(rendererType) \
float alteredIconScale=1.f; \
\
if(type==STEAM)alteredIconScale/=2.85f; /*They are initially 32x32.*/ \
if(type==STEAM&&!OriginalGameIcon(primaryKey))alteredIconScale/=2.85f; /*They are initially 32x32.*/ \
std::get<rendererType*const>(renderer)->DrawDecal(pos+offset-vf2d{0.f,2.f},img,alteredIconScale*textScale,{255,255,255,alpha});
#pragma endregion
if(std::holds_alternative<AiL*const>(renderer)){
@ -802,6 +813,34 @@ void InputGroup::DrawPrimaryInput(const std::variant<AiL*const,TileTransformedVi
DrawPrimaryInput(renderer,pos,displayText,alpha,primaryType);
}
std::string Input::GetProperIconName(std::string currentIconName)const{
switch(GameSettings::GetIconType()){
case IconType::XB:{
return currentIconName;
}break;
case IconType::PS:{
if(currentIconName.ends_with("_xb.png")){
return currentIconName.replace(currentIconName.rfind("_xb.png"),7,"_ps.png");
}
}break;
case IconType::XB_REVERSED:{
if(currentIconName.ends_with("_d_xb.png")){
return currentIconName.replace(currentIconName.rfind("_d_xb.png"),9,"_r_xb.png");
}else
if(currentIconName.ends_with("_u_xb.png")){
return currentIconName.replace(currentIconName.rfind("_u_xb.png"),9,"_l_xb.png");
}else
if(currentIconName.ends_with("_l_xb.png")){
return currentIconName.replace(currentIconName.rfind("_l_xb.png"),9,"_u_xb.png");
}else
if(currentIconName.ends_with("_r_xb.png")){
return currentIconName.replace(currentIconName.rfind("_r_xb.png"),9,"_d_xb.png");
}
}break;
}
return currentIconName;
}
const bool Input::HasIcon()const{
if(type==STEAM){
return Input::steamGameInputToOrigin.count(Steam::SteamInput(key))&&
@ -816,7 +855,11 @@ const bool Input::HasExtendedIcons()const{
const Renderable&Input::GetIcon()const{
if(type==STEAM){
EInputActionOrigin action=Input::steamGameInputToOrigin.at(Steam::SteamInput(key)).second[0];
return GFX.at(SteamInput()->GetGlyphPNGForActionOrigin(action,k_ESteamInputGlyphSize_Small,0));
if(steamIconToGameIcon.count(action)){
return GFX.at(GetProperIconName(steamIconToGameIcon[action]));
}else{
return GFX.at(SteamInput()->GetGlyphPNGForActionOrigin(action,k_ESteamInputGlyphSize_Small,0));
}
}
return GFX.at(GenericKey::keyLiteral.at({type,key}).iconName);
}

@ -137,6 +137,7 @@ public:
const Renderable&GetIcon(IconType type)const;
const int GetKeyCode()const;
friend const bool operator==(const Input&input1,const Input&input2);
std::string GetProperIconName(std::string currentIconName)const;
static uint64_t ingameControlsHandle;
};

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_PATCH 1
#define VERSION_BUILD 8330
#define VERSION_BUILD 8336
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save