C# Class FarseerPhysics.Samples.ScreenSystem.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
Datei anzeigen Open project: tinco/Farseer-Physics Class Usage Examples

Public Methods

Method Description
AddMenuItem ( PhysicsDemoScreen screen, Microsoft.Xna.Framework.Graphics.Texture2D preview ) : void
AddMenuItem ( string name, EntryType type, GameScreen screen ) : void
Draw ( GameTime gameTime ) : void

Draws the menu.

HandleInput ( InputHelper input, GameTime gameTime ) : void

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

LoadContent ( ) : void
MenuScreen ( ) : System

Constructor.

MenuScreen ( string menuTitle ) : System

Constructor.

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

Updates the menu.

Protected Methods

Method Description
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.

Private Methods

Method Description
GetMenuEntryAt ( Vector2 position ) : int

Returns the index of the menu entry at the position of the given mouse state.

GetPreviewCollision ( Vector2 position ) : bool
GetSliderCollision ( Vector2 position ) : bool
UpdateMenuPositions ( ) : void

Method Details

AddMenuItem() public method

public AddMenuItem ( PhysicsDemoScreen screen, Microsoft.Xna.Framework.Graphics.Texture2D preview ) : void
screen PhysicsDemoScreen
preview Microsoft.Xna.Framework.Graphics.Texture2D
return void

AddMenuItem() public method

public AddMenuItem ( string name, EntryType type, GameScreen screen ) : void
name string
type EntryType
screen GameScreen
return void

Draw() public method

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

HandleInput() public method

Responds to user input, changing the selected entry and accepting or cancelling the menu.
public HandleInput ( InputHelper input, GameTime gameTime ) : void
input InputHelper
gameTime Microsoft.Xna.Framework.GameTime
return void

LoadContent() public method

public LoadContent ( ) : void
return void

MenuScreen() public method

Constructor.
public MenuScreen ( ) : System
return System

MenuScreen() public method

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

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