/// <summary> /// Responds to user input, changing the selected entry and accepting /// or cancelling the menu. /// </summary> public override void HandleInput(InputState input, GameTime gameTime) { // we cancel the current menu screen if the user presses the back button PlayerIndex player; if (input.IsNewButtonPress(Buttons.Back, ControllingPlayer, out player)) { OnCancel(player); } //Mouse if (input.IsNewMousePress(ControllingPlayer, out player)) { TrySelectMenuEntry(input.MousePoint); } //Gestures foreach (GestureSample gesture in input.Gestures) { if (gesture.GestureType == GestureType.Tap) { Point tapLocation = new Point((int)gesture.Position.X, (int)gesture.Position.Y); TrySelectMenuEntry(tapLocation); } } }
/// <summary> /// Constructs a new screen manager component. /// </summary> public ScreenManager(Game game) : base(game) { TouchPanel.EnabledGestures = GestureType.Tap; contentManager = game.Content; contentManager.RootDirectory = "Content"; input = new InputState(); screens = new List<BaseScreen>(); screensToUpdate = new List<BaseScreen>(); transitions = new List<RenderTarget2D>(); }
/// <summary> /// 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. /// </summary> public virtual void HandleInput(InputState input, GameTime gameTime) { }