Code: Select all
//! Sets the relative rectangle of this element.
void setRelativePosition(const core::rect<s32>& r)
//! Sets the relative rectangle of this element.
void setRelativePosition(const core::rect<f32>& r)
If you said "setRelativePosition(const core::rect<f32>& r) sets the element's position and size as a proportion of its parent's size then congratulations: you are either psychic, or you wrote the method.
We could comment that method to explain what it does, but it still wouldn't be obvious. Instead, I suggest that we deliberately break it, and rename it to:
Code: Select all
//! 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.
Meaningful values are in the range [0...1], unless you intend this element to spill
outside its parent. */
void setProportionalPosition(const core::rect<f32>& r)