56 #ifndef FIFE_VIDEO_RECT_H 57 #define FIFE_VIDEO_RECT_H 99 explicit RectType(T x = 0, T y = 0, T w = 0, T h = 0) : x(x), y(y), w(w), h(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 intersectInplace(const RectType< T > &rect)
Calculate rectangle intersection in place.
RectType(T x=0, T y=0, T w=0, T h=0)
Constructor.
bool contains(const PointType2D< T > &point) const
Checks whether a rectangle contains a Point.
bool operator==(const RectType< T > &rect) const
Equivalence operator.
bool intersects(const RectType< T > &rect) const
Check whether two rectangles share some area.
RectType(const RectType< U > &r)
Constructor.
T right() const
The X coordinate of the right edge.
RectType< float > FloatRect
T w
Width of the rectangle.
T bottom() const
The Y coordinate of the bottom edge.