mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
Chess+GamesSettings: Give chess pieces some breathing room
Draw pieces around 80% of the size of a square, instead of 100%, so that there is a nice gap around them. This feels more comfy, and makes it actually possible to read the coordinates while a piece is on their square.
This commit is contained in:
parent
7e4186de63
commit
0f2936d8cd
2 changed files with 4 additions and 2 deletions
|
@ -41,6 +41,7 @@ void ChessWidget::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
auto square_width = min_size / 8;
|
||||
auto square_height = min_size / 8;
|
||||
auto square_margin = square_width / 10;
|
||||
int coord_rank_file = (side() == Chess::Color::White) ? 0 : 7;
|
||||
|
||||
Chess::Board& active_board = (m_playback ? board_playback() : board());
|
||||
|
@ -84,7 +85,7 @@ void ChessWidget::paint_event(GUI::PaintEvent& event)
|
|||
if (!(m_dragging_piece && sq == m_moving_square)) {
|
||||
auto bmp = m_pieces.get(active_board.get_piece(sq));
|
||||
if (bmp.has_value()) {
|
||||
painter.draw_scaled_bitmap(tile_rect, *bmp.value(), bmp.value()->rect(), 1.0f, Gfx::Painter::ScalingMode::BilinearBlend);
|
||||
painter.draw_scaled_bitmap(tile_rect.shrunken(square_margin, square_margin, square_margin, square_margin), *bmp.value(), bmp.value()->rect(), 1.0f, Gfx::Painter::ScalingMode::BilinearBlend);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue