Point.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "Point.h"
  2. #ifdef WIN32
  3. # include "Screen.h"
  4. # include "Window.h"
  5. #endif
  6. using namespace Framework;
  7. // other functions
  8. #ifdef WIN32
  9. inline Point Framework::ScreenSize(int mId) // Returns the screen size
  10. {
  11. Monitor m = getMonitor(mId);
  12. return Point(m.Width, m.height);
  13. }
  14. inline Point Framework::ScreenCenter(int mId) // Returns the screen center
  15. {
  16. Monitor m = getMonitor(mId);
  17. return Point(m.x + m.Width / 2, m.y + m.height / 2);
  18. }
  19. inline Point Framework::ScreenCenter(
  20. NativeWindow* f, int mId) // Returns the screen center
  21. {
  22. Point p = ScreenCenter(mId);
  23. Point p2 = f->getSize();
  24. f->release();
  25. return {p.x - p2.x / 2, p.y - p2.y / 2};
  26. }
  27. #endif
  28. bool Framework::operator>(
  29. const Point& a, const Point& b) // Indicates whether a > b
  30. {
  31. return a.x > b.x && a.y > b.y;
  32. }
  33. bool Framework::operator<(
  34. const Point& a, const Point& b) // Indicates whether a < b
  35. {
  36. return a.x < b.x && a.y < b.y;
  37. }
  38. bool Framework::operator<=(
  39. const Point& a, const Point& b) // Indicates whether a <= b
  40. {
  41. return a.x <= b.x && a.y <= b.y;
  42. }
  43. bool Framework::operator>=(
  44. const Point& a, const Point& b) // Indicates whether a >= b
  45. {
  46. return a.x >= b.x && a.y >= b.y;
  47. }