Commit b045b2e3 authored by Rogerborg's avatar Rogerborg

Add IGUIElement::setRelativePosition(const core::position2di &) as requested...

Add IGUIElement::setRelativePosition(const core::position2di &) as requested on IRC.  Trivially tested with a modified example 05.  Also clarified a few comments.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1776 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 24bf94d6
...@@ -83,6 +83,7 @@ public: ...@@ -83,6 +83,7 @@ public:
//! Sets the relative rectangle of this element. //! Sets the relative rectangle of this element.
/** \param r The absolute position to set */
void setRelativePosition(const core::rect<s32>& r) void setRelativePosition(const core::rect<s32>& r)
{ {
if (Parent) if (Parent)
...@@ -105,8 +106,20 @@ public: ...@@ -105,8 +106,20 @@ public:
updateAbsolutePosition(); updateAbsolutePosition();
} }
//! Sets the relative rectangle of this element, maintaining its current width and height
/** \param position The new relative position to set. Width and height will not be changed. */
void setRelativePosition(const core::position2di & position)
{
const core::dimension2di mySize = RelativeRect.getSize();
const core::rect<s32> rectangle(position.X, position.Y,
position.X + mySize.Width, position.Y + mySize.Height);
setRelativePosition(rectangle);
}
//! Sets the relative rectangle of this element.
//! Sets the relative rectangle of this element as a proportion of its parent's area.
/** \param r The rectangle to set, interpreted as a proportion of the parent's area */
void setRelativePosition(const core::rect<f32>& r) void setRelativePosition(const core::rect<f32>& r)
{ {
if (!Parent) if (!Parent)
...@@ -125,8 +138,7 @@ public: ...@@ -125,8 +138,7 @@ public:
updateAbsolutePosition(); updateAbsolutePosition();
} }
//! Gets the absolute rectangle of this element
//! Returns the absolute rectangle of element.
core::rect<s32> getAbsolutePosition() const core::rect<s32> getAbsolutePosition() const
{ {
return AbsoluteRect; return AbsoluteRect;
...@@ -141,6 +153,7 @@ public: ...@@ -141,6 +153,7 @@ public:
//! Sets whether the element will ignore its parent's clipping rectangle //! Sets whether the element will ignore its parent's clipping rectangle
/** \param noClip If true, the element will not be clipped by its parent's clipping rectangle. */
void setNotClipped(bool noClip) void setNotClipped(bool noClip)
{ {
NoClip = noClip; NoClip = noClip;
...@@ -148,6 +161,7 @@ public: ...@@ -148,6 +161,7 @@ public:
//! Gets whether the element will ignore its parent's clipping rectangle //! Gets whether the element will ignore its parent's clipping rectangle
/** \return true if the element is not clipped by its parent's clipping rectangle. */
bool isNotClipped() const bool isNotClipped() const
{ {
return NoClip; return NoClip;
......
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