   Multiple levels of interface... how?
  I am trying to figure out how to handle an 'active window' situation.Say for example, if your user is on the Main Menu, and they press escape, it will exit the game.Now say they are on the main menu, and then click 'delete character'.  Now a pop up window appears 'are you sure?'.  Now if the user presses 'escape', rather than exiting the game, it will just cancel the character deletion.This is just a simple example, but say you have 3 or more of these windows, or confirmations, etc on top of each other.What is a common way to manage this?  How do I set, change, revert the current window the keyboard is functioning with?EDIT:One thing I am thinking of, is having a variable 'activeWindow', and then when I open a new dialog, I store 'oldActive = activeWindow'.  Then set 'activeWindow = this'.Now for my onKeyChange event function, I just call 'gameState.activeWindow.keyChange(e)'.Then when the top most dialog is closed, it sets 'activeWindow = oldActive'.Is this a good idea?   
Quote:Original post by BUnzagaI am trying to figure out how to handle an 'active window' situation.Say for example, if your user is on the Main Menu, and they press escape, it will exit the game.Now say they are on the main menu, and then click 'delete character'.  Now a pop up window appears 'are you sure?'.  Now if the user presses 'escape', rather than exiting the game, it will just cancel the character deletion.This is just a simple example, but say you have 3 or more of these windows, or confirmations, etc on top of each other.What is a common way to manage this?  How do I set, change, revert the current window the keyboard is functioning with?EDIT:One thing I am thinking of, is having a variable 'activeWindow', and then when I open a new dialog, I store 'oldActive = activeWindow'.  Then set 'activeWindow = this'.Now for my onKeyChange event function, I just call 'gameState.activeWindow.keyChange(e)'.Then when the top most dialog is closed, it sets 'activeWindow = oldActive'.Is this a good idea?You want to route input events only to the currently active window (except say, for input events that should have the same effect everywhere, like ALT-F4), and maintaining a reference to the currently active window is a good way of doing this. (I'm assuming you've built your own UI? If not, your UI library probably handles this on its own...) For windows applications, unless you're pressing system keys (CTRL+ALT+DEL or CTRL+ESC etc.) the active window (the window which has focus) will automatically receive the input events, but the system keys get routed to the operating system. If using a library that gives you immediate access to the input, things are a little bit different and you have to manage it yourself.You might want to look into a Finite State Machine for dealing with in-game menus; or perhaps you have already :-)   