Fix wrapped text on MenuLabel components bleeding out over the edges. Release build 11202.

pull/65/head
sigonasr2 7 months ago
parent 85124b8875
commit 57b59f943c
  1. 1
      Adventures in Lestoria/MenuComponent.cpp
  2. 16
      Adventures in Lestoria/MenuLabel.h
  3. 2
      Adventures in Lestoria/Version.h
  4. BIN
      x64/Release/Adventures in Lestoria.exe

@ -99,6 +99,7 @@ void MenuComponent::DrawDecal(ViewPort&window,bool focused){
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{rect.size.x-1+1,0},{1,rect.size.y+1},borderCol); window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{rect.size.x-1+1,0},{1,rect.size.y+1},borderCol);
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{0,rect.size.y-1+1},{rect.size.x+1,1},borderCol); window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{0,rect.size.y-1+1},{rect.size.x+1,1},borderCol);
} }
if(showDefaultLabel){ if(showDefaultLabel){
vf2d adjustedScale=labelScaling; vf2d adjustedScale=labelScaling;
vi2d labelTextSize=vf2d(game->GetTextSizeProp(label))*adjustedScale; vi2d labelTextSize=vf2d(game->GetTextSizeProp(label))*adjustedScale;

@ -94,15 +94,15 @@ protected:
vf2d adjustedShadowScale={shadowScale,shadowScale}; vf2d adjustedShadowScale={shadowScale,shadowScale};
vf2d labelTextSize= vf2d labelTextSize=
proportional? proportional?
vf2d(game->GetWrappedTextSizeProp(finalLabel,rect.size.x-4,adjustedScale)): vf2d(game->GetWrappedTextSizeProp(finalLabel,rect.size.x-8,adjustedScale)):
vf2d(game->GetWrappedTextSize(finalLabel,rect.size.x-4,adjustedScale)); vf2d(game->GetWrappedTextSize(finalLabel,rect.size.x-8,adjustedScale));
if(fitToLabel){ if(fitToLabel){
labelTextSize= labelTextSize=
proportional? proportional?
vf2d(game->GetTextSizeProp(finalLabel)*adjustedScale): vf2d(game->GetTextSizeProp(finalLabel)*adjustedScale):
vf2d(game->GetTextSize(finalLabel)*adjustedScale); vf2d(game->GetTextSize(finalLabel)*adjustedScale);
float sizeRatio=(labelTextSize.x)/(rect.size.x-4); float sizeRatio=(labelTextSize.x)/(rect.size.x-8);
if(sizeRatio>1){ if(sizeRatio>1){
adjustedScale.x/=sizeRatio; adjustedScale.x/=sizeRatio;
adjustedShadowScale.x/=sizeRatio; adjustedShadowScale.x/=sizeRatio;
@ -113,7 +113,7 @@ protected:
vf2d drawPos=vf2d{-1,0}+rect.middle()-vf2d{labelTextSize}/2; //Assume centered. vf2d drawPos=vf2d{-1,0}+rect.middle()-vf2d{labelTextSize}/2; //Assume centered.
if(!centered){ if(!centered){
if(rightAlign){ if(rightAlign){
drawPos=vf2d{rect.pos.x+rect.size.x-labelTextSize.x-4,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here. drawPos=vf2d{rect.pos.x+rect.size.x-labelTextSize.x-8,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here.
}else{ //Left Align }else{ //Left Align
drawPos=vf2d{rect.pos.x+2,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here. drawPos=vf2d{rect.pos.x+2,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here.
} }
@ -141,15 +141,15 @@ protected:
}else{ }else{
if(shadow){ if(shadow){
if(proportional){ if(proportional){
window.DrawShadowStringPropDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,adjustedShadowScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-4); window.DrawShadowStringPropDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,adjustedShadowScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-8);
}else{ }else{
window.DrawShadowStringDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,adjustedShadowScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-4); window.DrawShadowStringDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,adjustedShadowScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-8);
} }
}else{ }else{
if(proportional){ if(proportional){
window.DrawStringPropDecal(drawPos,finalLabel,WHITE,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-4); window.DrawStringPropDecal(drawPos,finalLabel,WHITE,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-8);
}else{ }else{
window.DrawStringDecal(drawPos,finalLabel,WHITE,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-4); window.DrawStringDecal(drawPos,finalLabel,WHITE,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-8);
} }
} }
} }

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 5 #define VERSION_PATCH 5
#define VERSION_BUILD 11201 #define VERSION_BUILD 11202
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save