| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- $#include "Rect.h"
- /// Two-dimensional bounding rectangle.
- class Rect
- {
- public:
- /// Construct an undefined rect.
- Rect();
-
- /// Copy-construct from another rect.
- Rect(const Rect& rect);
-
- /// Construct from minimum and maximum vectors.
- Rect(const Vector2& min, const Vector2& max);
-
- /// Construct from coordinates.
- Rect(float left, float top, float right, float bottom);
-
- /// Construct from a Vector4.
- Rect(const Vector4& vector);
- /// Test for equality with another rect.
- bool operator == (const Rect& rhs) const;
-
- /// Define from another rect.
- void Define(const Rect& rect);
-
- /// Define from minimum and maximum vectors.
- void Define(const Vector2& min, const Vector2& max);
-
- /// Define from a point.
- void Define(const Vector2& point);
-
- /// Merge a point.
- void Merge(const Vector2& point);
-
- /// Merge a rect.
- void Merge(const Rect& rect);
-
- /// Clear to undefined state.
- void Clear();
-
- /// Clip with another rect.
- void Clip(const Rect& rect);
-
- /// Return center.
- Vector2 Center() const;
-
- /// Return size.
- Vector2 Size() const;
-
- /// Return half-size.
- Vector2 HalfSize() const;
-
- /// Test for equality with another rect with epsilon.
- bool Equals(const Rect& rhs) const;
-
- /// Return as a vector.
- Vector4 ToVector4() const;
-
- /// Minimum vector.
- Vector2 min_ @ min;
-
- /// Maximum vector.
- Vector2 max_ @ max;
-
- /// Rect in the range (-1, -1) - (1, 1)
- static const Rect FULL;
- /// Rect in the range (0, 0) - (1, 1)
- static const Rect POSITIVE;
- /// Zero-sized rect.
- static const Rect ZERO;
- };
- /// Two-dimensional bounding rectangle with integer values.
- class IntRect
- {
- public:
- /// Construct an undefined rect.
- IntRect();
-
- /// Construct from coordinates.
- IntRect(int left, int top, int right, int bottom);
-
- /// Test for equality with another rect.
- bool operator == (const IntRect& rhs) const;
-
- /// Return size.
- IntVector2 Size() const;
-
- /// Return width.
- int Width() const;
-
- /// Return height.
- int Height() const;
-
- /// Left coordinate.
- int left_ @ left;
-
- /// Top coordinate.
- int top_ @ top;
-
- /// Right coordinate.
- int right_ @ right;
-
- /// Bottom coordinate.
- int bottom_ @ bottom;
-
- /// Zero-sized rect.
- static const IntRect ZERO;
- };
|