Exemple #1
0
        // Generic Draw.
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(38f / 255f, 43f / 255f, 68f / 255f));

            if (gamestate == GameState.WelcomeScreen)
            {
                Matrix proj = welcomScreenCamera.GetProjectionMatrix(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

                Matrix n2w = Matrix.CreateTranslation(-welcomeTex.Width * 0.5f, -welcomeTex.Height * 0.5f, 0f);
                _spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, RasterizerState.CullNone, null, n2w * proj);
                _spriteBatch.Draw(welcomeTex, new Vector2(0, 0), Color.White);
                _spriteBatch.End();
            }
            else if (gamestate == GameState.EndScreen)
            {
                Matrix proj = endScreenCamera.GetProjectionMatrix(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

                Matrix n2w = Matrix.CreateTranslation(-gameCompleteTex.Width * 0.5f, -gameCompleteTex.Height * 0.5f, 0f);
                _spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, RasterizerState.CullNone, null, n2w * proj);
                _spriteBatch.Draw(gameCompleteTex, new Vector2(0, 0), Color.White);
                _spriteBatch.End();
            }
            else if (gamestate == GameState.Playing)
            {
                DrawLevel(gameTime);
            }

            base.Draw(gameTime);
        }