Improve UI

This commit is contained in:
Loic Guegan 2022-12-30 14:55:59 +01:00
parent 109a1bd697
commit eec973bc05
2 changed files with 10 additions and 8 deletions

View file

@ -258,13 +258,15 @@ void BoardCanvas::DrawBoard(wxDC &dc) {
// Draw captures (+player names) first for white then for black // Draw captures (+player names) first for white then for black
std::uint32_t captures_size = t_captures->GetPiecesSizes(); std::uint32_t captures_size = t_captures->GetPiecesSizes();
std::uint8_t padding = numbers_size.y+10; std::uint8_t padding = 10;
std::uint32_t offsetX = 0; std::uint32_t offsetX = 0;
std::uint32_t offsetY = -(captures_size + padding); std::uint32_t offsetY = -(captures_size + padding);
std::uint32_t offsetYPlayerName=offsetY-captures_size; std::uint32_t offsetYPlayerName=offsetY-captures_size-padding; // For top player name we
// White // add -padding at the end (ortherwise bottom of the letters
// are to close to captured pieces)
// White (black's captures):
if (black_side) { if (black_side) {
offsetY = 8 * square_width + padding; offsetY = 8 * square_width + padding + numbers_size.y;
offsetYPlayerName = offsetY+captures_size; offsetYPlayerName = offsetY+captures_size;
} }
for (char p : {'P', 'N', 'B', 'R', 'Q'}) { for (char p : {'P', 'N', 'B', 'R', 'Q'}) {
@ -277,13 +279,13 @@ void BoardCanvas::DrawBoard(wxDC &dc) {
} }
} }
dc.DrawText(wxString(black_player),boardX,boardY + offsetYPlayerName); dc.DrawText(wxString(black_player),boardX,boardY + offsetYPlayerName);
// Black // Black (white's captures):
offsetX = 0; offsetX = 0;
if (black_side) { if (black_side) {
offsetY = -(captures_size + padding); offsetY = -(captures_size + padding);
offsetYPlayerName = offsetY-captures_size; offsetYPlayerName = offsetY-captures_size-padding; // Same for -padding (cf. for black's captures)
} else { } else {
offsetY = 8 * square_width + padding; offsetY = 8 * square_width + padding + numbers_size.y;
offsetYPlayerName = offsetY+captures_size; offsetYPlayerName = offsetY+captures_size;
} }
for (char p : {'p', 'n', 'b', 'r', 'q'}) { for (char p : {'p', 'n', 'b', 'r', 'q'}) {

View file

@ -36,7 +36,7 @@ wxDECLARE_EVENT(NEXT_MOVE_EVENT, wxCommandEvent);
(mouseX >= (x) && mouseX <= ((x) + (width)) && mouseY >= (y) && \ (mouseX >= (x) && mouseX <= ((x) + (width)) && mouseY >= (y) && \
mouseY <= ((y) + (height))) mouseY <= ((y) + (height)))
#define CAPTURE_FACTOR 0.5 #define CAPTURE_FACTOR 0.35
#define SQUARE_NUM_PADDING 5 #define SQUARE_NUM_PADDING 5
typedef std::tuple<short, short, short> ClockTime; typedef std::tuple<short, short, short> ClockTime;