aboutsummaryrefslogtreecommitdiff
path: root/src/Types.cpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-02-12 19:13:34 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2022-02-12 19:13:34 +0100
commita359219e33fdf3afb5ddfbb084563054a947b106 (patch)
tree91dab9c21321f73152993183cd6e8cf4a04017f8 /src/Types.cpp
Create project
Diffstat (limited to 'src/Types.cpp')
-rw-r--r--src/Types.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Types.cpp b/src/Types.cpp
new file mode 100644
index 0000000..76bf398
--- /dev/null
+++ b/src/Types.cpp
@@ -0,0 +1,29 @@
+#include "Types.hpp"
+
+namespace cgeditor {
+
+bool Element::IsOver(const double &X, const double &Y) const {
+ if (width < 0) {
+ return (x >= x && Y >= y && Y <= (y + height));
+ }
+ return ((X >= x && X <= (x + width) && Y >= y && Y <= (y + height)));
+}
+
+Property operator|(Property lhs, Property rhs) {
+ return static_cast<Property>(
+ static_cast<std::underlying_type_t<Property>>(lhs) |
+ static_cast<std::underlying_type_t<Property>>(rhs));
+}
+
+bool operator&(Property lhs, Property rhs) {
+ return (static_cast<std::underlying_type_t<Property>>(lhs) &
+ static_cast<std::underlying_type_t<Property>>(rhs));
+}
+
+Property &operator|=(Property &lhs, Property rhs) {
+ return lhs = static_cast<Property>(
+ static_cast<std::underlying_type_t<Property>>(lhs) |
+ static_cast<std::underlying_type_t<Property>>(rhs));
+}
+
+} // namespace cgeditor \ No newline at end of file