Proper theming controls added, attributes are now an inheritable interface for anything.

This commit is contained in:
2023-10-03 02:34:26 -05:00
parent bff7eabef5
commit 999855c6e8
24 changed files with 289 additions and 122 deletions
+8 -6
View File
@@ -1,11 +1,11 @@
#include "Crawler.h"
#include "Menu.h"
MenuComponent::MenuComponent(geom2d::rect<float>rect,std::string label,MenuFunc onClick)
:rect(rect),label(label),menuDest(MenuType::ENUM_END),onClick(onClick),hoverEffect(0){}
MenuComponent::MenuComponent(geom2d::rect<float>rect,std::string label,MenuFunc onClick,bool selectable)
:rect(rect),label(label),menuDest(MenuType::ENUM_END),onClick(onClick),hoverEffect(0),selectable(selectable){}
MenuComponent::MenuComponent(geom2d::rect<float>rect,std::string label,MenuType menuDest,MenuFunc onClick)
:rect(rect),label(label),menuDest(menuDest),onClick(onClick),hoverEffect(0){}
MenuComponent::MenuComponent(geom2d::rect<float>rect,std::string label,MenuType menuDest,MenuFunc onClick,bool selectable)
:rect(rect),label(label),menuDest(menuDest),onClick(onClick),hoverEffect(0),selectable(selectable){}
void MenuComponent::Update(Crawler*game){
if(hovered){
@@ -16,7 +16,9 @@ void MenuComponent::Update(Crawler*game){
}
void MenuComponent::Draw(Crawler*game,vf2d parentPos){
game->FillRectDecal(rect.pos+parentPos,rect.size,PixelLerp(VERY_DARK_BLUE,CYAN,hoverEffect));
game->DrawRectDecal(rect.pos+parentPos,rect.size,GREY);
game->FillRectDecal(rect.pos+parentPos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect));
if(border){
game->DrawRectDecal(rect.pos+parentPos,rect.size,GREY);
}
game->DrawStringPropDecal(rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label);
}