Bromeon
Public Member Functions | Protected Member Functions
thor::Rectangle Class Reference

Geometric rectangle class. More...

Inheritance diagram for thor::Rectangle:
Inheritance graph

List of all members.

Public Member Functions

 Rectangle (const sf::FloatRect &rect, float rotation=0.f)
 Constructor from SFML rect.
 Rectangle (sf::Vector2f centerPosition, sf::Vector2f size, float rotation=0.f)
 Constructor from center and size.
 Rectangle (float centerX, float centerY, float width, float height, float rotation=0.f)
 Constructor from center and size.
void SetSize (sf::Vector2f size)
 Returns the size of the rectangle.
sf::Vector2f GetSize () const
 Returns the size of the rectangle.
virtual sf::Vector2f GetRandomPoint () const
 Returns a random point inside the zone (uniformly distributed).
virtual ZoneClone () const
 Returns a copy of the dynamic object type, allocated with the new operator.
void SetPosition (sf::Vector2f position)
 Sets the object's position.
void SetPosition (float x, float y)
 Sets the object's position.
void Move (sf::Vector2f offset)
 Moves the object by a given offset.
void Move (float offsetX, float offsetY)
 Moves the object by a given offset.
sf::Vector2f GetPosition () const
 Returns the object's position.
void SetRotation (float rotation)
 Sets the object's rotation (in degrees).
void Rotate (float angle)
 Add a given angle to the object's rotation (in degrees).
float GetRotation () const
 Returns the object's rotation (in degrees).

Protected Member Functions

sf::Vector2f TransformToGlobal (sf::Vector2f point) const
 Transforms a point according to the position and rotation of the zone.

Detailed Description

Geometric rectangle class.


Constructor & Destructor Documentation

thor::Rectangle::Rectangle ( const sf::FloatRect &  rect,
float  rotation = 0.f 
) [explicit]

Constructor from SFML rect.

Parameters:
rectRectangle to adapt.
rotationInitial rotation of the rectangle.
thor::Rectangle::Rectangle ( sf::Vector2f  centerPosition,
sf::Vector2f  size,
float  rotation = 0.f 
)

Constructor from center and size.

Parameters:
centerPositionPosition of the rectangle's center.
sizeWidth and height of the whole rectangle.
rotationInitial rotation of the rectangle.
thor::Rectangle::Rectangle ( float  centerX,
float  centerY,
float  width,
float  height,
float  rotation = 0.f 
)

Constructor from center and size.

Parameters:
centerX,centerYPosition of the rectangle's center.
width,heightSize of the whole rectangle.
rotationInitial rotation of the rectangle.

Member Function Documentation

virtual sf::Vector2f thor::Rectangle::GetRandomPoint ( ) const [virtual]

Returns a random point inside the zone (uniformly distributed).

Returns:
Point in global coordinate system (translation, rotation already applied).

Implements thor::Zone.

sf::Vector2f thor::Zone::TransformToGlobal ( sf::Vector2f  point) const [protected, inherited]

Transforms a point according to the position and rotation of the zone.

Parameters:
pointPoint in unit coordinate system with origin (0, 0).
Returns:
Point in a coordinate system rotated by the zone's rotation and offset by the zone's position (in this order).

The documentation for this class was generated from the following file: