diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2020-09-02 11:08:17 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2020-09-02 11:08:17 +0200 |
| commit | 4811afb52c511565d2b13f36ed645243c7557803 (patch) | |
| tree | 3533dc4a8dfb5ed610033e0b9c527a535be6143b /BoardTile.cs | |
board generation
Diffstat (limited to 'BoardTile.cs')
| -rw-r--r-- | BoardTile.cs | 38 |
1 files changed, 38 insertions, 0 deletions
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); + } + } +} |
