/// <summary> /// Immediately pauses the current top screen, pushes a different /// screen on top of it and resumes the new top screen. /// </summary> /// <param name="screen">Screen to add.</param> /// <param name="gameTime">Time at which the screen was pushed.</param> private void PushScreen( GameScreen screen, GameTime gameTime ) { TopScreen?.Pause( gameTime ); screen.Initialize(); screen.ScreenManager = this; mScreens.Push( screen ); screen.Resume( gameTime ); }
/// <summary> /// Adds a screen to the top of the screen manager on the next call to update. /// </summary> /// <param name="screen">Screen to add.</param> public void PushScreen( GameScreen screen ) { if ( screen == null ) throw new ArgumentNullException( nameof( screen ) ); mPendingScreens.Add( screen ); }