aboutsummaryrefslogtreecommitdiff
path: root/src/Types.cpp
diff options
context:
space:
mode:
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