Loading...
Searching...
No Matches
View.h File Reference

Go to the source code of this file.

Functions

sfViewsfView_create (void)
 Create a default view.
 
sfViewsfView_createFromRect (sfFloatRect rectangle)
 Construct a view from a rectangle.
 
sfViewsfView_copy (const sfView *view)
 Copy an existing view.
 
void sfView_destroy (const sfView *view)
 Destroy an existing view.
 
void sfView_setCenter (sfView *view, sfVector2f center)
 Set the center of a view.
 
void sfView_setSize (sfView *view, sfVector2f size)
 Set the size of a view.
 
void sfView_setRotation (sfView *view, float angle)
 Set the orientation of a view.
 
void sfView_setViewport (sfView *view, sfFloatRect viewport)
 Set the target viewport of a view.
 
void sfView_setScissor (sfView *view, sfFloatRect scissor)
 Set the target scissor rectangle.
 
sfVector2f sfView_getCenter (const sfView *view)
 Get the center of a view.
 
sfVector2f sfView_getSize (const sfView *view)
 Get the size of a view.
 
float sfView_getRotation (const sfView *view)
 Get the current orientation of a view.
 
sfFloatRect sfView_getViewport (const sfView *view)
 Get the target viewport rectangle of a view.
 
sfFloatRect sfView_getScissor (const sfView *view)
 Get the scissor rectangle of the view.
 
void sfView_move (sfView *view, sfVector2f offset)
 Move a view relative to its current position.
 
void sfView_rotate (sfView *view, float angle)
 Rotate a view relative to its current orientation.
 
void sfView_zoom (sfView *view, float factor)
 Resize a view rectangle relative to its current size.
 

Function Documentation

◆ sfView_copy()

sfView * sfView_copy ( const sfView view)

Copy an existing view.

Parameters
viewView to copy
Returns
Copied object

◆ sfView_create()

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_createFromRect()

sfView * sfView_createFromRect ( sfFloatRect  rectangle)

Construct a view from a rectangle.

Parameters
rectangleRectangle defining the zone to display
Returns
A new sfView object

◆ sfView_destroy()

void sfView_destroy ( const sfView view)

Destroy an existing view.

Parameters
viewView to destroy

◆ sfView_getCenter()

sfVector2f sfView_getCenter ( const sfView view)

Get the center of a view.

Parameters
viewView object
Returns
Center of the view

◆ sfView_getRotation()

float sfView_getRotation ( const sfView view)

Get the current orientation of a view.

Parameters
viewView object
Returns
Rotation angle of the view, in degrees

◆ sfView_getScissor()

sfFloatRect sfView_getScissor ( const sfView view)

Get the scissor rectangle of the view.

Parameters
viewView object
Returns
Scissor rectangle, expressed as a factor of the target size

◆ sfView_getSize()

sfVector2f sfView_getSize ( const sfView view)

Get the size of a view.

Parameters
viewView object
Returns
Size of the view

◆ sfView_getViewport()

sfFloatRect sfView_getViewport ( const sfView view)

Get the target viewport rectangle of a view.

Parameters
viewView object
Returns
Viewport rectangle, expressed as a factor of the target size

◆ sfView_move()

void sfView_move ( sfView view,
sfVector2f  offset 
)

Move a view relative to its current position.

Parameters
viewView object
offsetOffset

◆ sfView_rotate()

void sfView_rotate ( sfView view,
float  angle 
)

Rotate a view relative to its current orientation.

Parameters
viewView object
angleAngle to rotate, in degrees

◆ sfView_setCenter()

void sfView_setCenter ( sfView view,
sfVector2f  center 
)

Set the center of a view.

Parameters
viewView object
centerNew center

◆ sfView_setRotation()

void sfView_setRotation ( sfView view,
float  angle 
)

Set the orientation of a view.

The default rotation of a view is 0 degree.

Parameters
viewView object
angleNew angle, in degrees

◆ sfView_setScissor()

void sfView_setScissor ( sfView view,
sfFloatRect  scissor 
)

Set the target scissor rectangle.

The scissor rectangle, expressed as a factor (between 0 and 1) of the RenderTarget, specifies the region of the RenderTarget whose pixels are able to be modified by draw or clear operations. Any pixels which lie outside of the scissor rectangle will not be modified by draw or clear operations. For example, a scissor rectangle which only allows modifications to the right side of the target would be defined with sfView_setScissor(view, (sfFloatRect){{0.5f, 0.f}, {0.5f, 1.f}}). By default, a view has a scissor rectangle which allows modifications to the entire target. This is equivalent to disabling the scissor test entirely. Passing the default scissor rectangle to this function will also disable scissor testing.

Parameters
viewView object
scissorNew scissor rectangle

◆ sfView_setSize()

void sfView_setSize ( sfView view,
sfVector2f  size 
)

Set the size of a view.

Parameters
viewView object
sizeNew size of the view

◆ sfView_setViewport()

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
viewView object
viewportNew viewport rectangle

◆ sfView_zoom()

void sfView_zoom ( sfView view,
float  factor 
)

Resize a view rectangle relative 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
viewView object
factorZoom factor to apply