Documentation of SFML 1.6

Warning: this page refers to an old version of SFML. Click here to switch to the latest version.
sf::View Class Reference

This class defines a view (position, size, etc.) ; you can consider it as a 2D camera. More...

#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::Vector2fGetCenter () const
 Get the center of the view.
 
const sf::Vector2fGetHalfSize () const
 Get the half-size of the view.
 
const sf::FloatRectGetRect () 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 RenderTarget
 

Detailed Description

This class defines a view (position, size, etc.) ; you can consider it as a 2D camera.

Definition at line 45 of file View.hpp.

Constructor & Destructor Documentation

sf::View::View ( const FloatRect ViewRect = FloatRect(0, 0, 1000, 1000))
explicit

Construct the view from a rectangle.

Parameters
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.

Parameters
Center: Center of the view
HalfSize: Half-size of the view (from center to corner)

Member Function Documentation

const sf::Vector2f& sf::View::GetCenter ( ) const

Get the center of the view.

Returns
Center of the view
const sf::Vector2f& sf::View::GetHalfSize ( ) const

Get the half-size of the view.

Returns
Half-size of the view
const sf::FloatRect& sf::View::GetRect ( ) const

Get the bounding rectangle of the view.

Returns
Bounding rectangle of the view
void sf::View::Move ( float  OffsetX,
float  OffsetY 
)

Move the view (take 2 values)

Parameters
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)

Parameters
Offset: Offset to move the view
void sf::View::SetCenter ( float  X,
float  Y 
)

Change the center of the view (take 2 values)

Parameters
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)

Parameters
Center: New center
void sf::View::SetFromRect ( const FloatRect ViewRect)

Rebuild the view from a rectangle.

Parameters
ViewRect: Rectangle defining the position and size of the view
void sf::View::SetHalfSize ( float  HalfWidth,
float  HalfHeight 
)

Change the half-size of the view (take 2 values)

Parameters
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)

Parameters
HalfSize: New half-size
void sf::View::Zoom ( float  Factor)

Resize the view rectangle to simulate a zoom / unzoom effect.

Parameters
Factor: Zoom factor to apply, relative to the current zoom

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