Abstract base class for geometric zones. More...
Public Member Functions | |
virtual | ~Zone () |
Virtual destructor. | |
virtual sf::Vector2f | GetRandomPoint () const =0 |
Returns a random point inside the zone (uniformly distributed). | |
virtual Zone * | Clone () const =0 |
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 | |
Zone (sf::Vector2f position, float rotation) | |
Base class constructor. | |
sf::Vector2f | TransformToGlobal (sf::Vector2f point) const |
Transforms a point according to the position and rotation of the zone. |
Abstract base class for geometric zones.
A zone represents an geometric figure on the screen, e.g. a rectangle, circle or just a point. Derive from this class to implement your own zone.
virtual sf::Vector2f thor::Zone::GetRandomPoint | ( | ) | const [pure virtual] |
Returns a random point inside the zone (uniformly distributed).
Implemented in thor::Rectangle, thor::Circle, and thor::Point.
sf::Vector2f thor::Zone::TransformToGlobal | ( | sf::Vector2f | point | ) | const [protected] |
Transforms a point according to the position and rotation of the zone.
point | Point in unit coordinate system with origin (0, 0). |