Keyboard/Controller input left direction bugfix. Using setter/getter for mouse navigation to handl storing of position whenever mouse navigation is called.

This commit is contained in:
2023-10-17 01:21:00 -05:00
parent 340690a26b
commit 6656e3d036
4 changed files with 44 additions and 17 deletions
+4 -1
View File
@@ -23,13 +23,13 @@ enum MenuType{
class Menu:IAttributable{
friend class Crawler;
friend class Player;
static bool MOUSE_NAVIGATION;
float buttonHoldTime=0;
std::map<int/*Y*/,std::vector<MenuComponent*>>buttons; //Buttons are stored in rows followed by their column order.
std::map<int/*Y*/,std::vector<MenuComponent*>>keyboardButtons; //Button ordered storage for keyboard/menu
std::vector<MenuComponent*>displayComponents; //Components that are only for displaying purposes.
vi2d selection={-1,-1};
vi2d lastActiveMousePos={};
MenuComponent*draggingComponent=nullptr;
Renderable r,overlay;
@@ -52,6 +52,8 @@ public:
vf2d size; //Size in tiles (24x24), every menu will be tile-based
static Theme&GetCurrentTheme();
bool UsingMouseNavigation();
void SetMouseNavigation(bool mouseNavigation);
private:
Menu(vf2d pos,vf2d size);
@@ -76,6 +78,7 @@ private:
bool HandleOutsideDisabledButtonSelection(MenuComponent*disabledButton);
Pixel GetRenderColor();
static bool MOUSE_NAVIGATION;
};
struct MenuFuncData{