예제 #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)
        {
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

            //Clear out the drawlist
            _DrawList.Flush();

            //Add all the grid textures to the drawlist
            Vector2 gridPos = new Vector2(300, 200);

            for (int i = 0; i < 4; i++)
            {
                _DrawList.AddQuad(_Grid.Grids[i], gridPos, _Grid.GridColors[i], Color.White, 0.0f, false, _Grid.Levels[i], 1f);
                gridPos.X += 4;
                gridPos.Y += 4;
            }

            _Renderer.SpriteBatchBegin(BlendState.AlphaBlend, Matrix.Identity);

            _DrawList.Render(_Renderer);

            //Write the current layers
            Vector2 textPos = new Vector2(0, 0);

            for (int i = 0; i < 4; i++)
            {
                string gridText = _Grid.Levels[i].ToString();
                _font.Write(gridText,
                            textPos,
                            Justify.Left,
                            1.0f,
                            _Grid.GridColors[i],
                            _Renderer.SpriteBatch,
                            new GameClock());

                textPos.Y += _font.Font.MeasureString(gridText).Y;
            }

            _Renderer.SpriteBatchEnd();

            base.Draw(gameTime);
        }