} // end of Update() private bool UpdateNonMenuItems() { bool inputHandled = false; // Check for click on signOut tile or url. if (MouseInput.Left.WasPressed || Actions.Select.WasPressed || TouchInput.WasTouched || TouchInput.WasLastReleased) { TouchContact touch = TouchInput.GetOldestTouch(); Vector2 touchHit = new Vector2(-1, -1); // touch off screen if no touch was found // url is in rt coords. if (touch != null) { touchHit = ScreenWarp.ScreenToRT(touch.position); } Vector2 mouseHit = MouseInput.GetMouseInRtCoords(); if (shared.urlBox.Contains(mouseHit) || (shared.urlBox.Contains(touchHit) && TouchInput.WasLastReleased)) { #if NETFX_CORE Launcher.LaunchUriAsync(new Uri(KoduGameLabUrl)); #else Process.Start(KoduGameLabUrl); #endif MouseInput.Left.ClearAllWasPressedState(); inputHandled = true; } } return(inputHandled); }
} // end of Update() private bool UpdateNonMenuItems() { bool inputHandled = false; // Check for click on signOut tile or url. if (MouseInput.Left.WasPressed || Actions.Select.WasPressed || TouchInput.WasTouched || TouchInput.WasLastReleased) { TouchContact touch = TouchInput.GetOldestTouch(); Vector2 touchHit = new Vector2(-1, -1); // touch off screen if no touch was found // url is in rt coords. if (touch != null) { touchHit = ScreenWarp.ScreenToRT(touch.position); } Vector2 mouseHit = MouseInput.GetMouseInRtCoords(); if (shared.urlBox.Contains(mouseHit) || (shared.urlBox.Contains(touchHit) && TouchInput.WasLastReleased)) { #if NETFX_CORE Launcher.LaunchUriAsync(new Uri(KoduGameLabUrl)); #else Process.Start(KoduGameLabUrl); #endif MouseInput.Left.ClearAllWasPressedState(); inputHandled = true; } //check for touch over scroll window (doesn't need to be released) if (!inputHandled && GamePadInput.ActiveMode == GamePadInput.InputMode.Touch) { if (TouchInput.WasTouched && touch != null && shared.liveFeed.IsInScrollwindow(touch.position)) { //touch in window? if so, activate the live feed shared.liveFeed.Activate(); inputHandled = true; } else { //deactivate the feed and don't consider the input handled shared.liveFeed.Deactivate(); } } } else if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse) { Vector2 pureMouseHit = new Vector2(MouseInput.Position.X, MouseInput.Position.Y); // mouseHit = new Vector2(MouseInput.Position.X, MouseInput.Position.Y); if (shared.liveFeed.IsInScrollwindow(pureMouseHit)) // mouseHit)) { shared.liveFeed.Activate(); } } return(inputHandled); }
} // end of c'tor public void Update() { if (active) { // // Input? // // Touch. for (int i = 0; i < TouchInput.TouchCount; i++) { TouchContact touch = TouchInput.GetTouchContactByIndex(i); Vector2 touchHit = ScreenWarp.ScreenToRT(touch.position); HandleTouchInput(touch, touchHit); } // Mouse. Note, we explicitely look for mouse mode here so that // mouse hover doesn't change the focus level when changing it via // keyboard or gamepad. if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse) { Vector2 mouseHit = MouseInput.GetMouseInRtCoords(); HandleMouseInput(mouseHit); } // Keyboard. // Arrows are handled via Actions in HandleGamePadInput(). if (KeyboardInput.WasPressed(Keys.Escape)) { OnCancel(); } if (KeyboardInput.WasPressed(Keys.Enter)) { OnSelect(); } // Gamepad. HandleGamepadInput(); // Set frame color to indicate focus. for (int i = 0; i < levels.Count; i++) { if (focusLevelIndex == i) { levels[i].FrameColor = new Color(0, 255, 13); } else { levels[i].FrameColor = Color.Transparent; } } } // end if active. } // end of Update()
// end of HandleMouseInput() private void HandleTouchInput() { //if (TouchInput.TouchCount == 0) { return; } // nothing to see here. //TouchContact touch = TouchInput.GetOldestTouch(); //Vector2 touchHit = TouchInput.GetAspectRatioAdjustedPosition( // touch.position, // camera, // true //); if (TouchInput.TouchCount == 0) { return; } // nothing to see here. TouchContact touch = TouchInput.GetOldestTouch(); Vector2 touchHit = ScreenWarp.ScreenToRT(touch.position); if (TouchGestureManager.Get().TapGesture.WasTapped()) { if (okButton.Box.Contains(touchHit)) { Accept(); } if (cancelButton.Box.Contains(touchHit)) { Cancel(); } if (textBox.Contains(touchHit)) { KeyboardInput.ShowOnScreenKeyboard(); } } } // end of HandleTouchInput()
} // end of c'tor public void Update(Camera camera) { if (Active) { GamePadInput pad = GamePadInput.GetGamePad0(); if (Actions.Select.WasPressed) { Actions.Select.ClearAllWasPressedState(); // Disable this hint for this session. if (curHint.ShowOnce) { curHint.Disabled = true; } Deactivate(); } if (Actions.X.WasPressed) { Actions.X.ClearAllWasPressedState(); // Disable this hint until reset by user. XmlOptionsData.SetHintAsDisabled(curHint.ID); // Disable this hint for this session. if (curHint.ShowOnce) { curHint.Disabled = true; } Deactivate(); } // We need to be able to slip out to the mini-hub here since // continuous, repeated calls to ScrollableModalHint can lock the // user out of control. if (Actions.MiniHub.WasPressed) { Actions.MiniHub.ClearAllWasPressedState(); Deactivate(); InGame.inGame.SwitchToMiniHub(); } // We need to be able to slip out to the tool menu here since // continuous, repeated calls to ScrollableModalHint can lock the // user out of control. if (Actions.ToolMenu.WasPressed) { Actions.ToolMenu.ClearAllWasPressedState(); Deactivate(); if (InGame.inGame.State == InGame.States.Active) { InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu; } } // Scroll text??? if (blob.NumLines != 0) { int scroll = MouseInput.ScrollWheel - MouseInput.PrevScrollWheel; if (Actions.Up.WasPressedOrRepeat || scroll > 0) { ScrollDown(); } if (Actions.Down.WasPressedOrRepeat || scroll < 0) { ScrollUp(); } // If we're not shutting down... if (Active) { } // end if not shutting down. } // We should be on top and owning all input // focus so don't let anthing trickle down. GamePadInput.ClearAllWasPressedState(); // Disable the help overlay's tool icon because in some situations // it can overlap the text making it unreadable. HelpOverlay.ToolIcon = null; // If active we need to pre-render the text to the 1k rendertarget since // changing render targets on the Xbox forces a resolve. PreRender(); // If we're rendering this into a 1280x720 rt we need a matching camera to calc mouse hits. if (useBackgroundThumbnail) { camera = new PerspectiveUICamera(); camera.Resolution = new Point(1280, 720); } if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch) { for (int i = 0; i < TouchInput.TouchCount; i++) { TouchContact touch = TouchInput.GetTouchContactByIndex(i); Vector2 touchHit = touch.position; // Adjust for position and scaling of final rendering. touchHit -= renderPosition; touchHit /= renderScale; if (useRtCoords) { touchHit = ScreenWarp.ScreenToRT(touch.position); } HandleTouchInput(touch, touchHit); } } else if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse) { Vector2 hit = MouseInput.PositionVec; // Adjust for position and scaling of final rendering. hit -= renderPosition; hit /= renderScale; if (useRtCoords) { hit = MouseInput.GetMouseInRtCoords(); } HandleMouseInput(hit); } } // end if active. } // end of Update()
/// <summary> /// Called once per frame. /// If camera is null, assumes everything is in screenspace. /// </summary> public void Update(Camera camera) { if (Active) { // Don't let anyone else grab focus, if anyone has, grab it back. if (CommandStack.Peek() != commandMap) { CommandStack.Pop(commandMap); CommandStack.Push(commandMap); } // Check if we have input focus. if (CommandStack.Peek() == commandMap) { GamePadInput pad = GamePadInput.GetGamePad0(); if (handlerA != null && Actions.A.WasPressed) { Actions.A.ClearAllWasPressedState(); Actions.A.IgnoreUntilReleased(); handlerA(this); } if (handlerB != null && Actions.B.WasPressed) { Actions.B.ClearAllWasPressedState(); Actions.B.IgnoreUntilReleased(); handlerB(this); } if (handlerX != null && Actions.X.WasPressed) { Actions.X.ClearAllWasPressedState(); Actions.X.IgnoreUntilReleased(); handlerX(this); } if (handlerY != null && Actions.Y.WasPressed) { Actions.Y.ClearAllWasPressedState(); Actions.Y.IgnoreUntilReleased(); handlerY(this); } Vector2 hit; if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch) { for (int i = 0; i < TouchInput.TouchCount; i++) { TouchContact touch = TouchInput.GetTouchContactByIndex(i); hit = touch.position; if (camera != null) { hit = MouseInput.AdjustHitPosition(hit, camera, false, false); } hit = hit - pos; HandleTouchInput(hit, touch); } } else { // Since the dialog is screenspace we can use the mouse position directly. hit = MouseInput.PositionVec; if (useRtCoords) { hit = ScreenWarp.ScreenToRT(hit); } hit -= pos; HandleMouseInput(hit); } } // end if we have input focus. RefreshTexture(); } } // end of Update()
} // end of c'tor public void Update(Camera camera) { if (Active) { GamePadInput pad = GamePadInput.GetGamePad0(); #if !NETFX_CORE // For games using micro:bit, allow buttons to dismiss ingame dialogs. if (InGame.inGame.CurrentUpdateMode == InGame.UpdateMode.RunSim) { Microbit bit = MicrobitExtras.GetMicrobitOrNull(GamePadSensor.PlayerId.All); if (bit != null) { // Allow either button to dismiss display. if (bit.State.ButtonA.IsPressed() || bit.State.ButtonB.IsPressed()) { Deactivate(); } } } #endif if (Actions.Select.WasPressed) { Actions.Select.ClearAllWasPressedState(); Deactivate(); } if (!string.IsNullOrEmpty(textB)) { if (Actions.B.WasPressed) { Actions.B.ClearAllWasPressedState(); userHitA = false; Deactivate(); } } // We need to be able to slip out to the mini-hub here since // continuous, repeated calls to TextDisplay can lock the // user out of control. if (Actions.MiniHub.WasPressed) { Actions.MiniHub.ClearAllWasPressedState(); Deactivate(); InGame.inGame.SwitchToMiniHub(); } // We need to be able to slip out to the tool menu here since // continuous, repeated calls to TextDisplay can lock the // user out of control. if (Actions.ToolMenu.WasPressed) { Actions.ToolMenu.ClearAllWasPressedState(); Deactivate(); if (InGame.inGame.State == InGame.States.Active) { InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu; } } // Scroll text??? if (blob.NumLines != 0) { int scroll = MouseInput.ScrollWheel - MouseInput.PrevScrollWheel; if (Actions.Up.WasPressedOrRepeat || scroll > 0) { ScrollDown(); } if (Actions.Down.WasPressedOrRepeat || scroll < 0) { ScrollUp(); } // If we're not shutting down... if (Active) { } // end if not shutting down. } // We should be on top and owning all input // focus so don't let anthing trickle down. GamePadInput.ClearAllWasPressedState(); // Disable the help overlay's tool icon because in some situations // it can overlap the text making it unreadable. HelpOverlay.ToolIcon = null; // If active we need to pre-render the text to the 1k rendertarget since // changing render targets on the Xbox forces a resolve. if (dirty) { PreRender(); dirty = false; } // If we're rendering this into a 1280x720 rt we need a matching camera to calc mouse hits. if (useBackgroundThumbnail) { camera = new PerspectiveUICamera(); camera.Resolution = new Point(1280, 720); } if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch) { for (int i = 0; i < TouchInput.TouchCount; i++) { TouchContact touch = TouchInput.GetTouchContactByIndex(i); Vector2 touchHit = touch.position; // Adjust for position and scaling of final rendering. touchHit -= renderPosition; touchHit /= renderScale; if (useRtCoords) { touchHit = ScreenWarp.ScreenToRT(touch.position); } HandleTouchInput(touch, touchHit); } } else if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse) { Vector2 hit = MouseInput.PositionVec; // Adjust for position and scaling of final rendering. hit -= renderPosition; hit /= renderScale; if (useRtCoords) { //hit = MouseInput.GetMouseInRtCoords(); } HandleMouseInput(hit); } } // end if active. } // end of Update()
public override void Update() { shared.timer.Update(); // Keep Kodu animating even if a dialog is active. shared.boku.UpdateFace(); shared.boku.UpdateAnimations(); if (AuthUI.IsModalActive) { return; } if (parent.newWorldDialog.Active) { parent.newWorldDialog.Update(); return; } // If not modal, always show status. AuthUI.ShowStatusDialog(); // Update the dialogs. parent.prevSessionCrashedMessage.Update(); parent.noCommunityMessage.Update(); parent.noSharingMessage.Update(); // Don't do anything else until the user reads and dismisses the dialogs. if (parent.prevSessionCrashedMessage.Active || parent.exitingKodu) { return; } // Update the options menu. Do this first so that if it is active it can steal input. shared.optionsMenu.Update(); // Main menu should always be active. shared.menu.Active = true; // If OptionsMenu is active, don't look at input. This is a problem for touch input // which doesn't support any kind of "ClearAllWasPressedState" functionality. if (!shared.optionsMenu.Active) { // Check for click on signOut tile or url. if (MouseInput.Left.WasPressed || Actions.Select.WasPressed || TouchInput.WasTouched) { TouchContact touch = TouchInput.GetOldestTouch(); if (touch != null) { touch.position = ScreenWarp.ScreenToRT(touch.position); } Vector2 mouseHit = MouseInput.GetMouseInRtCoords(); // url is in rt coords. if (shared.urlBox.Contains(mouseHit) || (null != touch && shared.urlBox.Contains(touch.position))) { #if NETFX_CORE Launcher.LaunchUriAsync(new Uri(KoduGameLabUrl)); #else Process.Start(KoduGameLabUrl); #endif MouseInput.Left.ClearAllWasPressedState(); } } // Enable resume option if we have something to resume to. if (InGame.UnDoStack.HaveResume() && (shared.menu.Item(0) != Strings.Localize("mainMenu.resume"))) { shared.menu.InsertText(Strings.Localize("mainMenu.resume"), 0); } shared.liveFeed.UpdateFeed(); shared.liveFeed.Update(shared.camera); if (!UpdateNonMenuItems()) { // JW - Only update the menu and process input if the interactive non-menu // items didn't already handle the input. int curIndex = shared.menu.CurIndex; shared.menu.Update(shared.camera, ref shared.worldMatrix); int newIndex = shared.menu.CurIndex; // If the user made a menu change, have boku glance over. if (curIndex != newIndex) { shared.boku.DirectGaze(new Vector3(0.2f, -0.4f, 0.08f - 0.05f * newIndex), 0.5f); } } } if (Actions.MiniHub.WasPressed && InGame.XmlWorldData != null) { parent.Deactivate(); InGame.inGame.SwitchToMiniHub(); return; } #if IMPORT_DEBUG if (!string.IsNullOrEmpty(StartupWorldFilename)) { LevelPackage.DebugPrint("MainMenu"); LevelPackage.DebugPrint(" StartupWorldFilename : " + StartupWorldFilename); } #endif // Jump into the startup world, if it was specified. if (!String.IsNullOrEmpty(StartupWorldFilename)) { if (Storage4.FileExists(StartupWorldFilename, StorageSource.All)) { #if IMPORT_DEBUG LevelPackage.DebugPrint(" level exists, trying to load and run"); #endif if (BokuGame.bokuGame.inGame.LoadLevelAndRun(StartupWorldFilename, keepPersistentScores: false, newWorld: false, andRun: true)) { #if IMPORT_DEBUG LevelPackage.DebugPrint(" success on load and run"); #endif parent.Deactivate(); } #if IMPORT_DEBUG else { LevelPackage.DebugPrint(" fail to load and run"); } #endif shared.waitingForStorage = false; } #if IMPORT_DEBUG else { LevelPackage.DebugPrint(" level not found"); } #endif StartupWorldFilename = null; } // Set news feed state to opposite of options menu. This allows the // News Feed to "hide" when the Options Menu is active. if (shared.optionsMenu.Active) { shared.liveFeed.Deactivate(); } else { shared.liveFeed.Activate(); shared.liveFeed.UpdateFeed(); } } // end of Update()
private void HandleTouchInput(Camera camera) { if (GamePadInput.ActiveMode != GamePadInput.InputMode.Touch) { return; } // Touch input // If the touch is over the menu, move the selection index to the item under the mouse. // On touch down, make the item (if any) under the touch the ClickedOnItem. // On tap, if the touch is still over the ClickedOnItem, activate it. If not, just clear ClickedOnItem. TouchContact touch = TouchInput.GetOldestTouch(); if (touch != null) { Vector2 hitUV = TouchInput.GetHitUV(touch.position, camera, ref invWorldMatrix, width, height, useRtCoords: useRtCoords); // See if we're over anything. If so, set that item to being selected but only if we've moved the mouse. // This prevents the menu from feeling 'broken' if the mouse is over it and the user tries to use // the gamepad or keyboard. int touchItem = -1; for (int i = 0; i < itemList.Count; i++) { if (itemList[i].UVBoundingBox != null && itemList[i].UVBoundingBox.Contains(hitUV)) { // Only update the current in-focus element when the mouse moves. if (true) // touch.position != touch.previousPosition) { CurIndex = i; } touchItem = i; } } //if ( TouchInput.TapGesture.WasTapped() ) if (TouchInput.IsTouched) { if (touchItem != -1) { touch.TouchedObject = itemList[touchItem]; } } if (TouchGestureManager.Get().TapGesture.WasTapped()) { // Make sure we're still over the ClickedOnItem. if (touchItem != -1 && touch.TouchedObject == itemList[touchItem]) { ToggleState(); } } Vector2 hit = touch.position; if (useRtCoords) { hit = ScreenWarp.ScreenToRT(hit); } if (changeBox.Touched(touch, hit)) { ToggleState(); } if (backBox.Touched(touch, hit)) { Deactivate(); Foley.PlayBack(); } // Allow Swipeto cycle through elements. // Allow scroll wheel to cycle through elements. SwipeGestureRecognizer swipeGesture = TouchGestureManager.Get().SwipeGesture; if (swipeGesture.WasSwiped()) { if (swipeGesture.SwipeDirection == Boku.Programming.Directions.South) { curIndex -= 6; if (curIndex < 0) { curIndex = itemList.Count - 1; } Foley.PlayShuffle(); } else if (swipeGesture.SwipeDirection == Boku.Programming.Directions.North) { curIndex += 6; if (curIndex > (itemList.Count - 1)) { curIndex = 0; } Foley.PlayShuffle(); } } // If we click outside of the list, close it treating it as if select was chosen. //if (TouchInput.TapGesture.WasTapped() && touch.touchedObject == null) if (TouchInput.WasTouched && touch.TouchedObject == null) { Deactivate(); } } }
} // end of DeleteText() private void HandleMouseInput(Camera camera) { if (GamePadInput.ActiveMode != GamePadInput.InputMode.KeyboardMouse) { return; } // If the mouse is over the menu, move the selection index to the item under the mouse. // On mouse down, make the item (if any) under the mouse the ClickedOnItem. // On mouse up, if the mouse is still over the ClickedOnItem, activate it. If not, just clear ClickedOnItem. Vector2 hitUV = MouseInput.GetHitUV(camera, ref invWorldMatrix, width, height, useRtCoords: useRtCoords); // See if we're over anything. If so, set that item to being selected but only if we've moved the mouse. // This prevents the menu from feeling 'broken' if the mouse is over it and the user tries to use // the gamepad or keyboard. int mouseOverItem = -1; for (int i = 0; i < itemList.Count; i++) { if (itemList[i].UVBoundingBox != null && itemList[i].UVBoundingBox.Contains(hitUV)) { // Only update the current in-focus element when the mouse moves. if (MouseInput.Position != MouseInput.PrevPosition) { CurIndex = i; } mouseOverItem = i; } } if (MouseInput.Left.WasPressed) { if (mouseOverItem != -1) { MouseInput.ClickedOnObject = itemList[mouseOverItem]; } } if (MouseInput.Left.WasReleased) { // Make sure we're still over the ClickedOnItem. if (mouseOverItem != -1 && MouseInput.ClickedOnObject == itemList[mouseOverItem]) { ToggleState(); } } Vector2 hit = MouseInput.PositionVec; if (useRtCoords) { hit = ScreenWarp.ScreenToRT(hit); } if (changeBox.LeftPressed(hit)) { ToggleState(); } if (backBox.LeftPressed(hit)) { Deactivate(); Foley.PlayBack(); } // Allow scroll wheel to cycle through elements. int wheel = MouseInput.ScrollWheel - MouseInput.PrevScrollWheel; if (wheel > 0) { --curIndex; if (curIndex < 0) { curIndex = itemList.Count - 1; } Foley.PlayShuffle(); } else if (wheel < 0) { ++curIndex; if (curIndex >= itemList.Count) { curIndex = 0; } Foley.PlayShuffle(); } // If we click outside of the list, close it treating it as if select was chosen. if (MouseInput.Left.WasPressed && MouseInput.ClickedOnObject == null) { Deactivate(); } }
} // end of c'tor public void Update(Camera camera) { if (Active) { GamePadInput pad = GamePadInput.GetGamePad0(); if (InGame.inGame.State == InGame.States.Active && InGame.inGame.CurrentUpdateMode == InGame.UpdateMode.RunSim) { // We need to be able to slip out to the mini-hub here since // continuous, repeated calls to ModalHint can lock the // user out of control. if (Actions.MiniHub.WasPressed) { Actions.MiniHub.ClearAllWasPressedState(); Deactivate(); InGame.inGame.SwitchToMiniHub(); } // We need to be able to slip out to the tool menu here since // continuous, repeated calls to ModalHint can lock the // user out of control. if (Actions.ToolMenu.WasPressed) { Actions.ToolMenu.ClearAllWasPressedState(); Deactivate(); InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu; } } if (Actions.Select.WasPressed) { Actions.Select.ClearAllWasPressedState(); // Disable this hint for this session. if (curHint.ShowOnce) { curHint.Disabled = true; } Deactivate(); } if (Actions.X.WasPressed) { Actions.X.ClearAllWasPressedState(); // Disable this hint until reset by user. XmlOptionsData.SetHintAsDisabled(curHint.ID); // Disable this hint for this session. if (curHint.ShowOnce) { curHint.Disabled = true; } Deactivate(); } if (useBackgroundThumbnail) { camera = new PerspectiveUICamera(); camera.Resolution = new Point(1280, 720); } if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch) { for (int i = 0; i < TouchInput.TouchCount; i++) { TouchContact touch = TouchInput.GetTouchContactByIndex(i); Vector2 touchHit = touch.position; if (useRtCoords) { touchHit = ScreenWarp.ScreenToRT(touch.position); } HandleTouchInput(touch, touchHit); } } else if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse) { Vector2 hit = MouseInput.PositionVec; if (useRtCoords) { hit = MouseInput.GetMouseInRtCoords(); } HandleMouseInput(hit); } } // end if active. } // end of Update()
} // end of c'tor public void Update(Camera camera) { if (Active) { // If we've just been activated, ignore input to prevent // accidental dismissal. if (Time.WallClockTotalSeconds < activationTime + deadInputTime) { return; } GamePadInput pad = GamePadInput.GetGamePad0(); if (InGame.inGame.State == InGame.States.Active && InGame.inGame.CurrentUpdateMode == InGame.UpdateMode.RunSim) { #if !NETFX_CORE // For games using micro:bit, allow buttons to dismiss ingame dialogs. if (InGame.inGame.CurrentUpdateMode == InGame.UpdateMode.RunSim) { Microbit bit = MicrobitExtras.GetMicrobitOrNull(GamePadSensor.PlayerId.All); if (bit != null) { // Allow either button to dismiss display. if (bit.State.ButtonA.IsPressed() || bit.State.ButtonB.IsPressed()) { Deactivate(); } } } #endif // We need to be able to slip out to the mini-hub here since // continuous, repeated calls to TextDisplay can lock the // user out of control. if (Actions.MiniHub.WasPressed) { Actions.MiniHub.ClearAllWasPressedState(); Deactivate(); InGame.inGame.SwitchToMiniHub(); } // We need to be able to slip out to the tool menu here since // continuous, repeated calls to TextDisplay can lock the // user out of control. if (Actions.ToolMenu.WasPressed) { Actions.ToolMenu.ClearAllWasPressedState(); Deactivate(); InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu; } } if (Actions.Select.WasPressed) { Actions.Select.ClearAllWasPressedState(); Deactivate(); } // If we're rendering this into a 1280x720 rt we need a matching camera to calc mouse hits. if (useBackgroundThumbnail) { camera = new PerspectiveUICamera(); camera.Resolution = new Point(1280, 720); } if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch) { for (int i = 0; i < TouchInput.TouchCount; i++) { TouchContact touch = TouchInput.GetTouchContactByIndex(i); Vector2 touchHit = touch.position; if (useRtCoords) { touchHit = ScreenWarp.ScreenToRT(touch.position); } HandleTouchInput(touch, touchHit); } } else if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse) { Vector2 hit = MouseInput.PositionVec; if (useRtCoords) { hit = MouseInput.GetMouseInRtCoords(); } HandleMouseInput(hit); } } // end if active. } // end of Update()