|
| | RectangleShape (const Vector2f &size=Vector2f(0, 0)) |
| | Default constructor.
|
| void | setSize (const Vector2f &size) |
| | Set the size of the rectangle.
|
| const Vector2f & | getSize () const |
| | Get the size of the rectangle.
|
| virtual std::size_t | getPointCount () const |
| | Get the number of points defining the shape.
|
| virtual Vector2f | getPoint (std::size_t index) const |
| | Get a point of the rectangle.
|
| void | setTexture (const Texture *texture, bool resetRect=false) |
| | Change the source texture of the shape.
|
| void | setTextureRect (const IntRect &rect) |
| | Set the sub-rectangle of the texture that the shape will display.
|
| void | setFillColor (const Color &color) |
| | Set the fill color of the shape.
|
| void | setOutlineColor (const Color &color) |
| | Set the outline color of the shape.
|
| void | setOutlineThickness (float thickness) |
| | Set the thickness of the shape's outline.
|
| const Texture * | getTexture () const |
| | Get the source texture of the shape.
|
| const IntRect & | getTextureRect () const |
| | Get the sub-rectangle of the texture displayed by the shape.
|
| const Color & | getFillColor () const |
| | Get the fill color of the shape.
|
| const Color & | getOutlineColor () const |
| | Get the outline color of the shape.
|
| float | getOutlineThickness () const |
| | Get the outline thickness of the shape.
|
| FloatRect | getLocalBounds () const |
| | Get the local bounding rectangle of the entity.
|
| FloatRect | getGlobalBounds () const |
| | Get the global (non-minimal) bounding rectangle of the entity.
|
| void | setPosition (float x, float y) |
| | set the position of the object
|
| void | setPosition (const Vector2f &position) |
| | set the position of the object
|
| void | setRotation (float angle) |
| | set the orientation of the object
|
| void | setScale (float factorX, float factorY) |
| | set the scale factors of the object
|
| void | setScale (const Vector2f &factors) |
| | set the scale factors of the object
|
| void | setOrigin (float x, float y) |
| | set the local origin of the object
|
| void | setOrigin (const Vector2f &origin) |
| | set the local origin of the object
|
| const Vector2f & | getPosition () const |
| | get the position of the object
|
| float | getRotation () const |
| | get the orientation of the object
|
| const Vector2f & | getScale () const |
| | get the current scale of the object
|
| const Vector2f & | getOrigin () const |
| | get the local origin of the object
|
| void | move (float offsetX, float offsetY) |
| | Move the object by a given offset.
|
| void | move (const Vector2f &offset) |
| | Move the object by a given offset.
|
| void | rotate (float angle) |
| | Rotate the object.
|
| void | scale (float factorX, float factorY) |
| | Scale the object.
|
| void | scale (const Vector2f &factor) |
| | Scale the object.
|
| const Transform & | getTransform () const |
| | get the combined transform of the object
|
| const Transform & | getInverseTransform () const |
| | get the inverse of the combined transform of the object
|
Specialized shape representing a rectangle.
This class inherits all the functions of sf::Transformable (position, rotation, scale, bounds, ...) as well as the functions of sf::Shape (outline, color, texture, ...).
Usage example:
rectangle.
setSize(sf::Vector2f(100, 50));
...
window.draw(rectangle);
static const Color Red
Red predefined color.
Specialized shape representing a rectangle.
void setSize(const Vector2f &size)
Set the size of the rectangle.
void setOutlineColor(const Color &color)
Set the outline color of the shape.
void setOutlineThickness(float thickness)
Set the thickness of the shape's outline.
- See also
- sf::Shape, sf::CircleShape, sf::ConvexShape
Definition at line 41 of file RectangleShape.hpp.
| FloatRect sf::Shape::getGlobalBounds |
( |
| ) |
const |
|
inherited |
Get the global (non-minimal) bounding rectangle of the entity.
The returned rectangle is in global coordinates, which means that it takes into account the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the shape in the global 2D world's coordinate system.
This function does not necessarily return the minimal bounding rectangle. It merely ensures that the returned rectangle covers all the vertices (but possibly more). This allows for a fast approximation of the bounds as a first check; you may want to use more precise checks on top of that.
- Returns
- Global bounding rectangle of the entity
| FloatRect sf::Shape::getLocalBounds |
( |
| ) |
const |
|
inherited |
Get the local bounding rectangle of the entity.
The returned rectangle is in local coordinates, which means that it ignores the transformations (translation, rotation, scale, ...) that are applied to the entity. In other words, this function returns the bounds of the entity in the entity's coordinate system.
- Returns
- Local bounding rectangle of the entity
| void sf::Transformable::setOrigin |
( |
const Vector2f & | origin | ) |
|
|
inherited |
set the local origin of the object
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).
- Parameters
-
- See also
- getOrigin
| void sf::Transformable::setOrigin |
( |
float | x, |
|
|
float | y ) |
|
inherited |
set the local origin of the object
The origin of an object defines the center point for all transformations (position, scale, rotation). The coordinates of this point must be relative to the top-left corner of the object, and ignore all transformations (position, scale, rotation). The default origin of a transformable object is (0, 0).
- Parameters
-
| x | X coordinate of the new origin |
| y | Y coordinate of the new origin |
- See also
- getOrigin