A screen is a single layer that has update and draw logic, and which can be combined with other layers to build up a complex menu system. For instance the main menu, the options menu, the "are you sure you want to quit" message box, and the main game itself are all implemented as screens. More...
Public Member Functions | |
| virtual void | LoadContent () |
| Load graphics content for the screen. | |
| virtual void | UnloadContent () |
| Unload content for the screen. | |
| virtual void | Update (GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) |
| Allows the screen to run logic, such as updating the transition position. Unlike HandleInput, this method is called regardless of whether the screen is active, hidden, or in the middle of a transition. | |
| virtual void | HandleInput (InputState input) |
| Allows the screen to handle user input. Unlike Update, this method is only called when the screen is active, and not when some other screen has taken the focus. | |
| virtual void | Draw (GameTime gameTime) |
| This is called when the screen should draw itself. | |
| void | ExitScreen () |
| Tells the screen to go away. Unlike ScreenManager.RemoveScreen, which instantly kills the screen, this method respects the transition timings and will give the screen a chance to gradually transition off. | |
Properties | |
| bool | IsPopup [get, set] |
| Gets or sets the IsPopup flag. Normally when one screen is brought up over the top of another, the first screen will transition off to make room for the new one. This property indicates whether the screen is only a small popup, in which case screens underneath it do not need to bother transitioning off. | |
| TimeSpan | TransitionOnTime [get, set] |
| Gets or sets the timespan which indicates how long the screen takes to transition on when it is activated. | |
| TimeSpan | TransitionOffTime [get, set] |
| Gets or sets the timespan which indicates how long the screen takes to transition off when it is deactivated. | |
| float | TransitionPosition [get, set] |
| Gets or sets the current position of the screen transition, ranging from zero (fully active, no transition) to one (transitioned fully off to nothing). | |
| byte | TransitionAlpha [get] |
| Gets the current alpha of the screen transition, ranging from 255 (fully active, no transition) to 0 (transitioned fully off to nothing). | |
| ScreenState | ScreenState [get, set] |
| Gets or sets the current screen transition state. | |
| bool | IsExiting [get, set] |
| Gets or sets a property indicates whether the screen is exiting for real: if set, the screen will automatically remove itself as soon as the transition finishes. There are two possible reasons why a screen might be transitioning off. It could be temporarily going away to make room for another screen that is on top of it, or it could be going away for good. | |
| bool | IsActive [get] |
| Checks whether this screen is active and can respond to user input. | |
| ScreenManager | ScreenManager [get, set] |
| Gets the manager that this screen belongs to. | |
| PlayerIndex | ControllingPlayer [get, set] |
| Gets the index of the player who is currently controlling this screen, or null if it is accepting input from any player. This is used to lock the game to a specific player profile. The main menu responds to input from any connected gamepad, but whichever player makes a selection from this menu is given control over all subsequent screens, so other gamepads are inactive until the controlling player returns to the main menu. | |
A screen is a single layer that has update and draw logic, and which can be combined with other layers to build up a complex menu system. For instance the main menu, the options menu, the "are you sure you want to quit" message box, and the main game itself are all implemented as screens.
Definition at line 44 of file GameScreen.cs.
| virtual void NewGamePhysics.StateManager.GameScreen.Draw | ( | GameTime | gameTime | ) | [virtual] |
This is called when the screen should draw itself.
Reimplemented in GravityChooser.GravityChooserBackgroundScreen, GravityChooser.GravityChooserGameplayScreen, GravityChooser.GravityChooserHelpScreen, GravityChooser.GravityChooserLoadingScreen, GravityChooser.GravityChooserMainMenuScreen, GravityChooser.GravityChooserMessageBoxScreen, GravityChooser.GravityChooserOptionsMenuScreen, GravityChooser.GravityChooserPauseMenuScreen, MontyHallGame.MontyHallBackgroundScreen, MontyHallGame.MontyHallGameOverScreen, MontyHallGame.MontyHallGameplayScreen, MontyHallGame.MontyHallHelpScreen, MontyHallGame.MontyHallLoadingScreen, MontyHallGame.MontyHallMainMenuScreen, MontyHallGame.MontyHallMessageBoxScreen, MontyHallGame.MontyHallOptionsMenuScreen, MontyHallGame.MontyHallPauseMenuScreen, NewGamePhysics.StateManager.MenuScreen, PendulumGame.PendulumBackgroundScreen, PendulumGame.PendulumGameOverScreen, PendulumGame.PendulumGameplayScreen, PendulumGame.PendulumGravityChooserScreen, PendulumGame.PendulumHelpScreen, PendulumGame.PendulumLoadingScreen, PendulumGame.PendulumMessageBoxScreen, PendulumGame.PendulumOptionsMenuScreen, PendulumGame.PendulumPauseMenuScreen, and PendulumGame.PendulumVideoScreen.
Definition at line 327 of file GameScreen.cs.
| void NewGamePhysics.StateManager.GameScreen.ExitScreen | ( | ) |
Tells the screen to go away. Unlike ScreenManager.RemoveScreen, which instantly kills the screen, this method respects the transition timings and will give the screen a chance to gradually transition off.
Definition at line 338 of file GameScreen.cs.
00339 { 00340 if (TransitionOffTime == TimeSpan.Zero) 00341 { 00342 // If the screen has a zero transition time, remove it immediately. 00343 ScreenManager.RemoveScreen(this); 00344 } 00345 else 00346 { 00347 // Otherwise flag that it should transition off and then exit. 00348 isExiting = true; 00349 } 00350 }
| virtual void NewGamePhysics.StateManager.GameScreen.HandleInput | ( | InputState | input | ) | [virtual] |
Allows the screen to handle user input. Unlike Update, this method is only called when the screen is active, and not when some other screen has taken the focus.
Reimplemented in GravityChooser.GravityChooserGameplayScreen, GravityChooser.GravityChooserHelpScreen, GravityChooser.GravityChooserMessageBoxScreen, MontyHallGame.MontyHallGameplayScreen, MontyHallGame.MontyHallHelpScreen, MontyHallGame.MontyHallMessageBoxScreen, NewGamePhysics.StateManager.MenuScreen, PendulumGame.PendulumGameplayScreen, PendulumGame.PendulumGravityChooserScreen, PendulumGame.PendulumHelpScreen, PendulumGame.PendulumMessageBoxScreen, and PendulumGame.PendulumVideoScreen.
Definition at line 322 of file GameScreen.cs.
| virtual void NewGamePhysics.StateManager.GameScreen.LoadContent | ( | ) | [virtual] |
Load graphics content for the screen.
Reimplemented in GravityChooser.GravityChooserBackgroundScreen, GravityChooser.GravityChooserGameplayScreen, GravityChooser.GravityChooserHelpScreen, GravityChooser.GravityChooserMainMenuScreen, GravityChooser.GravityChooserMessageBoxScreen, GravityChooser.GravityChooserOptionsMenuScreen, MontyHallGame.MontyHallBackgroundScreen, MontyHallGame.MontyHallGameplayScreen, MontyHallGame.MontyHallHelpScreen, MontyHallGame.MontyHallMainMenuScreen, MontyHallGame.MontyHallMessageBoxScreen, MontyHallGame.MontyHallOptionsMenuScreen, PendulumGame.PendulumBackgroundScreen, PendulumGame.PendulumGameOverScreen, PendulumGame.PendulumGameplayScreen, PendulumGame.PendulumGravityChooserScreen, PendulumGame.PendulumHelpScreen, PendulumGame.PendulumLoadingScreen, PendulumGame.PendulumMessageBoxScreen, PendulumGame.PendulumOptionsMenuScreen, and PendulumGame.PendulumVideoScreen.
Definition at line 222 of file GameScreen.cs.
| virtual void NewGamePhysics.StateManager.GameScreen.UnloadContent | ( | ) | [virtual] |
Unload content for the screen.
Reimplemented in GravityChooser.GravityChooserBackgroundScreen, GravityChooser.GravityChooserGameplayScreen, GravityChooser.GravityChooserHelpScreen, MontyHallGame.MontyHallBackgroundScreen, MontyHallGame.MontyHallGameplayScreen, MontyHallGame.MontyHallHelpScreen, PendulumGame.PendulumBackgroundScreen, PendulumGame.PendulumGameOverScreen, PendulumGame.PendulumGameplayScreen, PendulumGame.PendulumGravityChooserScreen, PendulumGame.PendulumHelpScreen, PendulumGame.PendulumLoadingScreen, PendulumGame.PendulumOptionsMenuScreen, and PendulumGame.PendulumVideoScreen.
Definition at line 227 of file GameScreen.cs.
| virtual void NewGamePhysics.StateManager.GameScreen.Update | ( | GameTime | gameTime, | |
| bool | otherScreenHasFocus, | |||
| bool | coveredByOtherScreen | |||
| ) | [virtual] |
Allows the screen to run logic, such as updating the transition position. Unlike HandleInput, this method is called regardless of whether the screen is active, hidden, or in the middle of a transition.
Reimplemented in GravityChooser.GravityChooserBackgroundScreen, GravityChooser.GravityChooserGameplayScreen, GravityChooser.GravityChooserHelpScreen, GravityChooser.GravityChooserLoadingScreen, GravityChooser.GravityChooserMainMenuScreen, GravityChooser.GravityChooserOptionsMenuScreen, MontyHallGame.MontyHallBackgroundScreen, MontyHallGame.MontyHallGameplayScreen, MontyHallGame.MontyHallHelpScreen, MontyHallGame.MontyHallLoadingScreen, MontyHallGame.MontyHallMainMenuScreen, MontyHallGame.MontyHallOptionsMenuScreen, NewGamePhysics.StateManager.MenuScreen, PendulumGame.PendulumBackgroundScreen, PendulumGame.PendulumGameOverScreen, PendulumGame.PendulumGameplayScreen, PendulumGame.PendulumGravityChooserScreen, PendulumGame.PendulumHelpScreen, PendulumGame.PendulumLoadingScreen, PendulumGame.PendulumOptionsMenuScreen, and PendulumGame.PendulumVideoScreen.
Definition at line 238 of file GameScreen.cs.
00240 { 00241 this.otherScreenHasFocus = otherScreenHasFocus; 00242 00243 if (isExiting) 00244 { 00245 // If the screen is going away to die, it should transition off. 00246 screenState = ScreenState.TransitionOff; 00247 00248 if (!UpdateTransition(gameTime, transitionOffTime, 1)) 00249 { 00250 // When the transition finishes, remove the screen. 00251 ScreenManager.RemoveScreen(this); 00252 } 00253 } 00254 else if (coveredByOtherScreen) 00255 { 00256 // If the screen is covered by another, it should transition off. 00257 if (UpdateTransition(gameTime, transitionOffTime, 1)) 00258 { 00259 // Still busy transitioning. 00260 screenState = ScreenState.TransitionOff; 00261 } 00262 else 00263 { 00264 // Transition finished! 00265 screenState = ScreenState.Hidden; 00266 } 00267 } 00268 else 00269 { 00270 // Otherwise the screen should transition on and become active. 00271 if (UpdateTransition(gameTime, transitionOnTime, -1)) 00272 { 00273 // Still busy transitioning. 00274 screenState = ScreenState.TransitionOn; 00275 } 00276 else 00277 { 00278 // Transition finished! 00279 screenState = ScreenState.Active; 00280 } 00281 } 00282 }
PlayerIndex NewGamePhysics.StateManager.GameScreen.ControllingPlayer [get, set] |
Gets the index of the player who is currently controlling this screen, or null if it is accepting input from any player. This is used to lock the game to a specific player profile. The main menu responds to input from any connected gamepad, but whichever player makes a selection from this menu is given control over all subsequent screens, so other gamepads are inactive until the controlling player returns to the main menu.
Definition at line 210 of file GameScreen.cs.
bool NewGamePhysics.StateManager.GameScreen.IsActive [get] |
Checks whether this screen is active and can respond to user input.
Definition at line 183 of file GameScreen.cs.
bool NewGamePhysics.StateManager.GameScreen.IsExiting [get, set] |
Gets or sets a property indicates whether the screen is exiting for real: if set, the screen will automatically remove itself as soon as the transition finishes. There are two possible reasons why a screen might be transitioning off. It could be temporarily going away to make room for another screen that is on top of it, or it could be going away for good.
Definition at line 174 of file GameScreen.cs.
bool NewGamePhysics.StateManager.GameScreen.IsPopup [get, set] |
Gets or sets the IsPopup flag. Normally when one screen is brought up over the top of another, the first screen will transition off to make room for the new one. This property indicates whether the screen is only a small popup, in which case screens underneath it do not need to bother transitioning off.
Definition at line 108 of file GameScreen.cs.
ScreenManager NewGamePhysics.StateManager.GameScreen.ScreenManager [get, set] |
Gets the manager that this screen belongs to.
Definition at line 196 of file GameScreen.cs.
ScreenState NewGamePhysics.StateManager.GameScreen.ScreenState [get, set] |
Gets or sets the current screen transition state.
Definition at line 160 of file GameScreen.cs.
byte NewGamePhysics.StateManager.GameScreen.TransitionAlpha [get] |
Gets the current alpha of the screen transition, ranging from 255 (fully active, no transition) to 0 (transitioned fully off to nothing).
Definition at line 152 of file GameScreen.cs.
TimeSpan NewGamePhysics.StateManager.GameScreen.TransitionOffTime [get, set] |
Gets or sets the timespan which indicates how long the screen takes to transition off when it is deactivated.
Definition at line 130 of file GameScreen.cs.
TimeSpan NewGamePhysics.StateManager.GameScreen.TransitionOnTime [get, set] |
Gets or sets the timespan which indicates how long the screen takes to transition on when it is activated.
Definition at line 119 of file GameScreen.cs.
float NewGamePhysics.StateManager.GameScreen.TransitionPosition [get, set] |
Gets or sets the current position of the screen transition, ranging from zero (fully active, no transition) to one (transitioned fully off to nothing).
Definition at line 141 of file GameScreen.cs.
1.6.2