|
| template<class S> |
| static void | centerHorizontally (const sf::FloatRect &bounds, S &obj) |
| | Center obj horizontally within bounds.
|
| template<class S, class U> |
| static void | centerHorizontally (const sf::Vector2< U > &size, S &obj) |
| | Center obj horizontally within a size-defined region.
|
| template<class T, class S> |
| static void | centerHorizontally (const T &constObj, S &obj) |
| | Center obj horizontally within constObj (vertical position unchanged).
|
| template<class S> |
| static void | centerOn (const sf::FloatRect &bounds, S &obj) |
| | Center obj within bounds (both axes).
|
| template<class S, class U> |
| static void | centerOn (const sf::Vector2< U > &size, S &obj) |
| | Center obj within a size-defined region (both axes).
|
| template<class T, class S> |
| static void | centerOn (const T &constObj, S &obj) |
| | Center obj both horizontally and vertically within constObj.
|
| template<class T> |
| static void | centerText (const T &obj, sf::Text &text) |
| | Center text within the bounds of obj.
|
| template<class S> |
| static void | centerVertically (const sf::FloatRect &bounds, S &obj) |
| | Center obj vertically within bounds.
|
| template<class S, class U> |
| static void | centerVertically (const sf::Vector2< U > &size, S &obj) |
| | Center obj vertically within a size-defined region.
|
| template<class T, class S> |
| static void | centerVertically (const T &constObj, S &obj) |
| | Center obj vertically within constObj (horizontal position unchanged).
|
| template<class S> |
| static void | setAbove (const sf::FloatRect &bounds, S &obj, float spacing=0) |
| | Place obj above bounds.
|
| template<class S, class U> |
| static void | setAbove (const sf::Vector2< U > &size, S &obj, float spacing=0) |
| | Place obj above a size-defined region.
|
| template<class T, class S> |
| static void | setAbove (const T &constObj, S &obj, float spacing=0) |
| | Place obj immediately above constObj.
|
| template<class S> |
| static void | setBelow (const sf::FloatRect &bounds, S &obj, float spacing=0) |
| | Place obj below bounds.
|
| template<class S, class U> |
| static void | setBelow (const sf::Vector2< U > &size, S &obj, float spacing=0) |
| | Place obj below a size-defined region.
|
| template<class T, class S> |
| static void | setBelow (const T &constObj, S &obj, float spacing=0) |
| | Place obj immediately below constObj.
|
| template<class S> |
| static void | setLeftOf (const sf::FloatRect &bounds, S &obj, float spacing=0) |
| | Place obj to the left of bounds.
|
| template<class S, class U> |
| static void | setLeftOf (const sf::Vector2< U > &size, S &obj, float spacing=0) |
| | Place obj to the left of a size-defined region.
|
| template<class T, class S> |
| static void | setLeftOf (const T &constObj, S &obj, float spacing=0) |
| | Place obj immediately to the left of constObj.
|
| template<class S> |
| static void | setRightOf (const sf::FloatRect &bounds, S &obj, float spacing=0) |
| | Place obj to the right of bounds.
|
| template<class S, class U> |
| static void | setRightOf (const sf::Vector2< U > &size, S &obj, float spacing=0) |
| | Place obj to the right of a region defined by size.
|
| template<class T, class S> |
| static void | setRightOf (const T &constObj, S &obj, float spacing=0) |
| | Place obj immediately to the right of constObj.
|
Static layout helpers for positioning objects relative to one another.
Align provides a uniform set of spatial operations that work against three kinds of reference:
- Framework object
T — any type with getGlobalBounds()
sf::FloatRect — a raw bounding rectangle
sf::Vector2 — treated as a size (width × height) anchored at the origin
Each operation calls setPosition on the target object S, so S must provide setPosition(sf::Vector2f) and getGlobalBounds().
These are the static equivalents of the instance methods on Positionable. Use Align when the reference object is not a Positionable (e.g., a raw sf::FloatRect from a window size or a texture region).
Usage
static void setRightOf(const T &constObj, S &obj, float spacing=0)
Place obj immediately to the right of constObj.
static void centerOn(const T &constObj, S &obj)
Center obj both horizontally and vertically within constObj.
static void centerHorizontally(const T &constObj, S &obj)
Center obj horizontally within constObj (vertical position unchanged).
static void centerText(const T &obj, sf::Text &text)
Center text within the bounds of obj.
Vector2< float > Vector2f
- See also
- Positionable
Definition at line 54 of file Align.h.