vooga.engine.state.other
Class Menu

java.lang.Object
  extended by vooga.engine.state.GameState
      extended by vooga.engine.state.other.Menu
Direct Known Subclasses:
GameOver, Pause

public class Menu
extends GameState


Field Summary
 
Fields inherited from class vooga.engine.state.GameState
myRenderField, myUpdateField
 
Constructor Summary
Menu(Game game)
           
Menu(Game game, SpriteGroup displayedgroup)
           
 
Method Summary
 void actOnKeyPressed(int key)
          This method specifies which action to take upon a particular key press.
 void actOnMouseClicked()
          This method specifies which action to take upon mouse click.
 Game getCurrentGame()
          This method returns the current game that the menu belows to
 void initialize()
          The initialize method sets up specific variables and parameters necessary to the specific functioning of the GameState.
 void render(java.awt.Graphics2D g)
          This method displays the menuDisplay.
 void setActive(boolean state)
          This method sets the the current menu to be active or inactive.
 void switchToMenu(Menu menu)
          This method allows the user to set another menu to be active.
 void tagKeyToMenu(int key, Menu menu)
          This method associates a specific key to another menu.
 void tagMouseToMenu(Menu menu)
          This method allows the user to associate the mouse click to a particular menu.
 void update(long elapsedTime)
          This method updates the dynamic sprites and respond to user mouse and keyboard inputs.
 
Methods inherited from class vooga.engine.state.GameState
activate, addGroup, addPlayField, addRenderPlayField, addRenderState, addState, addUpdatePlayField, addUpdateState, deactivate, equals, getGroup, getRenderField, getUpdateField, isActive, removeEverything
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Menu

public Menu(Game game)

Menu

public Menu(Game game,
            SpriteGroup displayedgroup)
Method Detail

actOnMouseClicked

public void actOnMouseClicked()
This method specifies which action to take upon mouse click.


actOnKeyPressed

public void actOnKeyPressed(int key)
This method specifies which action to take upon a particular key press.

Parameters:
key -

tagKeyToMenu

public void tagKeyToMenu(int key,
                         Menu menu)
This method associates a specific key to another menu. Doing so allows the user to switch from menu to menu with key press.

Parameters:
key - (Java key events are integers)
menu - (Another menu the user wants the key to associate with)

tagMouseToMenu

public void tagMouseToMenu(Menu menu)
This method allows the user to associate the mouse click to a particular menu. Doing so allows the user to switch from menu to menu with the mouse click.

Parameters:
menu - (Another menu the user wnats the mouse click to associate with)

switchToMenu

public void switchToMenu(Menu menu)
This method allows the user to set another menu to be active. The design decision here is that the user is only allowed to have one Menu active at one time. Thus, switching to a different menu necessarily sets the current menu to be inactive.

Parameters:
menu -

setActive

public void setActive(boolean state)
This method sets the the current menu to be active or inactive. Initially, inside the constructor, any menu is set to inactive.

Parameters:
state -

getCurrentGame

public Game getCurrentGame()
This method returns the current game that the menu belows to


update

public void update(long elapsedTime)
This method updates the dynamic sprites and respond to user mouse and keyboard inputs.

Overrides:
update in class GameState

render

public void render(java.awt.Graphics2D g)
This method displays the menuDisplay.

Overrides:
render in class GameState
Parameters:
g -

initialize

public void initialize()
Description copied from class: GameState
The initialize method sets up specific variables and parameters necessary to the specific functioning of the GameState. This should include all of the necessary initialization for the GameState's specific use, rather than anything broadly required for all GameStates.

Specified by:
initialize in class GameState