summaryrefslogtreecommitdiff
path: root/Demos
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-10 10:57:59 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-10 10:59:04 +0200
commit116cf92156090bb3f5c15d5be145f1283884d65d (patch)
tree4496ab3e8c90add1c40da2eceee71324369ec0c6 /Demos
parent656b01eb0fb659fb2d3ee4e6e4413a82543414e3 (diff)
downloadserenity-116cf92156090bb3f5c15d5be145f1283884d65d.zip
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.
Diffstat (limited to 'Demos')
-rw-r--r--Demos/Cube/Cube.cpp2
-rw-r--r--Demos/Eyes/EyesWidget.cpp10
-rw-r--r--Demos/Eyes/EyesWidget.h4
-rw-r--r--Demos/Mouse/main.cpp8
4 files changed, 12 insertions, 12 deletions
diff --git a/Demos/Cube/Cube.cpp b/Demos/Cube/Cube.cpp
index 8cd78d1d12..36faa2deaf 100644
--- a/Demos/Cube/Cube.cpp
+++ b/Demos/Cube/Cube.cpp
@@ -145,7 +145,7 @@ void Cube::timer_event(Core::TimerEvent&)
painter.fill_rect_with_gradient(Gfx::Orientation::Vertical, m_bitmap->rect(), Gfx::Color::White, Gfx::Color::Blue);
auto to_point = [](const FloatVector3& v) {
- return Gfx::Point(v.x(), v.y());
+ return Gfx::IntPoint(v.x(), v.y());
};
for (size_t i = 0; i < sizeof(indices) / sizeof(indices[0]) / 3; i++) {
diff --git a/Demos/Eyes/EyesWidget.cpp b/Demos/Eyes/EyesWidget.cpp
index b26f856daa..036cd8375e 100644
--- a/Demos/Eyes/EyesWidget.cpp
+++ b/Demos/Eyes/EyesWidget.cpp
@@ -64,7 +64,7 @@ void EyesWidget::paint_event(GUI::PaintEvent& event)
void EyesWidget::render_eyeball(int index, GUI::Painter& painter) const
{
auto eye_width = width() / m_num_eyes;
- Gfx::Rect bounds { index * eye_width, 0, eye_width, height() };
+ Gfx::IntRect bounds { index * eye_width, 0, eye_width, height() };
auto width_thickness = max(int(eye_width / 5.5), 1);
auto height_thickness = max(int(height() / 5.5), 1);
@@ -73,12 +73,12 @@ void EyesWidget::render_eyeball(int index, GUI::Painter& painter) const
bounds.shrink(width_thickness, height_thickness);
painter.fill_ellipse(bounds, palette().base());
- Gfx::Point pupil_center = this->pupil_center(bounds);
- Gfx::Size pupil_size {
+ Gfx::IntPoint pupil_center = this->pupil_center(bounds);
+ Gfx::IntSize pupil_size {
bounds.width() / 5,
bounds.height() / 5
};
- Gfx::Rect pupil {
+ Gfx::IntRect pupil {
pupil_center.x() - pupil_size.width() / 2,
pupil_center.y() - pupil_size.height() / 2,
pupil_size.width(),
@@ -88,7 +88,7 @@ void EyesWidget::render_eyeball(int index, GUI::Painter& painter) const
painter.fill_ellipse(pupil, palette().base_text());
}
-Gfx::Point EyesWidget::pupil_center(Gfx::Rect& eyeball_bounds) const
+Gfx::IntPoint EyesWidget::pupil_center(Gfx::IntRect& eyeball_bounds) const
{
auto mouse_vector = m_mouse_position - eyeball_bounds.center();
double dx = mouse_vector.x();
diff --git a/Demos/Eyes/EyesWidget.h b/Demos/Eyes/EyesWidget.h
index 365c69b13a..44505e707e 100644
--- a/Demos/Eyes/EyesWidget.h
+++ b/Demos/Eyes/EyesWidget.h
@@ -46,8 +46,8 @@ private:
virtual void paint_event(GUI::PaintEvent&) override;
void render_eyeball(int index, GUI::Painter&) const;
- Gfx::Point pupil_center(Gfx::Rect& eyeball_bounds) const;
+ Gfx::IntPoint pupil_center(Gfx::IntRect& eyeball_bounds) const;
- Gfx::Point m_mouse_position;
+ Gfx::IntPoint m_mouse_position;
int m_num_eyes { -1 };
};
diff --git a/Demos/Mouse/main.cpp b/Demos/Mouse/main.cpp
index 0bc2b0ad9d..8b4ceb7956 100644
--- a/Demos/Mouse/main.cpp
+++ b/Demos/Mouse/main.cpp
@@ -114,10 +114,10 @@ public:
auto off_x = 80;
auto off_y = 38;
- Gfx::Point p1;
- Gfx::Point p2;
- Gfx::Point p3;
- Gfx::Point p4;
+ Gfx::IntPoint p1;
+ Gfx::IntPoint p2;
+ Gfx::IntPoint p3;
+ Gfx::IntPoint p4;
p1.set_x(radius * cos(M_PI * m_wheel_delta_acc / 18) + off_x);
p1.set_y(radius * sin(M_PI * m_wheel_delta_acc / 18) + off_y);