@ -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 ( ) ) {
@ -710,7 +719,9 @@ void InputGroup::DrawPrimaryInput(const std::variant<AiL*const,TileTransformedVi
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,8 +855,12 @@ const bool Input::HasExtendedIcons()const{
const Renderable & Input : : GetIcon ( ) const {
if ( type = = STEAM ) {
EInputActionOrigin action = Input : : steamGameInputToOrigin . at ( Steam : : SteamInput ( key ) ) . second [ 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 ) ;
}
const Renderable & Input : : GetIcon ( IconType type ) const {