Render the ranks and files on the edge cells, like Lichess does
This commit is contained in:
parent
20b3556031
commit
02352af3d9
2 changed files with 20 additions and 0 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue