From 654c94e1d312970413e376214b11bd554040d30f Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 21 Apr 2023 22:52:28 +0200 Subject: Replaced Mouse dragging start+pos combo with a Rect --- engine/include/kurator/engine/Point.h | 1 + engine/include/kurator/engine/Rect.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 engine/include/kurator/engine/Rect.h (limited to 'engine/include') diff --git a/engine/include/kurator/engine/Point.h b/engine/include/kurator/engine/Point.h index 4b352d6..eecf2c6 100644 --- a/engine/include/kurator/engine/Point.h +++ b/engine/include/kurator/engine/Point.h @@ -23,6 +23,7 @@ struct Point Point subtract(double _x, double _y) const; bool operator==(const Point& other) const; bool operator!=(const Point& other) const; + friend Point abs(const Point& point); }; diff --git a/engine/include/kurator/engine/Rect.h b/engine/include/kurator/engine/Rect.h new file mode 100644 index 0000000..d485937 --- /dev/null +++ b/engine/include/kurator/engine/Rect.h @@ -0,0 +1,27 @@ +#pragma once + +#include "Point.h" + + +namespace kurator +{ +namespace engine +{ + + +struct Rect +{ + Rect(); + Rect(const Point& first, const Point& second); + Point position; + Point size; + Point topleft() const; + Point bottomright() const; + Point center() const; + bool contains(const Point& point); + bool contains(const Point& circle, double radius); +}; + + +} // namespace engine +} // namespace kurator -- cgit v1.1