sf::View Class Reference

This class defines a view (position, size, etc. More...

#include <View.hpp>

List of all members.


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)

Definition at line 37 of file View.cpp.

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)

Definition at line 46 of file View.cpp.


Member Function Documentation

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

Get the center of the view.

Returns:
Center of the view

Definition at line 108 of file View.cpp.

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

Get the half-size of the view.

Returns:
Half-size of the view

Definition at line 117 of file View.cpp.

const sf::FloatRect & sf::View::GetRect (  )  const

Get the bounding rectangle of the view.

Returns:
Bounding rectangle of the view

Definition at line 126 of file View.cpp.

void sf::View::Move ( const sf::Vector2f Offset  ) 

Move the view (take a vector).

Parameters:
Offset : Offset to move the view

Definition at line 150 of file View.cpp.

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

Definition at line 139 of file View.cpp.

void sf::View::SetCenter ( const sf::Vector2f Center  ) 

Change the center of the view (take a vector).

Parameters:
Center : New center

Definition at line 69 of file View.cpp.

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

Definition at line 58 of file View.cpp.

void sf::View::SetFromRect ( const FloatRect ViewRect  ) 

Rebuild the view from a rectangle.

Parameters:
ViewRect : Rectangle defining the position and size of the view

Definition at line 98 of file View.cpp.

void sf::View::SetHalfSize ( const sf::Vector2f HalfSize  ) 

Change the half-size of the view (take a vector).

Parameters:
HalfSize : New half-size

Definition at line 89 of file View.cpp.

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

Definition at line 78 of file View.cpp.

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

Definition at line 159 of file View.cpp.


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