Exemple #1
0
        public void Draw()
        {
            IRenderService rs = GameService.GetService <IRenderService>();

            Vector2   projectedPosition = backingBox.GetFullProjectedPosition2();
            Rectangle bounds            = new Rectangle(
                (int)projectedPosition.X,
                (int)projectedPosition.Y,
                Width * TileSize,
                (Height + Depth) * TileSize
                );
            Rectangle plotter = new Rectangle(bounds.Left, bounds.Top, TileSize, TileSize);

            foreach (BlockFace face in Tiles)
            {
                if (!face.Equals(BlockFace.Empty))
                {
                    rs.DrawQuad(
                        face.TextureKey,
                        plotter,
                        new Rectangle(face.SourceX, face.SourceY, TileSize, TileSize)
                        );
                }
                plotter.X += TileSize;
                if (plotter.X >= bounds.Right)
                {
                    plotter.X  = bounds.Left;
                    plotter.Y += TileSize;
                }
            }
        }