예제 #1
0
        protected override void Draw(GameTime gameTime)
        {
            switch (CurrentState)
            {
            case GameState.WelcomeScreen:
                GraphicsDevice.Clear(Color.White);
                spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, spriteScale);
                gameWorld.Draw(gameTime, spriteBatch);
                //tetrisGrid.Draw(gameTime, spriteBatch);
                spriteBatch.End();
                break;

            case GameState.StartScreen:
                GraphicsDevice.Clear(Color.White);
                spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, spriteScale);
                gameWorld.Draw(gameTime, spriteBatch);
                tetrisGrid.Draw(gameTime, spriteBatch);
                spriteBatch.End();
                break;

            case GameState.PlayScreen:
                GraphicsDevice.Clear(Color.White);
                spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, spriteScale);
                gameWorld.Draw(gameTime, spriteBatch);
                tetrisGrid.Draw(gameTime, spriteBatch);
                block.Draw(gameTime, spriteBatch);
                spriteBatch.End();
                break;
            }
        }
예제 #2
0
        protected override void Draw(GameTime gameTime)
        {
            mBackground.Render();

            mBackgroundBigBox.Render(new Rectangle((512 - 200) - 15, 40 - 12, 400 + 23, (768 - (40 + 41)) + 16));
            mBackgroundSmallBox.Render(new Rectangle((512 - 480) - 15 + 10, 40 - 10, 290 - 30, 300));
            mBackgroundSmallBox.Render(new Rectangle((512 + 240) - 15 - 10, 40 - 10, 290 - 30, 190));

            mTetrisGrid.Draw(gameTime);

            TextureFont.WriteText(512 + 230, 50, "Level: ");
            TextureFont.WriteText(512 + 400, 50, (mLevel + 1).ToString());
            TextureFont.WriteText(512 + 230, 90, "Score: ");
            TextureFont.WriteText(512 + 400, 90, mTetrisGrid.TotalScore.ToString());
            TextureFont.WriteText(512 + 230, 130, "Lines: ");
            TextureFont.WriteText(512 + 400, 130, mTetrisGrid.CrushedLines.ToString());
            TextureFont.WriteText(512 + 230, 170, "Highscore: ");
            TextureFont.WriteText(512 + 400, 170, mHighscore.ToString());

            base.Draw(gameTime);

            if (mTetrisGrid.GameOver)
            {
                spriteBatch.Begin();
                spriteBatch.DrawString(CopyrightFont, "Game Over", new Vector2(Window.ClientBounds.Width / 2 - 65, Window.ClientBounds.Height / 2 - 20), Color.White, 0, Vector2.Zero, 3f, SpriteEffects.None, 0);
                spriteBatch.End();
            }
        }