diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index 27beec4c..841ea8f8 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -568,7 +568,17 @@ std::string InputGroup::GetDisplayName(){ void InputGroup::DrawInput(const std::variantrenderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha,InputType type,vf2d textScale)const{ std::vectordisplayKeys; + + auto OriginalGameIcon=[](std::optionalinput)->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 STEAM:std::copy_if(keys.begin(),keys.end(),std::back_inserter(displayKeys),[](const Input&input){return input.GetType()==STEAM;});break; case CONTROLLER:std::copy_if(keys.begin(),keys.end(),std::back_inserter(displayKeys),[](const Input&input){return input.GetType()==CONTROLLER;});break; case MOUSE:std::copy_if(keys.begin(),keys.end(),std::back_inserter(displayKeys),[](const Input&input){return input.GetType()==KEY||input.GetType()==MOUSE;});break; default:std::copy_if(keys.begin(),keys.end(),std::back_inserter(displayKeys),[](const Input&input){return input.GetType()==KEY||input.GetType()==MOUSE;});break; @@ -584,8 +594,14 @@ void InputGroup::DrawInput(const std::variantwidth*textScale.x+"Interface.InputHelperSpacing"_F; - buttonImgSize.y=std::max(buttonImgSize.y,float(input.GetIcon().Sprite()->height)); + float alteredIconScale=1.f; + + if(type==STEAM&&!OriginalGameIcon(input)){ + alteredIconScale/=2.85f; //They are initially 32x32. + } + + buttonImgSize.x+=input.GetIcon().Sprite()->width*alteredIconScale*textScale.x+"Interface.InputHelperSpacing"_F; + buttonImgSize.y=std::max(buttonImgSize.y,float(input.GetIcon().Sprite()->height*alteredIconScale)); buttonImgs.push_back(input.GetIcon().Decal()); }else{ buttonImgSize.x+=game->GetTextSizeProp(input.GetDisplayName()).x*textScale.x+"Interface.InputHelperSpacing"_F; @@ -596,10 +612,11 @@ void InputGroup::DrawInput(const std::variantGetTextSizeProp(displayText); vf2d offset=-((buttonImgSize+descriptionTextSize)/2.f); - for(auto&button:buttonImgs){ + for(size_t index=0;auto&button:buttonImgs){ if(std::holds_alternative(button)){ Decal*img=std::get(button); - + float alteredIconScale=1.f; + if(type==STEAM&&!OriginalGameIcon(displayKeys[index]))alteredIconScale/=2.85f; /*They are initially 32x32.*/ #pragma region Render Macro #define Render(rendererType) \ std::get(renderer)->DrawDecal(pos+offset-vf2d{0.f,2.f},img,textScale,{255,255,255,alpha}); @@ -613,7 +630,7 @@ void InputGroup::DrawInput(const std::variant(renderer)){ Render(ViewPort); }else ERR("Could not find proper renderer for rendering Inputs!"); - offset.x+=img->sprite->width*textScale.x+"Interface.InputHelperSpacing"_I; + offset.x+=img->sprite->width*alteredIconScale*textScale.x+"Interface.InputHelperSpacing"_I; }else if(std::holds_alternative(button)){ std::string label=std::get(button); @@ -642,6 +659,7 @@ void InputGroup::DrawInput(const std::variant(button)){ Decal*img=std::get(button); - + float alteredIconScale=1.f; + if(type==STEAM&&!OriginalGameIcon(primaryKey))alteredIconScale/=2.85f; /*They are initially 32x32.*/ #pragma region Render Macro #define Render(rendererType) \ - float alteredIconScale=1.f; \ - \ - if(type==STEAM&&!OriginalGameIcon(primaryKey))alteredIconScale/=2.85f; /*They are initially 32x32.*/ \ std::get(renderer)->DrawDecal(pos+offset-vf2d{0.f,2.f},img,alteredIconScale*textScale,{255,255,255,alpha}); #pragma endregion if(std::holds_alternative(renderer)){ @@ -756,7 +772,7 @@ void InputGroup::DrawPrimaryInput(const std::variant(renderer)){ Render(ViewPort); }else ERR("Could not find proper renderer for rendering Inputs!"); - offset.x+=img->sprite->width*textScale.x+"Interface.InputHelperSpacing"_I; + offset.x+=img->sprite->width*alteredIconScale*textScale.x+"Interface.InputHelperSpacing"_I; }else if(std::holds_alternative(button)){ std::string label=std::get(button); diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index cb78c578..3c6caf1b 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 5 #define VERSION_PATCH 1 -#define VERSION_BUILD 8336 +#define VERSION_BUILD 8339 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 945d2014..9cee4a39 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ