I'm thinking about making a
StateManager for my game. I want to know how to design it; that is, how to use a stack to push and pop states onto, and draw them to the screen.
For example, should each
State be a
JPanel? I want to make a
Menu, preferably using
JButtons if possible. I don't want to add them directly to the main panel because I don't want to have to constantly add and remove those buttons. Also, not all my states are going to be drawable, since I might have a state that contains a MouseListener to detect clicks.
Right now, I have an empty
State class. My
Menu class extends from that. My state stack is of the type State. Another design question: if in my
Menu I click the "Play" button, should I just say something like
StateManager.push(new PlayState()) from the