Beispiel #1
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)
        {
            GraphicsDevice.Clear(Color.Black);
            GraphicsDevice.SetRenderTarget(renderTarget);
            spriteBatch.Begin(); //do something with this to rescale
            // TODO: Add your drawing code here
            background.Draw(ref spriteBatch);
            switch (state)
            {
            case GameState.Start:
                spriteBatch.Draw(Content.Load <Texture2D>("Title"), new Vector2(0f, 100f), Color.White);
                startScreen.Draw(ref spriteBatch);
                break;

            case GameState.Playing:
                level.Draw(ref spriteBatch);
                break;

            case GameState.End:
                endScreen.Draw(ref spriteBatch);
                break;

            case GameState.Testing:
                test.Draw(ref spriteBatch);
                break;
            }

            spriteBatch.End();
            GraphicsDevice.SetRenderTarget(null);

            spriteBatch.Begin(samplerState: SamplerState.PointClamp);
            spriteBatch.Draw(renderTarget, new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height), Color.White);
            spriteBatch.End();
            base.Draw(gameTime);
        }