Im doing a simple game with a simple UI, but I have found problems when handling numerous exclusive menus.
For example, I have Inventory, Settings, Stats menus that the player can go to from the game screen, BUT i do not want to go from menu to menu (I do not want to open the Settings menu from the Inventory, for example).
This sounds like a 101 issue for GUI programming.
I was thinking on putting the "open" input handling on the player, so when it gets paused, the possibility of opening the rest of the menus is automatically discarded (then each menu handles their own "closing"); but im not exactly comfortable mixing gameplay + UI input handling.
I think this can be a good solution for short term, but Im afraid it can escalate poorly.
#How to handle numerous exclusive menus
1 messages · Page 1 of 1 (latest)
How is Settings being opened from Inventory? Hotkey or are the buttons for them always visible?
You can make a variable that holds whether any exclusive menu is open. Then check it before opening an exclusive menu. Either a global variable each menu can check, or if the opening code is in one place, a member variable for that.
I think each setting menu should handle itself: when told to open, it opens; when told to close, it closes. But there's someone else who's coordinating their activity, the maitre d' (, hands out menus...), who figures out which menu is appropriate (and so stores the name of the target menu and sends out openings and closings). So the controls/player/whatever never open the menu directly, they ask the maitre d' to open the specific menu, and that component tracks state & handles all the just-one-menu work.