ShishGL  1.0
A simple modular cross-platform graphics library
Frame.hpp
Go to the documentation of this file.
1 /*============================================================================*/
2 #ifndef SHISHGL_FRAME_HPP
3 #define SHISHGL_FRAME_HPP
4 /*============================================================================*/
5 #include "Vector2.hpp"
6 /*============================================================================*/
7 namespace Sh {
8 
9  struct Frame {
10 
13 
14  void fit_into(const Frame& other);
15 
16  [[nodiscard]]
17  Vector2<double> remap(const Vector2<double>& point) const;
18 
19  [[nodiscard]]
20  bool contains(const Vector2<double>& point) const {
21  return (pos.x <= point.x && point.x <= pos.x + size.x &&
22  pos.y <= point.y && point.y <= pos.y + size.y);
23  }
24  };
25 
26 }
27 /*============================================================================*/
28 #endif //SHISHGL_FRAME_HPP
29 /*============================================================================*/
Vector2.hpp
Sh::Vector2::x
T x
Definition: Vector2.hpp:10
Sh::Frame
Definition: Frame.hpp:9
Sh::Vector2< double >
Sh::Vector2::y
T y
Definition: Vector2.hpp:10
Sh::Frame::contains
bool contains(const Vector2< double > &point) const
Definition: Frame.hpp:20
Sh::Frame::fit_into
void fit_into(const Frame &other)
Definition: Frame.cpp:7
Sh
Definition: CoreApplication.hpp:10
Sh::Frame::size
Vector2< double > size
Definition: Frame.hpp:12
Sh::Frame::pos
Vector2< double > pos
Definition: Frame.hpp:11
Sh::Frame::remap
Vector2< double > remap(const Vector2< double > &point) const
Definition: Frame.cpp:25