Merge branch 'pr/133' into Dev

This commit is contained in:
Sebastian Lague 2023-07-22 13:24:19 +02:00
commit 1e33246f21
2 changed files with 20 additions and 0 deletions

View file

@ -23,6 +23,9 @@ namespace ChessChallenge.Application
public Color CheckDark = new Color(207, 39, 39, 255); public Color CheckDark = new Color(207, 39, 39, 255);
public Color BorderCol = new Color(44, 44, 44, 255); public Color BorderCol = new Color(44, 44, 44, 255);
public Color LightCoordCol = new Color(255, 240, 220, 255);
public Color DarkCoordCol = new Color(140, 100, 80, 255);
} }
} }

View file

@ -318,6 +318,23 @@ namespace ChessChallenge.Application
{ {
DrawPiece(piece, new Vector2((int)pos.X, (int)pos.Y), alpha); DrawPiece(piece, new Vector2((int)pos.X, (int)pos.Y), alpha);
} }
int textSize = 25;
float xpadding = 5f, ypadding = 2f;
Color otherColor = coord.IsLightSquare() ? theme.DarkCoordCol : theme.LightCoordCol;
if (rank == 0) {
string fileLetter = "abcdefgh"[file].ToString();
UIHelper.DrawText(fileLetter,
pos + new Vector2(xpadding, squareSize - ypadding),
textSize, 123, otherColor,
UIHelper.AlignH.Left, UIHelper.AlignV.Bottom);
}
if (file == 7) {
UIHelper.DrawText((rank + 1).ToString(),
pos + new Vector2(squareSize - xpadding, ypadding),
textSize, 123, otherColor,
UIHelper.AlignH.Right, UIHelper.AlignV.Top);
}
} }
Vector2 GetSquarePos(int file, int rank, bool whitePerspective) Vector2 GetSquarePos(int file, int rank, bool whitePerspective)