C# Class GameStateManagement.ScreenManager

The screen manager is a component which manages one or more GameScreen instances. It maintains a stack of screens, calls their Update and Draw methods at the appropriate times, and automatically routes input to the topmost active screen.
ファイルを表示 Open project: GarethIW/LDEngine Class Usage Examples

Public Properties

Property Type Description
Game LDEngine.Game
Input InputState
ScaledMousePos Point
blankTexture Texture2D

Public Methods

Method Description
AddScreen ( GameScreen screen ) : void

Adds a new screen to the screen manager.

Draw ( GameTime gameTime ) : void

Tells each screen to draw itself.

FadeBackBufferToBlack ( float alpha ) : void

Helper draws a translucent black fullscreen sprite, used for fading screens in and out, and for darkening the background behind popups.

GetScreens ( ) : GameStateManagement.GameScreen[]

Expose an array holding all the screens. We return a copy rather than the real master list, because screens should only ever be added or removed using the AddScreen and RemoveScreen methods.

Initialize ( ) : void

Initializes the screen manager component.

LoadContent ( ) : void

Load your graphics content.

RemoveScreen ( GameScreen screen ) : void

Removes a screen from the screen manager. You should normally use GameScreen.ExitScreen instead of calling this directly, so the screen can gradually transition off rather than just being instantly removed.

ScreenManager ( LDEngine game ) : System

Constructs a new screen manager component.

TraceScreens ( ) : void

Prints a list of all the screens, for debugging.

UnloadContent ( ) : void

Unload your graphics content.

Update ( GameTime gameTime ) : void

Allows each screen to run logic.

Private Methods

Method Description
CloseAllScreens ( ) : void
CloseScreen ( Type type ) : void

Method Details

AddScreen() public method

Adds a new screen to the screen manager.
public AddScreen ( GameScreen screen ) : void
screen GameScreen
return void

Draw() public method

Tells each screen to draw itself.
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

FadeBackBufferToBlack() public method

Helper draws a translucent black fullscreen sprite, used for fading screens in and out, and for darkening the background behind popups.
public FadeBackBufferToBlack ( float alpha ) : void
alpha float
return void

GetScreens() public method

Expose an array holding all the screens. We return a copy rather than the real master list, because screens should only ever be added or removed using the AddScreen and RemoveScreen methods.
public GetScreens ( ) : GameStateManagement.GameScreen[]
return GameStateManagement.GameScreen[]

Initialize() public method

Initializes the screen manager component.
public Initialize ( ) : void
return void

LoadContent() public method

Load your graphics content.
public LoadContent ( ) : void
return void

RemoveScreen() public method

Removes a screen from the screen manager. You should normally use GameScreen.ExitScreen instead of calling this directly, so the screen can gradually transition off rather than just being instantly removed.
public RemoveScreen ( GameScreen screen ) : void
screen GameScreen
return void

ScreenManager() public method

Constructs a new screen manager component.
public ScreenManager ( LDEngine game ) : System
game LDEngine
return System

TraceScreens() public method

Prints a list of all the screens, for debugging.
public TraceScreens ( ) : void
return void

UnloadContent() public method

Unload your graphics content.
public UnloadContent ( ) : void
return void

Update() public method

Allows each screen to run logic.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

Property Details

Game public_oe property

public LDEngine.Game Game
return LDEngine.Game

Input public_oe property

public InputState,GameStateManagement Input
return InputState

ScaledMousePos public_oe property

public Point ScaledMousePos
return Point

blankTexture public_oe property

public Texture2D blankTexture
return Texture2D