From eec973bc05c0a7e0c511b392704c6d093c2820b4 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Fri, 30 Dec 2022 14:55:59 +0100 Subject: Improve UI --- src/game_tab/left_panel/board/BoardCanvas.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/game_tab/left_panel/board/BoardCanvas.cpp') diff --git a/src/game_tab/left_panel/board/BoardCanvas.cpp b/src/game_tab/left_panel/board/BoardCanvas.cpp index 47b7661..024455e 100644 --- a/src/game_tab/left_panel/board/BoardCanvas.cpp +++ b/src/game_tab/left_panel/board/BoardCanvas.cpp @@ -258,13 +258,15 @@ void BoardCanvas::DrawBoard(wxDC &dc) { // Draw captures (+player names) first for white then for black 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 offsetY = -(captures_size + padding); - std::uint32_t offsetYPlayerName=offsetY-captures_size; - // White + std::uint32_t offsetYPlayerName=offsetY-captures_size-padding; // For top player name we + // add -padding at the end (ortherwise bottom of the letters + // are to close to captured pieces) + // White (black's captures): if (black_side) { - offsetY = 8 * square_width + padding; + offsetY = 8 * square_width + padding + numbers_size.y; offsetYPlayerName = offsetY+captures_size; } 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); - // Black + // Black (white's captures): offsetX = 0; if (black_side) { offsetY = -(captures_size + padding); - offsetYPlayerName = offsetY-captures_size; + offsetYPlayerName = offsetY-captures_size-padding; // Same for -padding (cf. for black's captures) } else { - offsetY = 8 * square_width + padding; + offsetY = 8 * square_width + padding + numbers_size.y; offsetYPlayerName = offsetY+captures_size; } for (char p : {'p', 'n', 'b', 'r', 'q'}) { -- cgit v1.2.3