public HandleInput ( |
||
input | ||
return | void |
/// <summary> /// Allows each screen to run logic. /// </summary> public void Update(GameTime gameTime) { // Read the keyboard and gamepad. Input.Update(); ScaledMousePos = new Point(Input.CurrentMouseState.X / Game.DisplayScale, Input.CurrentMouseState.Y / Game.DisplayScale); // Make a copy of the master screen list, to avoid confusion if // the process of updating one screen adds or removes others. screensToUpdate.Clear(); foreach (GameScreen screen in screens) { screensToUpdate.Add(screen); } bool otherScreenHasFocus = !Game.IsActive; bool coveredByOtherScreen = false; // Loop as long as there are screens waiting to be updated. while (screensToUpdate.Count > 0) { // Pop the topmost screen off the waiting list. GameScreen screen = screensToUpdate[screensToUpdate.Count - 1]; screensToUpdate.RemoveAt(screensToUpdate.Count - 1); // Update the screen. screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (screen.ScreenState == ScreenState.TransitionOn || screen.ScreenState == ScreenState.Active) { // If this is the first active screen we came across, // give it a chance to handle input. if (!otherScreenHasFocus) { screen.HandleInput(Input); otherScreenHasFocus = true; } // If this is an active non-popup, inform any subsequent // screens that they are covered by it. if (!screen.IsPopup) { coveredByOtherScreen = true; } } } // Print debug trace? if (traceEnabled) { TraceScreens(); } }
/// <summary> /// Allows each screen to run logic /// </summary> public override void Update(GameTime gameTime) { // Read the keyboard input.Update(); // Make a copy of the master screen list, to avoid confusion if // the process of updating one screen adds or removes others screensToUpdate.Clear(); // Add each screen to update foreach (GameScreen screen in screens) { screensToUpdate.Add(screen); } // Define otherScreenHasFocus as whether or not the game is not active and set coveredByOtherScreens to false bool otherScreenHasFocus = !Game.IsActive; bool coveredByOtherScreen = false; // Loop as long as there are screens waiting to be updated while (screensToUpdate.Count > 0) { // Pop the topmost screen off the waiting list GameScreen screen = screensToUpdate[screensToUpdate.Count - 1]; screensToUpdate.RemoveAt(screensToUpdate.Count - 1); // Update the screen screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); // Check to see if the screen state is transitioning if (screen.ScreenState == ScreenState.TransitionOn || screen.ScreenState == ScreenState.Active) { // If this is the first active screen we came across, // give it a chance to handle input if (!otherScreenHasFocus) { // Set other screen has focus to true screen.HandleInput(input); otherScreenHasFocus = true; } // If this is an active non-popup, inform any subsequent // screens that they are covered by it if (!screen.IsPopup) { coveredByOtherScreen = true; } } } }
/// <summary> /// Allows each screen to run logic. /// </summary> public override void Update(GameTime gameTime) { UpdateTouchPanelSize(); // Read the keyboard and gamepad. if (!SuppressInputUpdate) { _input.Update(gameTime); } SuppressInputUpdate = false; // Make a copy of the master screen list, to avoid confusion if // the process of updating one screen adds or removes others. _tempScreensList.Clear(); foreach (GameScreen screen in _screens) { _tempScreensList.Add(screen); } bool otherScreenHasFocus = !Game.IsActive; bool coveredByOtherScreen = false; // Loop as long as there are screens waiting to be updated. while (_tempScreensList.Count > 0) { // Pop the topmost screen off the waiting list. GameScreen screen = _tempScreensList[_tempScreensList.Count - 1]; _tempScreensList.RemoveAt(_tempScreensList.Count - 1); // Update the screen. screen.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen); if (screen.ScreenState == ScreenState.TransitionOn || screen.ScreenState == ScreenState.Active) { // If this is the first active screen we came across, // give it a chance to handle input. if (!otherScreenHasFocus) { screen.HandleInput(gameTime, _input); otherScreenHasFocus = true; } // If this is an active non-popup, inform any subsequent // screens that they are covered by it. if (!screen.IsPopup) { coveredByOtherScreen = true; } } } ScrollableGame.End(); // Print debug trace? if (_traceEnabled) { TraceScreens(); } }