C# Class NScumm.MonoGame.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.
This public class is similar to one in the GameStateManagement sample.
Inheritance: Microsoft.Xna.Framework.DrawableGameComponent
显示文件 Open project: scemino/nscumm Class Usage Examples

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.

DrawRectangle ( Rectangle rectangle, Color color, BlendState blendState = null ) : void

Draw an empty rectangle of the given size and color.

EndRun ( ) : void
FadeBackBufferToBlack ( int alpha ) : void

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

GetScreens ( ) : NScumm.MonoGame.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.

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 ( Microsoft.Xna.Framework.Game game ) : System

Constructs a new screen manager component.

Update ( GameTime gameTime ) : void

Allows each screen to run logic.

Protected Methods

Method Description
LoadContent ( ) : void

Load your graphics content.

UnloadContent ( ) : void

Unload your graphics content.

Private Methods

Method Description
TraceScreens ( ) : void

Prints a list of all the screens, for debugging.

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

DrawRectangle() public method

Draw an empty rectangle of the given size and color.
public DrawRectangle ( Rectangle rectangle, Color color, BlendState blendState = null ) : void
rectangle Microsoft.Xna.Framework.Rectangle The destination rectangle.
color Color The color of the rectangle.
blendState Microsoft.Xna.Framework.Graphics.BlendState The blending to use.
return void

EndRun() public method

public EndRun ( ) : void
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 ( int alpha ) : void
alpha int
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 ( ) : NScumm.MonoGame.GameScreen[]
return NScumm.MonoGame.GameScreen[]

LoadContent() protected method

Load your graphics content.
protected 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 ( Microsoft.Xna.Framework.Game game ) : System
game Microsoft.Xna.Framework.Game
return System

UnloadContent() protected method

Unload your graphics content.
protected 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