示例#1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
          
            player = new Player(0, 0);
            gameState = new GameStateManager("menu");

            base.Initialize();
        }
示例#2
0
        public static void HandleInput(ref GameStateManager state)
        {
            KeyboardState newState = Keyboard.GetState();


            if (newState.IsKeyDown(Keys.Down))
            {
                if (!oldState.IsKeyDown(Keys.Down))
                {
                    if (index != buttons.Count - 1)
                        index++;
                    else
                        index = 0;
                }           
            }
            else if (newState.IsKeyDown(Keys.Up))
            {
                if (!oldState.IsKeyDown(Keys.Up))
                {
                    if (index != 0)
                        index--;
                    else
                        index = buttons.Count - 1;
                }
            }
            else if (newState.IsKeyDown(Keys.Enter))
            {
                if (_selected == state.States[1])
                    state.Push(state.States[1]);
                else if (_selected == "play")
                    state.Set(state.States[2]);
            }


            _selected = buttons.Keys.ToList()[index];

            oldState = newState;
        }