View#
Functions
-
sfView *sfView_create(void)#
Create a default view.
This function creates a default view of (0, 0, 1000, 1000)
- Returns:
A new sfView object
-
sfView *sfView_createFromRect(sfFloatRect rectangle)#
Construct a view from a rectangle.
- Parameters:
rectangle – Rectangle defining the zone to display
- Returns:
A new sfView object
-
sfView *sfView_copy(const sfView *view)#
Copy an existing view.
- Parameters:
view – View to copy
- Returns:
Copied object
-
void sfView_setCenter(sfView *view, sfVector2f center)#
Set the center of a view.
- Parameters:
view – View object
center – New center
-
void sfView_setSize(sfView *view, sfVector2f size)#
Set the size of a view.
- Parameters:
view – View object
size – New size of the view
-
void sfView_setRotation(sfView *view, float angle)#
Set the orientation of a view.
The default rotation of a view is 0 degree.
- Parameters:
view – View object
angle – New angle, in degrees
-
void sfView_setViewport(sfView *view, sfFloatRect viewport)#
Set the target viewport of a view.
The viewport is the rectangle into which the contents of the view are displayed, expressed as a factor (between 0 and 1) of the size of the render target to which the view is applied. For example, a view which takes the left side of the target would be defined by a rect of (0, 0, 0.5, 1). By default, a view has a viewport which covers the entire target.
- Parameters:
view – View object
viewport – New viewport rectangle
-
void sfView_reset(sfView *view, sfFloatRect rectangle)#
Reset a view to the given rectangle.
Note that this function resets the rotation angle to 0.
- Parameters:
view – View object
rectangle – Rectangle defining the zone to display
-
sfVector2f sfView_getCenter(const sfView *view)#
Get the center of a view.
- Parameters:
view – View object
- Returns:
Center of the view
-
sfVector2f sfView_getSize(const sfView *view)#
Get the size of a view.
- Parameters:
view – View object
- Returns:
Size of the view
-
float sfView_getRotation(const sfView *view)#
Get the current orientation of a view.
- Parameters:
view – View object
- Returns:
Rotation angle of the view, in degrees
-
sfFloatRect sfView_getViewport(const sfView *view)#
Get the target viewport rectangle of a view.
- Parameters:
view – View object
- Returns:
Viewport rectangle, expressed as a factor of the target size
-
void sfView_move(sfView *view, sfVector2f offset)#
Move a view relatively to its current position.
- Parameters:
view – View object
offset – Offset
-
void sfView_rotate(sfView *view, float angle)#
Rotate a view relatively to its current orientation.
- Parameters:
view – View object
angle – Angle to rotate, in degrees
-
void sfView_zoom(sfView *view, float factor)#
Resize a view rectangle relatively to its current size.
Resizing the view simulates a zoom, as the zone displayed on screen grows or shrinks. factor is a multiplier:
1 keeps the size unchanged
> 1 makes the view bigger (objects appear smaller)
< 1 makes the view smaller (objects appear bigger)
- Parameters:
view – View object
factor – Zoom factor to apply