Ejemplo n.º 1
0
        protected override void OnKeyPressed(object sender, KeyboardPressedEventArgs e)
        {
            switch (e.Key)
            {
                case Keys.A:
                    if (!textbox.IsFocused)
                        IsCursorVisible = false;
                    break;
                case Keys.B:
                    if (!textbox.IsFocused)
                        IsCursorVisible = true;
                    break;
                case Keys.C:
                    Console.WriteLine(this);
                    break;
                case Keys.D:
                    textbox.Focus();
                    break;
                case Keys.Left:
                    if (!textbox.IsFocused)
                        sceneManager.Load<AudioTestScene>();
                    break;
                case Keys.Right:
                    if (!textbox.IsFocused)
                        sceneManager.Load<PhysicsTestScene>();
                    break;
            }

            base.OnKeyPressed(sender, e);
        }
Ejemplo n.º 2
0
        protected override void OnKeyPressed(object sender, KeyboardPressedEventArgs e)
        {
            switch (e.Key)
            {
                case Keys.Left:
                    sceneManager.Load<InputTestScene>();
                    break;
                case Keys.Right:
                    sceneManager.Load<GuiTestScene>();
                    break;
            }

            base.OnKeyPressed(sender, e);
        }
Ejemplo n.º 3
0
        protected override void OnKeyPressed(object sender, KeyboardPressedEventArgs e)
        {
            switch (e.Key)
            {
                case Keys.Z:
                    timer.Start();
                    explosion.AutoAnimated = true;
                    break;
                case Keys.X:
                    timer.Stop();
                    explosion.AutoAnimated = false;
                    break;
                case Keys.Left:
                    sceneManager.Load<PhysicsTestScene>();
                    break;
                case Keys.Right:
                    sceneManager.Load<InputTestScene>();
                    break;
            }

            base.OnKeyPressed(sender, e);
        }
Ejemplo n.º 4
0
 private void OnKeyPressed(object sender, KeyboardPressedEventArgs e)
 {
     keys.AddExclusive(e.Key);
     UpdateCursorPosition(e.Key);
     UpdateText(e.Key);
 }
Ejemplo n.º 5
0
 private void KeyboardPressedEventDispatcher(KeyboardPressedEventArgs e)
 {
     var h = Pressed;
     if (h != null)
         h(this, e);
 }
Ejemplo n.º 6
0
 private void OnKeyPressed(object sender, KeyboardPressedEventArgs e)
 {
     if (e.Key == Keys.Escape)
         Exit();
 }
Ejemplo n.º 7
0
        protected override void OnKeyPressed(object sender, KeyboardPressedEventArgs e)
        {
            switch (e.Key)
            {
                case Keys.W:
                    if (!collision2DManager.IsColliding(player1.MoveEmulate(PlayerDirections.Up), player1))
                        player1.Move(PlayerDirections.Up);
                    break;
                case Keys.S:
                    if (!collision2DManager.IsColliding(player1.MoveEmulate(PlayerDirections.Down), player1))
                        player1.Move(PlayerDirections.Down);
                    break;
                case Keys.A:
                    if (!collision2DManager.IsColliding(player1.MoveEmulate(PlayerDirections.Left), player1))
                        player1.Move(PlayerDirections.Left);
                    break;
                case Keys.D:
                    if (!collision2DManager.IsColliding(player1.MoveEmulate(PlayerDirections.Right), player1))
                        player1.Move(PlayerDirections.Right);
                    break;
                case Keys.I:
                    if (!collision2DManager.IsColliding(player2.MoveEmulate(PlayerDirections.Up), player2))
                        player2.Move(PlayerDirections.Up);
                    break;
                case Keys.K:
                    if (!collision2DManager.IsColliding(player2.MoveEmulate(PlayerDirections.Down), player2))
                        player2.Move(PlayerDirections.Down);
                    break;
                case Keys.J:
                    if (!collision2DManager.IsColliding(player2.MoveEmulate(PlayerDirections.Left), player2))
                        player2.Move(PlayerDirections.Left);
                    break;
                case Keys.L:
                    if (!collision2DManager.IsColliding(player2.MoveEmulate(PlayerDirections.Right), player2))
                        player2.Move(PlayerDirections.Right);
                    break;
                case Keys.Left:
                    sceneManager.Load<GuiTestScene>();
                    break;
                case Keys.Right:
                    sceneManager.Load<UtilityTestScene>();
                    break;
            }

            base.OnKeyPressed(sender, e);
        }
Ejemplo n.º 8
0
 protected virtual void OnKeyPressed(object sender, KeyboardPressedEventArgs e)
 {
     //add common logic here...
 }