Пример #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Main game = new Main())
     {
         game.Run();
     }
 }
Пример #2
0
        public void Update(Main game, GameTime gameTime)
        {
            _keyboard = Keyboard.GetState();
            sound_play = false;

            if (_keyboard.IsKeyDown(Keys.Up)
                && _prevkeyboard.IsKeyUp(Keys.Up))
            {
                if (nav_select < 4)
                {
                    nav_select++;
                }
                else
                {
                    nav_select = 0;
                }

            }

            if (_keyboard.IsKeyDown(Keys.Down)
                && _prevkeyboard.IsKeyUp(Keys.Down))
            {
                if (nav_select > 0)
                {
                    nav_select--;
                }
                else
                {
                    nav_select = 4;
                }

            }

            if (_keyboard.IsKeyDown(Keys.Escape)
                && _prevkeyboard.IsKeyUp(Keys.Escape))
            {
                game.gamestate = 2;
            }

            _prevkeyboard = Keyboard.GetState();
        }
Пример #3
0
        public void Update(Main game, GameTime gameTime)
        {
            _keyboard = Keyboard.GetState();
            sound_play = false;

            if (_keyboard.IsKeyDown(Keys.Left)
                && _prevkeyboard.IsKeyUp(Keys.Left))
            {
                if (selection != 0)
                {
                    selection -= 1;
                    sound_play = true;
                }
                else
                {
                    selection = 2;
                    sound_play = true;
                }
            }

            if (_keyboard.IsKeyDown(Keys.Enter)
                 && _prevkeyboard.IsKeyUp(Keys.Enter))
            {
                switch (selection)
                {
                    case 0:

                        game.gamestate = selection;
                        sound_play = true;

                        break;

                    case 1:

                        game.gamestate = selection;
                        sound_play = true;

                        break;

                    case 2:
                        game.Exit();

                        break;

                }
            }

            if (_keyboard.IsKeyDown(Keys.Right)
                && _prevkeyboard.IsKeyUp(Keys.Right))
            {
                if (selection != 2)
                {
                    selection += 1;

                }
                else
                {
                    selection = 0;
                }
                sound_play = true;
            }

            if (sound_play == true)
            {
                select_sound.Play();
            }

            _prevkeyboard = Keyboard.GetState();
        }