Prepare framework with Draw and DrawDecal split.

This commit is contained in:
2023-10-11 19:50:12 -05:00
parent dd2ff24d85
commit e3d0283fcb
16 changed files with 479 additions and 46 deletions
+5 -3
View File
@@ -2,6 +2,7 @@
#include "MenuComponent.h"
#include "DEFINES.h"
#include "Crawler.h"
#include "utils.h"
INCLUDE_game
@@ -21,14 +22,15 @@ protected:
MenuComponent::Update(game);
}
virtual void inline Draw(Crawler*game,vf2d parentPos,bool focused)override{
vf2d drawPos=rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2; //Assume centered.
std::string wrappedText=util::WrapText(game,label,rect.size.x,true,{1,1});
vf2d drawPos=parentPos+rect.middle()-game->GetTextSizeProp(wrappedText)/2; //Assume centered.
if(!centered){
drawPos=rect.pos+parentPos;
}
if(shadow){
game->DrawShadowStringPropDecal(drawPos,label,focused?WHITE:WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F);
game->DrawShadowStringProp(drawPos,wrappedText,focused?WHITE:WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F);
}else{
game->DrawStringPropDecal(drawPos,label,focused?WHITE:WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F);
game->DrawStringProp(drawPos,wrappedText,focused?WHITE:WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F);
}
}
};