From a359219e33fdf3afb5ddfbb084563054a947b106 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sat, 12 Feb 2022 19:13:34 +0100 Subject: Create project --- src/Types.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/Types.cpp (limited to 'src/Types.cpp') 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( + static_cast>(lhs) | + static_cast>(rhs)); +} + +bool operator&(Property lhs, Property rhs) { + return (static_cast>(lhs) & + static_cast>(rhs)); +} + +Property &operator|=(Property &lhs, Property rhs) { + return lhs = static_cast( + static_cast>(lhs) | + static_cast>(rhs)); +} + +} // namespace cgeditor \ No newline at end of file -- cgit v1.2.3