Improve keyboard/controller-based menu navigation by separating each row into its own structure.

This commit is contained in:
2023-10-01 01:11:53 -05:00
parent 03f2738ead
commit 60e46a83f2
4 changed files with 146 additions and 43 deletions
+5 -2
View File
@@ -10,8 +10,9 @@ class Menu{
friend class Player;
static bool MOUSE_NAVIGATION;
static std::map<MenuType,Menu>menus;
std::vector<MenuButton>buttons;
int selection=-1;
std::map<int/*Y*/,std::vector<MenuButton>>buttons; //Buttons are stored in rows followed by their column order.
vi2d selection={-1,-1};
vf2d size; //Size in tiles (24x24), every menu will be tile-based
public:
Menu();
@@ -26,5 +27,7 @@ private:
void MenuSelect(Crawler*game);
static const Menu InitializeTestMenu();
static const Menu InitializeTestSubMenu();
void KeyboardButtonNavigation(Crawler*game);
};