示例#1
0
 /// <summary>
 /// Draws the floor of the current view
 /// </summary>
 private void DrawFloorTiles(ISpriteBatch spriteBatch, Rectangle r)
 {
     // draw the floor
     for (int y = r.Top; y < r.Bottom; y++)
         {
         for (int x = r.Left; x < r.Right; x++)
             {
             var tp = new TilePos(x, y);
             Texture2D texture = this._wl[tp].Floor;
             if (texture != null)
                 {
                 Vector2 position = new Vector2(x, y) * Tile.Size;
                 spriteBatch.DrawEntireTexture(texture, position);
                 }
             }
         }
 }
示例#2
0
        private void DrawScoreAndLives(ISpriteBatch spriteBatch)
        {
            var r = new Rectangle(342, 6, 148, 20);
            spriteBatch.DrawRectangle(r, Color.Blue);

            r.Inflate(-2, -2);
            spriteBatch.DrawRectangle(r, Color.Black);

            DrawValue(spriteBatch, this._displayedScore, 416, 8);

            for (int i = 0; i < this._lives; i++)
                {
                Vector2 destination = new Vector2(480 - ((i + 1) * 16), 8) + spriteBatch.WindowOffset;
                spriteBatch.DrawEntireTexture(this._life, destination);
                }
        }