#include <View.hpp>
Public Member Functions | |
View (const FloatRect &ViewRect=FloatRect(0, 0, 1000, 1000)) | |
Construct the view from a rectangle. | |
View (const sf::Vector2f &Center, const sf::Vector2f &HalfSize) | |
Construct the view from its center and half-size. | |
void | SetCenter (float X, float Y) |
Change the center of the view (take 2 values). | |
void | SetCenter (const sf::Vector2f &Center) |
Change the center of the view (take a vector). | |
void | SetHalfSize (float HalfWidth, float HalfHeight) |
Change the half-size of the view (take 2 values). | |
void | SetHalfSize (const sf::Vector2f &HalfSize) |
Change the half-size of the view (take a vector). | |
void | SetFromRect (const FloatRect &ViewRect) |
Rebuild the view from a rectangle. | |
const sf::Vector2f & | GetCenter () const |
Get the center of the view. | |
const sf::Vector2f & | GetHalfSize () const |
Get the half-size of the view. | |
const sf::FloatRect & | GetRect () const |
Get the bounding rectangle of the view. | |
void | Move (float OffsetX, float OffsetY) |
Move the view (take 2 values). | |
void | Move (const sf::Vector2f &Offset) |
Move the view (take a vector). | |
void | Zoom (float Factor) |
Resize the view rectangle to simulate a zoom / unzoom effect. | |
Friends | |
class | RenderWindow |
) ; you can consider it as a 2D camera
Definition at line 43 of file View.hpp.
Construct the view from a rectangle.
ViewRect | : Rectangle defining the position and size of the view (1000x1000 by default) |
sf::View::View | ( | const sf::Vector2f & | Center, | |
const sf::Vector2f & | HalfSize | |||
) |
Construct the view from its center and half-size.
Center | : Center of the view | |
HalfSize | : Half-size of the view (from center to corner) |
void sf::View::SetCenter | ( | float | X, | |
float | Y | |||
) |
Change the center of the view (take 2 values).
X | : X coordinate of the new center | |
Y | : Y coordinate of the new center |
void sf::View::SetCenter | ( | const sf::Vector2f & | Center | ) |
Change the center of the view (take a vector).
Center | : New center |
void sf::View::SetHalfSize | ( | float | HalfWidth, | |
float | HalfHeight | |||
) |
Change the half-size of the view (take 2 values).
HalfWidth | : New half-width | |
HalfHeight | : New half-height |
void sf::View::SetHalfSize | ( | const sf::Vector2f & | HalfSize | ) |
Change the half-size of the view (take a vector).
HalfSize | : New half-size |
void sf::View::SetFromRect | ( | const FloatRect & | ViewRect | ) |
Rebuild the view from a rectangle.
ViewRect | : Rectangle defining the position and size of the view |
const sf::Vector2f& sf::View::GetCenter | ( | ) | const |
Get the center of the view.
const sf::Vector2f& sf::View::GetHalfSize | ( | ) | const |
Get the half-size of the view.
const sf::FloatRect& sf::View::GetRect | ( | ) | const |
Get the bounding rectangle of the view.
void sf::View::Move | ( | float | OffsetX, | |
float | OffsetY | |||
) |
Move the view (take 2 values).
OffsetX | : Offset to move the view, on X axis | |
OffsetY | : Offset to move the view, on Y axis |
void sf::View::Move | ( | const sf::Vector2f & | Offset | ) |
Move the view (take a vector).
Offset | : Offset to move the view |
void sf::View::Zoom | ( | float | Factor | ) |
Resize the view rectangle to simulate a zoom / unzoom effect.
Factor | : Zoom factor to apply, relative to the current zoom |