Prepare framework with Draw and DrawDecal split.
This commit is contained in:
+5
-3
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user