public override void Activate(InputState input)
 {
     base.Activate(input);
     AddMenuEntry("Done", Advance);
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructs a new screen manager component.
 /// </summary>
 public ScreenManager(Game game)
     : base(game)
 {
     // we must set EnabledGestures before we can query for them, but
     // we don't assume the game wants to read them.
     TouchPanel.EnabledGestures = GestureType.None;
     traceEnabled = false;
     input = new InputState();
 }
 public override void Activate(InputState input)
 {
     base.Activate(input);
     AddMenuEntry("Quadrant", QuadrantEntrySelected);
     AddMenuEntry("Back", BackEntrySelected);
     SetBackground(new DrawableAsset<Texture2D>(Main.windowSize * 0.5f, new Vector2(0, -1), Main.windowSize, Main.sprites["menuBack"]));
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
 }
 public override void Deactivate(InputState input)
 {
     base.Deactivate(input);
     if (input.Kinect.IsEnabled())
     {
         input.Kinect.DisableGestureTest(GestureTests.RightArmDown);
         input.Kinect.DisableGestureTest(GestureTests.LeftArmDown);
     }
 }
 public override void HandleInput(GameTime gameTime, InputState input)
 {
     //RecognitionResult r = input.Kinect.GetNewestCommand();
     //if ((r != null && r.likelihood > 0.55 && r.word == "play") ||
         //this.ExitScreen();
     PlayerIndex playerIndex;
     if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.Space,ControllingPlayer,out playerIndex))
         this.ExitScreen();
     base.HandleInput(gameTime, input);
 }
Ejemplo n.º 6
0
 public override void Activate(InputState input)
 {
     base.Activate(input);
     AddMenuEntry("Classic", ClassicEntrySelected);
     AddMenuEntry("Educational", EducationalEntrySelected);
     AddMenuEntry("Options", LaunchOptionsScreen);
     AddMenuEntry("Quit", OnExit);
     SetBackground(new DrawableAsset<Texture2D>(Main.windowSize * 0.5f, new Vector2(0, -1), Main.windowSize, Main.sprites["menuBack"]));
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
 }
Ejemplo n.º 7
0
 public override void Activate(InputState input)
 {
     base.Activate(input);
     AddMenuEntry("Replay", ReplayGame);
     AddMenuEntry("To Main Menu", ToMainMenu);
     AddMenuEntry("Quit Game", CheckQuitGame);
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
     Vector2 finalScorePos = new Vector2(Main.windowSize.X / 2, Entries[Entries.Count - 1].boundry.Bottom + TextSettings.CurrentFont.MeasureString("Final Score: " + previousScore.ToString()).Y / 2 * 2.0f);
     finalScoreText = new Text("Final Score: " + previousScore.ToString(), finalScorePos, 1.0f, Color.Goldenrod);
 }
Ejemplo n.º 8
0
 public override void Activate(InputState input)
 {
     base.Activate(input);
     if (nextScreen != null)
         AddMenuEntry("Next Level", ToNextLevel);
     AddMenuEntry("Replay", ReplayGame);
     AddMenuEntry("To Main Menu", ToMainMenu);
     AddMenuEntry("Quit Game", CheckQuitGame);
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
 }
 public override void Activate(InputState input)
 {
     base.Activate(input);
     AddMenuEntry("Very Easy", MegaWeenieSelected, false);
     AddMenuEntry("Easy", PansySelected, false);
     AddMenuEntry("Normal", NormalSelected, false);
     AddMenuEntry("Hard", HairySelected, false);
     AddMenuEntry("Hardest ", SuperBadassSelected, false);
     AddMenuEntry("Back ", ToMainMenu, false);
     SetBackground(new DrawableAsset<Texture2D>(Main.windowSize * 0.5f, new Vector2(0, -1), Main.windowSize, Main.sprites["menuBack"]));
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Load graphics content for the game.
 /// </summary>
 public override void Activate(InputState input)
 {
     if (input.Kinect.IsEnabled())
     {
         //input.Kinect.SetNewSpeechVocabulary(new Microsoft.Speech.Recognition.Choices( "pause"));
         input.Kinect.EnableGestureTest(GestureTests.TurnLeft,OnLeft);
         input.Kinect.EnableGestureTest (GestureTests.TurnRight,OnRight);
         input.Kinect.EnableGestureTest( GestureTests.TurnUp,OnUp);
         input.Kinect.EnableGestureTest( GestureTests.TurnDown,OnDown);
         input.Kinect.EnableGestureTest( GestureTests.Pause,OnPause);
     }
     base.Activate(input);
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput(GameTime gameTime, InputState input)
        {
            PlayerIndex playerIndex;

            if (input.IsNewButtonPress(Buttons.A, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Enter, ControllingPlayer, out playerIndex))
            {
                gestureOptions[0].callback.Invoke(playerIndex);
            }
            if (input.IsNewButtonPress(Buttons.B, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Escape, ControllingPlayer, out playerIndex))
            {
                gestureOptions[1].callback.Invoke(playerIndex);
            }
        }
Ejemplo n.º 12
0
 public override void Activate(InputState input)
 {
     if (input.Kinect.IsEnabled())
     {
         //input.Kinect.SetNewSpeechVocabulary(new Microsoft.Speech.Recognition.Choices("play"));
           input.Kinect.EnableGestureTest( GestureTests.Resume,Resume);
     }
     base.Activate(input);
     AddMenuEntry("Resume Game", ResumeGame);
     AddMenuEntry("Restart Game", RestartGame);
     AddMenuEntry("To Main Menu", CheckMainMenu);
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
 }
 public override void Activate(InputState input)
 {
     AddGestureOption(" - Hold Up Right Arm to Select Right", GestureTests.RightArmUp, OnRight, Main.sprites["confirmGesture"]);
     AddGestureOption(" - Hold Up Left Arm to Left Right", GestureTests.LeftArmUp, OnLeft, Main.sprites["cancelGesture"]);
     help = new Text("", gestureOptions[gestureOptions.Count - 1].Position + new Vector2(0, padding * 3), (Main.windowSize.X / 1920.0f) * 2.0f, Color.Goldenrod);
     armIndicator = new Text("", Main.windowSize * 0.5f, (Main.windowSize.X / 1920.0f) * 3.0f, Color.Lime);
     Vector2 selectionSize = new Vector2(Main.windowSize.X / 4.0f, Main.windowSize.X / 4.0f);
     selectionLoader = new DrawableAsset<Animation2D>(Main.windowSize * 0.5f, new Vector2(0, -1), selectionSize, Main.content.Load<Animation2D>("Content\\Images\\load"));
     if (input.Kinect.IsEnabled())
     {
         input.Kinect.EnableGestureTest(GestureTests.RightArmDown, OnRightDown);
         input.Kinect.EnableGestureTest(GestureTests.LeftArmDown, OnLeftDown);
     }
     base.Activate(input);
 }
        /// <summary>
        /// Loads graphics content for this screen. This uses the shared ContentManager
        /// provided by the Game class, so the content will remain loaded forever.
        /// Whenever a subsequent MessageBoxScreen tries to load this same content,
        /// it will just get back another reference to the already loaded data.
        /// </summary>
        public override void Activate(InputState input)
        {
            base.Activate(input);
            foreach (GestureOptionEntry option in gestureOptions)
                option.Activate(input);

            ContentManager content = Main.content;
            gradientTexture = content.Load<Texture2D>("Content\\Images\\gradient");
        }
 public override void HandleInput(GameTime gameTime, InputState input)
 {
     if (input.Kinect.IsColorCaptureEnabled())
         rgbVideoCopy = input.Kinect.GetLastColorFrame();
     base.HandleInput(gameTime, input);
 }
 public override void Deactivate(InputState input)
 {
     if (input.Kinect.IsEnabled())
     {
         foreach (GestureOptionEntry option in gestureOptions)
             option.Deactivate(input);
     }
 }
Ejemplo n.º 17
0
 /// <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(GameTime gameTime, InputState input)
 {
 }
 public override void Activate(InputState input)
 {
     base.Activate(input);
     AddMenuEntry("Quadrant Numbers I", ExcerciseOneSelected, quadrantProfile[QuadrantExcercises.NumbersOne].IsUnlocked);
     AddMenuEntry("Quadrant Numbers II", ExcerciseTwoSelected, quadrantProfile[QuadrantExcercises.NumbersTwo].IsUnlocked);
     AddMenuEntry("Quadrant Numbers III", ExcerciseThreeSelected, quadrantProfile[QuadrantExcercises.NumbersThree].IsUnlocked);
     AddMenuEntry("Positive/Negative I ", ExcerciseFourSelected, quadrantProfile[QuadrantExcercises.PolarityOne].IsUnlocked);
     AddMenuEntry("Positive/Negative II ", ExcerciseFiveSelected, quadrantProfile[QuadrantExcercises.PolarityTwo].IsUnlocked);
     AddMenuEntry("Positive/Negative III ", ExcerciseSixSelected, quadrantProfile[QuadrantExcercises.PolarityThree].IsUnlocked);
     SetBackground(new DrawableAsset<Texture2D>(Main.windowSize * 0.5f, new Vector2(0, -1), Main.windowSize, Main.sprites["menuBack"]));
     SetHandCursor(Main.sprites["handCursor"]);
     SetSelectionSprite(Main.animatedSprites["load"]);
 }
Ejemplo n.º 19
0
 public override void Activate(InputState input)
 {
     AddGestureOption(" - Raise Arms to Confirm", GestureTests.TouchdownTest, OnAccept, Main.sprites["confirmGesture"]);
     AddGestureOption(" - Cross Arms to Cancel", GestureTests.ArmCrossTest, OnCancel, Main.sprites["cancelGesture"]);
     base.Activate(input);
 }
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(InputState input)
        {
            grid = new DrawableGrid(3);
            landscape = new Landscape();
            effectSprites = new List<EffectSprite>();
            //for (int i = 0; i < Main.backgroundLoops.Count; i++)
            //Main.backgroundLoops[i].Play();

            scoreText = new IconText("", Main.sprites["points"], new Vector2(Main.windowSize.X / 10.0f, Main.windowSize.X / 10.0f), new Vector2(Main.windowSize.X / 6.0f, Main.windowSize.X / 12.0f), 0.5f, Color.Goldenrod, TextAlignment.Right);

            snake = new Snake(grid, Main.windowSize * 0.5f,  this.snakeSpeed, this.startSnakeLength);
            landscape.AddComponent(snake);

            List<Type> snakeConditions = new List<Type>();
            snakeConditions.Add(typeof(Mouse));
            snakeConditions.Add(typeof(Rabbit));

            snake.ScheduleCollisionHandling(snakeConditions);
            animals = new List<IDrawableGridAsset>();
            for (int i = 0; i < 5; i++)
                this.PlaceAnimal();
            ScreenManager.Game.ResetElapsedTime();
            base.Activate(input);
        }
 public override void Deactivate(InputState input)
 {
     base.Deactivate(input);
 }
 public void Deactivate(InputState input)
 {
     input.Kinect.DisableGestureTest(test);
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(GameTime gameTime, InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            PlayerIndex playerIndex;
            // The game pauses either if the user presses the pause button, or if
            // they unplug the active gamepad. This requires us to keep track of
            // whether a gamepad was ever plugged in, because we don't want to pause
            // on PC if they are playing with a keyboard and have no gamepad at all!
            //bool gamePadDisconnected = !gamePadState.IsConnected && input.GamePadWasConnected[playerIndex];

            if (input.IsNewButtonPress(Buttons.Start, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Space, ControllingPlayer, out playerIndex))
            {
                OnPause(playerIndex);
            }

            else
            {

                if (input.IsNewKeyPress(Keys.OemPlus, ControllingPlayer, out playerIndex))
                    grid.Enlarge();
                else if (input.IsNewKeyPress(Keys.OemMinus, ControllingPlayer, out playerIndex))
                    grid.Shrink();
                if (input.IsNewKeyPress(Keys.G, ControllingPlayer, out playerIndex))
                    grid.render = !grid.render;

                if (input.IsNewButtonPress(Buttons.DPadUp, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Up, ControllingPlayer, out playerIndex))
                    OnUp(playerIndex);

                else if (input.IsNewButtonPress(Buttons.DPadDown, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Down, ControllingPlayer, out playerIndex))
                    OnDown(playerIndex);

                else if (input.IsNewButtonPress(Buttons.DPadLeft, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Left, ControllingPlayer, out playerIndex))
                    OnLeft(playerIndex);

                else if (input.IsNewButtonPress(Buttons.DPadRight, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Right, ControllingPlayer, out playerIndex))
                    OnRight(playerIndex);
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(GameTime gameTime, InputState input)
        {
            // For input tests we pass in our ControllingPlayer, which may
            // either be null (to accept input from any player) or a specific index.
            // If we pass a null controlling player, the InputState helper returns to
            // us which player actually provided the input. We pass that through to
            // OnSelectEntry and OnCancel, so they can tell which player triggered them.
            PlayerIndex playerIndex;

            usingKinect = input.Kinect.IsEnabled() && input.Kinect.IsTrackingPlayer();
            if (usingKinect)
            {
                Vector2 handPos;
                Vector2 screenDimensions = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height);
                Vector3 rawHandPos, referencePos;
                Vector3 hipPos = input.Kinect.GetJointPosition(JointType.HipCenter);
                float trackedWidth = input.Kinect.GetJointPosition(JointType.ShoulderRight).X - input.Kinect.GetJointPosition(JointType.ShoulderLeft).X;
                if (Input.InputState.DominantSide == DominantSide.Right)
                {
                    rawHandPos = input.Kinect.GetJointPosition(JointType.HandRight);
                    referencePos = hipPos + new Vector3(trackedWidth / 2.0f, -trackedWidth / 2.0f, 0);
                }
                else
                {
                    rawHandPos = input.Kinect.GetJointPosition(JointType.HandLeft);
                    referencePos = hipPos - new Vector3(trackedWidth / 2.0f, trackedWidth / 2.0f,0);
                }
                Vector3 diff = rawHandPos - referencePos;
                handPos = screenDimensions * 0.5f + new Vector2(diff.X, diff.Y) * screenDimensions.X/2;
                selectionLoader.Position = handCursor.Position = handPos;

                int nowOver = HoverItemAt(handPos);
                if (nowOver == -1 || nowOver != entryOver)
                {
                    selectionLoader.ColorMap.Play();
                }

                entryOver = nowOver;

            }
            if (input.IsNewButtonPress(Buttons.DPadUp, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Up, ControllingPlayer, out playerIndex))
                HoverLastItem();

            if (input.IsNewButtonPress(Buttons.DPadDown, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Down, ControllingPlayer, out playerIndex))
                HoverNextItem();

            if (input.IsNewButtonPress(Buttons.A, ControllingPlayer, out playerIndex) || input.IsNewKeyPress(Keys.Enter, ControllingPlayer, out playerIndex))
                SelectAtHover(playerIndex);
            base.HandleInput(gameTime, input);
        }
Ejemplo n.º 25
0
 public override void Activate(InputState input)
 {
     Vector2 screenDimensions = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height);
     float scale = (screenDimensions.X / 1920.0f) * 2.0f;
     padding = (screenDimensions.Y / 1200.0f) * padding;
     title = new Text(menuTitle, new Vector2(screenDimensions.X * 0.5f, screenDimensions.Y * 0.15f), scale, titleColor);
     base.Activate(input);
 }
Ejemplo n.º 26
0
 public override void Deactivate(InputState input)
 {
     if (input.Kinect.IsEnabled())
         input.Kinect.DisableGestureTest(GestureTests.Resume);
     base.Deactivate(input);
 }
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        /// 
        public override void Activate(InputState input)
        {
            grid = new DrawableGrid(3);
            landscape = new Landscape();
            effectSprites = new List<EffectSprite>();
            //for (int i = 0; i < Main.backgroundLoops.Count; i++)
            //Main.backgroundLoops[i].Play();
            scoreText = new IconText("", Main.sprites["points"], new Vector2(Main.windowSize.X / 15.0f, Main.windowSize.X / 15.0f), new Vector2(Main.windowSize.X / 6.0f, 100.0f), 0.5f, Color.Goldenrod, TextAlignment.Right);

            quadrantTarget = Main.numGenerator.Next() % 4 + 1;
            if (currentExcercise == QuadrantExcercises.PolarityOne || currentExcercise == QuadrantExcercises.PolarityTwo)
                quadrantCommand = new IconText(Utilities.QuadrantToPolarity(quadrantTarget), Main.sprites["quadrant"], new Vector2(Main.windowSize.X / 10.0f, Main.windowSize.X / 10.0f), new Vector2(Main.windowSize.X / 3.0f, 100), 1.0f, Color.Azure, TextAlignment.Right, TextEffect.Bubble);

            else
                quadrantCommand = new IconText(quadrantTarget.ToString(), Main.sprites["quadrant"], new Vector2(Main.windowSize.X / 10.0f, Main.windowSize.X / 10.0f), new Vector2(Main.windowSize.X / 3.0f, 100), 1.0f, Color.Azure, TextAlignment.Right, TextEffect.Bubble);
            resultText = new Text("", new Vector2(Main.windowSize.X / 2.0f, Main.windowSize.X / 10.0f), Main.windowSize.X / 1920.0f, Color.Red, TextEffect.Fade);

            this.lives = 5;
            lifeSprites = new List<DrawableAsset<Texture2D>>();
            Vector2 lifeSpriteSize = new Vector2(Main.windowSize.X / 15.0f, Main.windowSize.X / 15.0f);
            for (int i = 0; i < lives; i++)
                lifeSprites.Add(new DrawableAsset<Texture2D>(new Vector2(Main.windowSize.X - (i + 1) * lifeSpriteSize.X, lifeSpriteSize.Y), new Vector2(0, -1), lifeSpriteSize, Main.sprites["snakeBody"]));

            landscape.AddStain(new CoordinateSystem(coordinateType));
            snake = new Snake(grid, Main.windowSize * 0.5f,  this.snakeSpeed, this.startSnakeLength);
            landscape.AddComponent(snake);

            animals = new List<IDrawableGridAsset>();
            for (int i = 0; i < 4; i++)
                this.PlaceAnimal(i + 1);

            List<Type> snakeConditions = new List<Type>();
            snakeConditions.Add(typeof(Mouse));
            snakeConditions.Add(typeof(Rabbit));

            snake.ScheduleCollisionHandling(snakeConditions);
            //ScreenManager.Game.ResetElapsedTime();

            base.Activate(input);
        }
 public void Activate(InputState input)
 {
     input.Kinect.EnableGestureTest(test, callback);
 }
Ejemplo n.º 29
0
        public override void Deactivate(InputState input)
        {
            if (input.Kinect.IsEnabled())
            {

                input.Kinect.DisableGestureTest(GestureTests.TurnLeft);
                input.Kinect.DisableGestureTest(GestureTests.TurnRight);
                input.Kinect.DisableGestureTest(GestureTests.TurnUp);
                input.Kinect.DisableGestureTest(GestureTests.TurnDown);
                input.Kinect.DisableGestureTest(GestureTests.Pause);
            }
            base.Deactivate(input);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Deactivates the screen. Called when the game is being deactivated due to pausing or tombstoning.
 /// </summary>
 public virtual void Deactivate(InputState input)
 {
 }