1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize

This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
This commit is contained in:
Andreas Kling 2020-06-10 10:57:59 +02:00
parent 656b01eb0f
commit 116cf92156
212 changed files with 1144 additions and 1144 deletions

View file

@ -92,13 +92,13 @@ void SnakeGame::spawn_fruit()
m_fruit_type = rand() % m_fruit_bitmaps.size();
}
Gfx::Rect SnakeGame::score_rect() const
Gfx::IntRect SnakeGame::score_rect() const
{
int score_width = font().width(m_score_text);
return { width() - score_width - 2, height() - font().glyph_height() - 2, score_width, font().glyph_height() };
}
Gfx::Rect SnakeGame::high_score_rect() const
Gfx::IntRect SnakeGame::high_score_rect() const
{
int high_score_width = font().width(m_high_score_text);
return { 2, height() - font().glyph_height() - 2, high_score_width, font().glyph_height() };
@ -197,10 +197,10 @@ void SnakeGame::keydown_event(GUI::KeyEvent& event)
}
}
Gfx::Rect SnakeGame::cell_rect(const Coordinate& coord) const
Gfx::IntRect SnakeGame::cell_rect(const Coordinate& coord) const
{
auto game_rect = rect();
auto cell_size = Gfx::Size(game_rect.width() / m_columns, game_rect.height() / m_rows);
auto cell_size = Gfx::IntSize(game_rect.width() / m_columns, game_rect.height() / m_rows);
return {
coord.column * cell_size.width(),
coord.row * cell_size.height(),
@ -220,10 +220,10 @@ void SnakeGame::paint_event(GUI::PaintEvent& event)
auto rect = cell_rect(part);
painter.fill_rect(rect, Color::from_rgb(0xaaaa00));
Gfx::Rect left_side(rect.x(), rect.y(), 2, rect.height());
Gfx::Rect top_side(rect.x(), rect.y(), rect.width(), 2);
Gfx::Rect right_side(rect.right() - 1, rect.y(), 2, rect.height());
Gfx::Rect bottom_side(rect.x(), rect.bottom() - 1, rect.width(), 2);
Gfx::IntRect left_side(rect.x(), rect.y(), 2, rect.height());
Gfx::IntRect top_side(rect.x(), rect.y(), rect.width(), 2);
Gfx::IntRect right_side(rect.right() - 1, rect.y(), 2, rect.height());
Gfx::IntRect bottom_side(rect.x(), rect.bottom() - 1, rect.width(), 2);
painter.fill_rect(left_side, Color::from_rgb(0xcccc00));
painter.fill_rect(right_side, Color::from_rgb(0x888800));
painter.fill_rect(top_side, Color::from_rgb(0xcccc00));