Fix overlapping sub-component mouse hover bug, populate blacksmith weapon and armor lists with player's equipment.

This commit is contained in:
2023-12-27 21:03:31 -06:00
parent bd066ee787
commit 3410b5b92b
4 changed files with 41 additions and 35 deletions
+2 -1
View File
@@ -204,7 +204,8 @@ protected:
DrawScrollbar(window,{},focused);
}
virtual bool GetHoverState(Crawler*game,MenuComponent*child)override{
return geom2d::overlaps(geom2d::rect<float>{Menu::menus[parentMenu]->pos+rect.pos+child->rect.pos,child->rect.size},game->GetMousePos());
return geom2d::overlaps(geom2d::rect<float>{Menu::menus[parentMenu]->pos+rect.pos,rect.size},game->GetMousePos())&& //Make sure the mouse is inside the parent window component first....
geom2d::overlaps(geom2d::rect<float>{Menu::menus[parentMenu]->pos+rect.pos+child->rect.pos,child->rect.size},game->GetMousePos());
}
//Calculates the bounds of all components.
inline void CalculateBounds(){