Пример #1
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            ApplicationController controller = (ApplicationController)this.DataContext;

            if (Keyboard.IsKeyDown(Key.W) && mIsTwoPlayer)
            {
                controller.LeftPaddleUp();
            }

            if (Keyboard.IsKeyDown(Key.S) && mIsTwoPlayer)
            {
                controller.LeftPaddleDown();
            }

            if (Keyboard.IsKeyDown(Key.Up))
            {
                controller.RightPaddleUp();
            }

            if (Keyboard.IsKeyDown(Key.Down))
            {
                controller.RightPaddleDown();
            }

            if (Keyboard.IsKeyDown(Key.Space) && spaceCtr == 0)
            {
                animationTimer.Stop();
                spaceCtr = 1;
            }

            else if (Keyboard.IsKeyDown(Key.Space) && spaceCtr == 1)
            {
                animationTimer.Start();
                spaceCtr = 0;
            }
        }
Пример #2
0
        private void HardMenuBtn_Click(object sender, RoutedEventArgs e)
        {
            ApplicationController controller = (ApplicationController)this.DataContext;

            controller.setSpeed(9);
        }