C# Class GameStateManagement.MenuScreen

Base class for screens that contain a menu of options. The user can move up and down to select an entry, or cancel to back out of the screen.
Inheritance: GameScreen
显示文件 Open project: GarethIW/LDEngine Class Usage Examples

Public Methods

Method Description
Draw ( GameTime gameTime ) : void

Draws the menu.

HandleInput ( InputState input ) : void

Responds to user input, changing the selected entry and accepting or cancelling the menu.

LoadContent ( ) : void
MenuScreen ( string menuTitle ) : System

Constructor.

UnloadContent ( ) : void
Update ( GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen ) : void

Updates the menu.

Protected Methods

Method Description
GetMenuEntryHitBounds ( MenuEntry entry ) : Rectangle

Allows the screen to create the hit bounds for a particular menu entry.

OnCancel ( object sender, EventArgs e ) : void

Handler for when the user has cancelled the menu.

OnSelectEntry ( int entryIndex ) : void

Handler for when the user has chosen a menu entry.

UpdateMenuEntryLocations ( ) : void

Allows the screen the chance to position the menu entries. By default all menu entries are lined up in a vertical list, centered on the screen.

Method Details

Draw() public method

Draws the menu.
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

GetMenuEntryHitBounds() protected method

Allows the screen to create the hit bounds for a particular menu entry.
protected GetMenuEntryHitBounds ( MenuEntry entry ) : Rectangle
entry MenuEntry
return Microsoft.Xna.Framework.Rectangle

HandleInput() public method

Responds to user input, changing the selected entry and accepting or cancelling the menu.
public HandleInput ( InputState input ) : void
input InputState
return void

LoadContent() public method

public LoadContent ( ) : void
return void

MenuScreen() public method

Constructor.
public MenuScreen ( string menuTitle ) : System
menuTitle string
return System

OnCancel() protected method

Handler for when the user has cancelled the menu.
protected OnCancel ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

OnSelectEntry() protected method

Handler for when the user has chosen a menu entry.
protected OnSelectEntry ( int entryIndex ) : void
entryIndex int
return void

UnloadContent() public method

public UnloadContent ( ) : void
return void

Update() public method

Updates the menu.
public Update ( GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen ) : void
gameTime Microsoft.Xna.Framework.GameTime
otherScreenHasFocus bool
coveredByOtherScreen bool
return void

UpdateMenuEntryLocations() protected method

Allows the screen the chance to position the menu entries. By default all menu entries are lined up in a vertical list, centered on the screen.
protected UpdateMenuEntryLocations ( ) : void
return void