Exemple #1
0
        private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                Close();
            }

            switch (state)
            {
            case State.START:
                ChangeState(State.PLAYING);
                break;

            case State.PLAYING:
                player.keyDown(e.KeyCode);
                break;

            case State.END:
                init();
                ChangeState(State.START);
                break;
            }
        }