From 4811afb52c511565d2b13f36ed645243c7557803 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Wed, 2 Sep 2020 11:08:17 +0200 Subject: board generation --- BoardTile.cs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 BoardTile.cs (limited to 'BoardTile.cs') diff --git a/BoardTile.cs b/BoardTile.cs new file mode 100644 index 0000000..1bccbec --- /dev/null +++ b/BoardTile.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Chess +{ + public enum BoardTileColor + { + White, + Black, + } + + public class BoardTile + { + public int X; + public int Y; + public BoardTileColor Color; + public ChessPiece OccupyingPiece; + https://git.fhict.nl/I436104/chess + public BoardTile(int x, int y, BoardTileColor color) + { + X = x; + Y = y; + Color = color; + OccupyingPiece = null; + } + + internal void Draw(Graphics graphics, float tileWidth, float tileHeight) + { + graphics.FillRectangle(new SolidBrush(this.Color == BoardTileColor.White ? System.Drawing.Color.White : System.Drawing.Color.Black), new RectangleF(X * tileWidth, Y * tileHeight, tileWidth, tileHeight)); + + OccupyingPiece?.Draw(graphics, X, Y, tileWidth, tileHeight); + } + } +} -- cgit v1.2.3-70-g09d2