@ -302,7 +302,7 @@ std::string InputGroup::GetDisplayName(){
return combinationDisplay ;
}
void InputGroup : : DrawInput ( const std : : variant < AiL * const , TileTransformedView * const > renderer , const vf2d pos , const std : : string_view displayText , const uint8_t alpha , InputType type ) const {
void InputGroup : : DrawInput ( 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 textScal e ) const {
std : : optional < Input > primaryKey ;
switch ( type ) {
case CONTROLLER : primaryKey = GetPrimaryKey ( CONTROLLER ) ; break ;
@ -326,7 +326,7 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
buttonImgSize . y = std : : max ( buttonImgSize . y , float ( input . GetIcon ( ) . Sprite ( ) - > height ) ) ;
buttonImgs . push_back ( input . GetIcon ( ) . Decal ( ) ) ;
} else {
buttonImgSize . x + = game - > GetTextSizeProp ( input . GetDisplayName ( ) ) . x + " Interface.InputHelperSpacing " _F ;
buttonImgSize . x + = game - > GetTextSizeProp ( input . GetDisplayName ( ) ) . x * textScale . x + " Interface.InputHelperSpacing " _F ;
buttonImgSize . y = std : : max ( buttonImgSize . y , float ( game - > GetTextSizeProp ( input . GetDisplayName ( ) ) . y ) + " Interface.InputHelperSpacing " _F ) ;
buttonImgs . push_back ( input . GetDisplayName ( ) ) ;
}
@ -345,7 +345,7 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
buttonImgSize . y = std : : max ( buttonImgSize . y , float ( primaryKey . value ( ) . GetIcon ( ) . Sprite ( ) - > height ) ) ;
buttonImgs . push_back ( primaryKey . value ( ) . GetIcon ( ) . Decal ( ) ) ;
} else {
buttonImgSize . x + = game - > GetTextSizeProp ( primaryKey . value ( ) . GetDisplayName ( ) ) . x + " Interface.InputHelperSpacing " _F ;
buttonImgSize . x + = game - > GetTextSizeProp ( primaryKey . value ( ) . GetDisplayName ( ) ) . x * textScale . x + " Interface.InputHelperSpacing " _F ;
buttonImgSize . y = std : : max ( buttonImgSize . y , float ( game - > GetTextSizeProp ( primaryKey . value ( ) . GetDisplayName ( ) ) . y ) + " Interface.InputHelperSpacing " _F ) ;
buttonImgs . push_back ( primaryKey . value ( ) . GetDisplayName ( ) ) ;
}
@ -359,19 +359,22 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
# pragma region Render Macro
# define Render(rendererType) \
std : : get < rendererType * const > ( renderer ) - > DrawDecal ( pos + offset - vf2d { 0.f , 2.f } , img , { 1.f , 1.f } , { 255 , 255 , 255 , alpha } ) ;
std : : get < rendererType * const > ( renderer ) - > DrawDecal ( pos + offset - vf2d { 0.f , 2.f } , img , textScale , { 255 , 255 , 255 , alpha } ) ;
# pragma endregion
if ( std : : holds_alternative < AiL * const > ( renderer ) ) {
Render ( AiL ) ;
} else
if ( std : : holds_alternative < TileTransformedView * const > ( renderer ) ) {
Render ( TileTransformedView ) ;
}
offset . x + = img - > sprite - > width + " Interface.InputHelperSpacing " _I ;
} else
if ( std : : holds_alternative < ViewPort * const > ( renderer ) ) {
Render ( ViewPort ) ;
} else ERR ( " Could not find proper renderer for rendering Inputs! " ) ;
offset . x + = img - > sprite - > width * textScale . x + " Interface.InputHelperSpacing " _I ;
} else
if ( std : : holds_alternative < std : : string > ( button ) ) {
std : : string label = std : : get < std : : string > ( button ) ;
vf2d textSize = game - > GetTextSizeProp ( label ) ;
vf2d textSize = game - > GetTextSizeProp ( label ) * textScale ;
Pixel buttonBackCol = " Interface.InputButtonBackCol " _Pixel ;
Pixel buttonTextCol = " Interface.InputButtonTextCol " _Pixel ;
buttonBackCol . a = alpha ;
@ -382,7 +385,7 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
std : : get < rendererType * const > ( renderer ) - > FillRectDecal ( pos + offset + vf2d { - 2.f , 0.f } , vf2d { textSize . x + 4 , textSize . y } , buttonBackCol ) ; \
std : : get < rendererType * const > ( renderer ) - > FillRectDecal ( pos + offset + vf2d { - 1.f , - 1.f } , vf2d { textSize . x + 2 , textSize . y } , buttonBackCol ) ; \
std : : get < rendererType * const > ( renderer ) - > FillRectDecal ( pos + offset + vf2d { - 1.f , 0.f } , vf2d { textSize . x + 2 , textSize . y + 1.f } , buttonBackCol ) ; \
std : : get < rendererType * const > ( renderer ) - > DrawStringPropDecal ( pos + offset + vf2d { 0.f , 0.f } , label , buttonTextCol ) ;
std : : get < rendererType * const > ( renderer ) - > DrawStringPropDecal ( pos + offset + vf2d { 0.f , 0.f } , label , buttonTextCol , textScale ) ;
# pragma endregion
if ( std : : holds_alternative < AiL * const > ( renderer ) ) {
@ -390,15 +393,33 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
} else
if ( std : : holds_alternative < TileTransformedView * const > ( renderer ) ) {
Render ( TileTransformedView ) ;
}
} else
if ( std : : holds_alternative < ViewPort * const > ( renderer ) ) {
Render ( ViewPort ) ;
} else ERR ( " Could not find proper renderer for rendering Inputs! " ) ;
offset . x + = textSize . x + " Interface.InputHelperSpacing " _I ;
} else [[unlikely]] ERR ( " WARNING! Hit a state where no data is inside of the button! THIS SHOULD NOT BE HAPPENING! " ) ;
}
# pragma region Render Display Text
# pragma region Render Macro
# define Render(rendererType) \
std : : get < rendererType * const > ( renderer ) - > DrawShadowStringPropDecal ( pos + offset , displayText , { 255 , 255 , 255 , alpha } , { 0 , 0 , 0 , alpha } , textScale ) ;
# pragma endregion
game - > view . DrawShadowStringPropDecal ( pos + offset , displayText , { 255 , 255 , 255 , alpha } , { 0 , 0 , 0 , alpha } ) ;
if ( std : : holds_alternative < AiL * const > ( renderer ) ) {
Render ( AiL ) ;
} else
if ( std : : holds_alternative < TileTransformedView * const > ( renderer ) ) {
Render ( TileTransformedView ) ;
} else
if ( std : : holds_alternative < ViewPort * const > ( renderer ) ) {
Render ( ViewPort ) ;
} else ERR ( " Could not find proper renderer for rendering Inputs! " ) ;
# pragma endregion
}
void InputGroup : : DrawInput ( const std : : variant < AiL * const , TileTransformedView * const > renderer , const vf2d pos , const std : : string_view displayText , const uint8_t alpha ) const {
void InputGroup : : DrawInput ( const std : : variant < AiL * const , TileTransformedView * const , ViewPort * const > renderer , const vf2d pos , const std : : string_view displayText , const uint8_t alpha ) const {
InputType primaryType ;
if ( Input : : UsingGamepad ( ) ) primaryType = CONTROLLER ;
else if ( Menu : : UsingMouseNavigation ( ) ) primaryType = MOUSE ;