コード例 #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
                Keyboard.GetState().IsKeyDown(Keys.End))
            {
                Exit();
            }

            switch (GameState)
            {
            case GameStates.MainMenu:
                break;

            case GameStates.InGame:
                InGame.Update(gameTime);
                break;

            case GameStates.Exit:
                Exit();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            base.Update(gameTime);
        }
コード例 #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // Load InGame
            InGame.LoadContent(Content, GraphicsDevice);
        }
コード例 #3
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            switch (GameState)
            {
            case GameStates.MainMenu:

                break;

            case GameStates.InGame:
                InGame.Draw();
                break;

            case GameStates.Exit:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            base.Draw(gameTime);
        }