Commit 10021133 authored by hybrid's avatar hybrid

Fix docs.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1667 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 37950db9
...@@ -18,6 +18,9 @@ namespace core ...@@ -18,6 +18,9 @@ namespace core
/** Mostly used by 2D GUI elements and for 2D drawing methods. /** Mostly used by 2D GUI elements and for 2D drawing methods.
It has 2 positions instead of position and dimension and a fast It has 2 positions instead of position and dimension and a fast
method for collision detection with other rectangles and points. method for collision detection with other rectangles and points.
Coordinates are (0,0) for top-left corner, and increasing to the right
and to the bottom.
*/ */
template <class T> template <class T>
class rect class rect
...@@ -88,8 +91,8 @@ namespace core ...@@ -88,8 +91,8 @@ namespace core
} }
//! Returns if a 2d point is within this rectangle. //! Returns if a 2d point is within this rectangle.
//! \param pos: Position to test if it lies within this rectangle. /** \param pos Position to test if it lies within this rectangle.
//! \return Returns true if the position is within the rectangle, false if not. \return True if the position is within the rectangle, false if not. */
bool isPointInside(const position2d<T>& pos) const bool isPointInside(const position2d<T>& pos) const
{ {
return (UpperLeftCorner.X <= pos.X && return (UpperLeftCorner.X <= pos.X &&
...@@ -128,7 +131,7 @@ namespace core ...@@ -128,7 +131,7 @@ namespace core
} }
//! Moves this rectangle to fit inside another one. //! Moves this rectangle to fit inside another one.
//! \return: returns true on success, false if not possible /** \return True on success, false if not possible */
bool constrainTo(const rect<T>& other) bool constrainTo(const rect<T>& other)
{ {
if (other.getWidth() < getWidth() || other.getHeight() < getHeight()) if (other.getWidth() < getWidth() || other.getHeight() < getHeight())
...@@ -177,8 +180,7 @@ namespace core ...@@ -177,8 +180,7 @@ namespace core
return LowerRightCorner.Y - UpperLeftCorner.Y; return LowerRightCorner.Y - UpperLeftCorner.Y;
} }
//! If the lower right corner of the rect is smaller then the //! If the lower right corner of the rect is smaller then the upper left, the points are swapped.
//! upper left, the points are swapped.
void repair() void repair()
{ {
if (LowerRightCorner.X < UpperLeftCorner.X) if (LowerRightCorner.X < UpperLeftCorner.X)
...@@ -196,9 +198,9 @@ namespace core ...@@ -196,9 +198,9 @@ namespace core
} }
} }
//! Returns if the rect is valid to draw. It could be invalid //! Returns if the rect is valid to draw.
//! if the UpperLeftCorner is lower or more right than the /** It would be invalid if the UpperLeftCorner is lower or more
//! LowerRightCorner, or if any dimension is 0. right than the LowerRightCorner. */
bool isValid() const bool isValid() const
{ {
return ((LowerRightCorner.X >= UpperLeftCorner.X) && return ((LowerRightCorner.X >= UpperLeftCorner.X) &&
...@@ -208,7 +210,8 @@ namespace core ...@@ -208,7 +210,8 @@ namespace core
//! Returns the center of the rectangle //! Returns the center of the rectangle
position2d<T> getCenter() const position2d<T> getCenter() const
{ {
return position2d<T>((UpperLeftCorner.X + LowerRightCorner.X) / 2, return position2d<T>(
(UpperLeftCorner.X + LowerRightCorner.X) / 2,
(UpperLeftCorner.Y + LowerRightCorner.Y) / 2); (UpperLeftCorner.Y + LowerRightCorner.Y) / 2);
} }
...@@ -219,18 +222,19 @@ namespace core ...@@ -219,18 +222,19 @@ namespace core
} }
//! Adds a point to the rectangle, causing it to grow bigger, //! Adds a point to the rectangle
//! if point is outside of the box /** Cause the rectangle to grow bigger, if point is outside of
//! \param p: Point to add into the box. the box
\param p Point to add into the box. */
void addInternalPoint(const position2d<T>& p) void addInternalPoint(const position2d<T>& p)
{ {
addInternalPoint(p.X, p.Y); addInternalPoint(p.X, p.Y);
} }
//! Adds a point to the bounding rectangle, causing it to grow bigger, //! Adds a point to the bounding rectangle
//! if point is outside of the box. /** Cause the rectangle to grow bigger, if point is outside of
//! \param x: X Coordinate of the point to add to this box. \param x X Coordinate of the point to add to this box.
//! \param y: Y Coordinate of the point to add to this box. \param y Y Coordinate of the point to add to this box. */
void addInternalPoint(T x, T y) void addInternalPoint(T x, T y)
{ {
if (x>LowerRightCorner.X) if (x>LowerRightCorner.X)
...@@ -244,7 +248,6 @@ namespace core ...@@ -244,7 +248,6 @@ namespace core
UpperLeftCorner.Y = y; UpperLeftCorner.Y = y;
} }
position2d<T> UpperLeftCorner; position2d<T> UpperLeftCorner;
position2d<T> LowerRightCorner; position2d<T> LowerRightCorner;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment