Пример #1
0
        private void Events_Tick(object sender, TickEventArgs e)
        {
            // Clear Screen, Draw, Output
            Video.Screen.Fill(Color.Black);
            Player.Draw(Video.Screen, Color.Wheat, false, true);
            Video.Screen.Update();

            // Handle Movement
            KeyboardState KeyState = new KeyboardState(true);
            if (KeyState.IsKeyPressed(Key.A)) { Player.XPosition1 -= 2; Player.XPosition2 -= 2; }
            else if (KeyState.IsKeyPressed(Key.D)) { Player.XPosition1 += 2; Player.XPosition2 += 2; }
            if (KeyState.IsKeyPressed(Key.W)) { Player.YPosition1 -= 2; Player.YPosition2 -= 2; }
            else if (KeyState.IsKeyPressed(Key.S)) { Player.YPosition1 += 2; Player.YPosition2 += 2; }
        }
Пример #2
0
 /// <summary>
 /// Handles the events.
 /// </summary>
 public void HandleEvents()
 {
     if (!Events.Poll())
         return;
     // On quitte le programme quand on appuie sur Echap
     KeyboardState keyState = new KeyboardState();
     if (keyState.IsKeyPressed(Key.Escape))
         GameStateManager.Quit();
 }
Пример #3
0
        public void HandleEvents()
        {
            if (!Events.Poll ())
                return;
            // On change de GameState
            KeyboardState keyState = new KeyboardState ();
            if (keyState.IsKeyPressed (Key.Escape)) {
                //GameStateManager.ChangeState(new GS_ColoredBackground());
                GameStateManager.Quit ();
            }
            if (keyState.IsKeyPressed (Key.Space))
                GameStateManager.ChangeState (new GS_ColoredBackground ());

            if (keyState.IsKeyPressed (Key.DownArrow))
                moveDownList ();
            if (keyState.IsKeyPressed (Key.UpArrow))
                moveUpList ();
            if (keyState.IsKeyPressed (Key.LeftArrow)) {
                if (currentEmulator == 0) {
                    currentEmulator = emulators.Length - 1;
                } else {
                    currentEmulator--;
                }
                changeEmulator.Play ();
                switchEmulator ();
            }
            if (keyState.IsKeyPressed (Key.RightArrow)) {
                if (currentEmulator == emulators.Length - 1) {
                    currentEmulator = 0;
                } else {
                    currentEmulator++;
                }
                changeEmulator.Play ();
                switchEmulator ();

            }
        }