Implemented string view changes for internal drawing functions and added wrapping support and parameters for draw functions.

This commit is contained in:
2023-12-20 19:45:49 -06:00
parent 08e60f2351
commit d29f7d47bd
8 changed files with 504 additions and 228 deletions
+4 -2
View File
@@ -119,13 +119,15 @@ void MenuComponent::DrawDecal(ViewPort&window,bool focused){
}
if(showDefaultLabel){
vf2d adjustedScale=labelScaling;
vi2d labelTextSize=game->GetTextSizeProp(label,rect.size.x);
if(fitToLabel){
float sizeRatio=((game->GetTextSizeProp(label)*adjustedScale).x)/(rect.size.x-2);
float sizeRatio=((labelTextSize*adjustedScale).x)/(rect.size.x-2);
if(sizeRatio>1){
adjustedScale.x/=sizeRatio;
}
}
window.DrawStringPropDecal(rect.pos+V(A::DRAW_OFFSET)+rect.size/2-vf2d(game->GetTextSizeProp(label))/2.f*adjustedScale,label,WHITE,adjustedScale);
window.DrawStringPropDecal(rect.pos+V(A::DRAW_OFFSET)+rect.size/2-vf2d(labelTextSize)/2.f*adjustedScale,label,WHITE,adjustedScale,rect.size.x);
}
if(selected){
switch(selectionType){