aboutsummaryrefslogtreecommitdiff
path: root/src/Types.cpp
blob: accc99c4808ea73aa5f0ba40421e7b564197f07c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "Types.hpp"

namespace cgeditor {

bool Element::IsOver(const double &X, const double &Y) const {
  // Check if no overlap
  if(X<x|| X>(x+width) || Y<y || Y>(y+height))
    return false;
  return true;
}

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