コード例 #1
0
ファイル: Game1.bac.cs プロジェクト: Telos8840/TestGame
        /// <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 (statemanager.currentstate)
            {
            case StateManager.GameState.initilize:
                scenemanager.DrawScene(scenemanager.currentScene, GraphicsDevice, spriteBatch, gameTime);
                //GraphicsDevice.Clear(Color.Black);
                break;

            case StateManager.GameState.menu:
                GraphicsDevice.Clear(Color.Blue);
                break;

            case StateManager.GameState.playground:
                GraphicsDevice.Clear(Color.Green);
                spriteBatch.Begin();
                spriteBatch.Draw(background, new Rectangle(0, 0, background.Bounds.Width * 3, background.Bounds.Height * 3), Color.White);
                position = new Vector2((int)position.X, (int)position.Y);
                spriteBatch.Draw(player1, position, new Rectangle(currentFrame * 32 / 2, direction * 40 / 2, 16, 39 / 2), Color.White, 0, Vector2.Zero, new Vector2(3f, 2.461538461538461538f), SpriteEffects.None, 0);
                for (int i = 0; i < 30; i++)
                {
                    spriteBatch.Draw(line, new Rectangle(0, 16 * i, GraphicsDevice.DisplayMode.Width, 1), Color.Black);
                    spriteBatch.Draw(line, new Rectangle(16 * i, 0, 1, GraphicsDevice.DisplayMode.Height), Color.Black);
                }
                spriteBatch.End();
                break;
            }
            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }