예제 #1
0
 public void DrawWall(MazeCellDTO wall, int x, int y)
 {
     if (wall.WallsState.HasFlag(TileWallsState.Top))
     {
         graphics.DrawLine(
             pen,
             new Point(TopLeftCorner.X + x * TileSize.Width, TopLeftCorner.Y + y * TileSize.Height),
             new Point(TopLeftCorner.X + (x + 1) * TileSize.Width, TopLeftCorner.Y + y * TileSize.Height)
             );
     }
     if (wall.WallsState.HasFlag(TileWallsState.Left))
     {
         graphics.DrawLine(
             pen,
             new Point(TopLeftCorner.X + x * TileSize.Width, TopLeftCorner.Y + y * TileSize.Height),
             new Point(TopLeftCorner.X + x * TileSize.Width, TopLeftCorner.Y + (y + 1) * TileSize.Height)
             );
     }
     if (wall.WallsState.HasFlag(TileWallsState.Bottom))
     {
         graphics.DrawLine(
             pen,
             new Point(TopLeftCorner.X + x * TileSize.Width, TopLeftCorner.Y + (y + 1) * TileSize.Height),
             new Point(TopLeftCorner.X + (x + 1) * TileSize.Width, TopLeftCorner.Y + (y + 1) * TileSize.Height)
             );
     }
     if (wall.WallsState.HasFlag(TileWallsState.Right))
     {
         graphics.DrawLine(
             pen,
             new Point(TopLeftCorner.X + (x + 1) * TileSize.Width, TopLeftCorner.Y + y * TileSize.Height),
             new Point(TopLeftCorner.X + (x + 1) * TileSize.Width, TopLeftCorner.Y + (y + 1) * TileSize.Height)
             );
     }
 }
예제 #2
0
        public void DrawTile(MazeCellDTO cell, int x, int y)
        {
            Image image = Image.FromFile(tileDictionary[cell.TileType]);

            graphics.DrawImage(image, TopLeftCorner.X + x * TileSize.Width, TopLeftCorner.Y + y * TileSize.Height, TileSize.Width, TileSize.Height);
        }