|
|
|
@ -8,7 +8,7 @@ protected: |
|
|
|
|
Renderable r; |
|
|
|
|
std::vector<MenuComponent*>components; |
|
|
|
|
vf2d scrollOffset{}; |
|
|
|
|
geom2d::rect<float>bounds; |
|
|
|
|
geom2d::rect<float>bounds; //It's for the scrollbar.
|
|
|
|
|
private: |
|
|
|
|
inline bool OnScreen(MenuComponent*component){ |
|
|
|
|
return geom2d::overlaps(rect,geom2d::rect<float>{component->rect.pos+scrollOffset,component->rect.size}); |
|
|
|
@ -24,9 +24,9 @@ protected: |
|
|
|
|
|
|
|
|
|
if(game->GetMouseWheel()!=0){ |
|
|
|
|
if(game->GetMouseWheel()>0){ |
|
|
|
|
scrollOffset.y-=4; |
|
|
|
|
scrollOffset.y+="ThemeGlobal.MenuScrollWheelSpeed"_I; |
|
|
|
|
}else{ |
|
|
|
|
scrollOffset.y+=4; |
|
|
|
|
scrollOffset.y-="ThemeGlobal.MenuScrollWheelSpeed"_I; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -83,4 +83,7 @@ public: |
|
|
|
|
|
|
|
|
|
parentMenu->AddComponent(key,button); |
|
|
|
|
} |
|
|
|
|
virtual inline bool PointWithinParent(MenuComponent*child,vi2d drawPos)override{ |
|
|
|
|
return geom2d::overlaps(geom2d::rect<float>{Menu::menus[parentMenu]->pos+rect.pos,rect.size},drawPos); |
|
|
|
|
} |
|
|
|
|
}; |