diff --git a/Crawler/Menu.cpp b/Crawler/Menu.cpp index 04ba103d..99c504eb 100644 --- a/Crawler/Menu.cpp +++ b/Crawler/Menu.cpp @@ -276,13 +276,13 @@ void Menu::Draw(Crawler*game){ game->Clear(BLANK); for(auto&component:displayComponents){ if(component->renderInMain){ - component->_Draw(game,{0,0}); + component->_Draw(game); } } for(auto&key:buttons){ for(auto&button:key.second){ if(button->renderInMain){ - button->_Draw(game,{0,0}); + button->_Draw(game); } } } @@ -292,13 +292,13 @@ void Menu::Draw(Crawler*game){ game->DrawDecal(pos,r.Decal()); for(auto&component:displayComponents){ if(component->renderInMain){ - component->_DrawDecal(game,{0,0},this==Menu::stack.back()); + component->_DrawDecal(game,this==Menu::stack.back()); } } for(auto&key:buttons){ for(auto&button:key.second){ if(button->renderInMain){ - button->_DrawDecal(game,{0,0},this==Menu::stack.back()); + button->_DrawDecal(game,this==Menu::stack.back()); } } } diff --git a/Crawler/MenuComponent.cpp b/Crawler/MenuComponent.cpp index 2d97762f..3953c9b4 100644 --- a/Crawler/MenuComponent.cpp +++ b/Crawler/MenuComponent.cpp @@ -45,16 +45,20 @@ void MenuComponent::_Update(Crawler*game){ void MenuComponent::Draw(Crawler*game,vf2d parentPos){ if(background){ - game->FillRect(rect.pos+parentPos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect/"ThemeGlobal.HighlightTime"_F)); + game->FillRect(rect.pos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect/"ThemeGlobal.HighlightTime"_F)); } if(border){ - game->DrawRect(rect.pos+parentPos,rect.size); + game->DrawRect(rect.pos,rect.size); } if(showDefaultLabel){ - game->DrawStringProp(rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label); + game->DrawStringProp(rect.pos+rect.size/2-game->GetTextSizeProp(label)/2,label); } } +void MenuComponent::_Draw(Crawler*game){ + _Draw(game,{0,0}); +} + void MenuComponent::_Draw(Crawler*game,vf2d parentPos){ if(!disabled){ Draw(game,parentPos); @@ -63,6 +67,10 @@ void MenuComponent::_Draw(Crawler*game,vf2d parentPos){ void MenuComponent::DrawDecal(Crawler*game,vf2d parentPos,bool focused){} +void MenuComponent::_DrawDecal(Crawler*game,bool focused){ + _DrawDecal(game,{0,0},focused); +} + void MenuComponent::_DrawDecal(Crawler*game,vf2d parentPos,bool focused){ if(!disabled){ DrawDecal(game,parentPos,focused); diff --git a/Crawler/MenuComponent.h b/Crawler/MenuComponent.h index e778ff63..ba2d58c1 100644 --- a/Crawler/MenuComponent.h +++ b/Crawler/MenuComponent.h @@ -40,7 +40,9 @@ public: MenuComponent(MenuType parent,geom2d::rectrect,std::string label,MenuType menuDest,MenuFunc onClick,bool selectable=true,bool selectableViaKeyboard=true); virtual ~MenuComponent(); void _Update(Crawler*game); + void _Draw(Crawler*game); void _Draw(Crawler*game,vf2d parentPos); + void _DrawDecal(Crawler*game,bool focused); void _DrawDecal(Crawler*game,vf2d parentPos,bool focused); vf2d GetPos(); //We picked up a draggable component, we should make a copy and return it here. If a nullptr is returned here, the pickup is not allowed. diff --git a/Crawler/State_OverworldMap.cpp b/Crawler/State_OverworldMap.cpp index 5bccd0e7..6d0f5ae9 100644 --- a/Crawler/State_OverworldMap.cpp +++ b/Crawler/State_OverworldMap.cpp @@ -38,7 +38,6 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){ for(ConnectionPoint&cp:connections){ if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){ - Menu::OpenMenu(MenuType::INVENTORY); for(int neighborInd:currentConnectionPoint->neighbors){ if(neighborInd==-1)continue; ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd); diff --git a/Crawler/Version.h b/Crawler/Version.h index 80a50198..68abf291 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 2536 +#define VERSION_BUILD 2541 #define stringify(a) stringify_(a) #define stringify_(a) #a