Back button in character stats window, moved elements slightly upwards for better positioning.

This commit is contained in:
2023-12-08 17:06:34 -06:00
parent ae2d1719c8
commit 13104bae66
6 changed files with 68 additions and 27 deletions
+16
View File
@@ -76,4 +76,20 @@ protected:
game->DrawStringProp(drawPos,wrappedText,WHITE,scale);
}
}
virtual void inline DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{
if(decal){
MenuComponent::DrawDecal(game,parentPos,focused);
parentPos+=Menu::menus[parentMenu]->pos;
std::string wrappedText=util::WrapText(game,label,int(rect.size.x),true,{float(scale),float(scale)});
vf2d drawPos=parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*float(scale)/2; //Assume centered.
if(!centered){
drawPos=vf2d{rect.pos.x+2,rect.middle().y-game->GetTextSizeProp(wrappedText).y/2}+parentPos; //We should at least vertically align here.
}
if(shadow){
game->DrawShadowStringPropDecal(drawPos,wrappedText,WHITE,BLACK,{float(scale),float(scale)});
}else{
game->DrawStringPropDecal(drawPos,wrappedText,WHITE,{float(scale),float(scale)});
}
}
}
};