56 #ifndef FIFE_VIDEO_RECT_H
57 #define FIFE_VIDEO_RECT_H
108 :
x(static_cast<T>(r.
x)),
109 y(static_cast<T>(r.
y)),
110 w(static_cast<T>(r.
w)),
111 h(static_cast<T>(r.
h)) {
160 std::ostream& operator<<(std::ostream& os, const RectType<T>& r) {
162 os <<
"("<<r.x<<
","<<r.y<<
")-("<<r.w<<
","<<r.h<<
")";
180 x == rect.
x && y == rect.
y && w == rect.
w && h == rect.
h;
186 (((point.
x >= x) && (point.
x <= x + w))
187 && ((point.
y >= y) && (point.
y <= y + h)));
207 if (x + w > rectangle.
w) {
211 if (y + h > rectangle.
h) {
218 if (w <= 0 || h <= 0) {
228 T _x = x - rectangle.
x;
229 T _y = y - rectangle.
y;
244 if (_x + _w > rectangle.
w) {
245 _w = rectangle.
w - _x;
248 if (_y + _h > rectangle.
h) {
249 _h = rectangle.
h - _y;
252 if (_w <= 0 || _h <= 0) {
RectType< double > DoubleRect
T h
Height of the rectangle.
bool operator==(const RectType< T > &rect) const
Equivalence operator.
bool contains(const PointType2D< T > &point) const
Checks whether a rectangle contains a Point.
bool intersectInplace(const RectType< T > &rect)
Calculate rectangle intersection in place.
RectType(T x=0, T y=0, T w=0, T h=0)
Constructor.
T bottom() const
The Y coordinate of the bottom edge.
RectType(const RectType< U > &r)
Constructor.
T right() const
The X coordinate of the right edge.
bool intersects(const RectType< T > &rect) const
Check whether two rectangles share some area.
RectType< float > FloatRect
T w
Width of the rectangle.