CSFML - C binding of the Simple and Fast Multimedia Library

CSFML 3.0.0

- Main Page
- Classes
- Files

- File List
- File Members

Loading...
Searching...
No Matches
Functions
RenderWindow.h File Reference
`#include <CSFML/Graphics/Export.h>`
`#include <CSFML/Graphics/Color.h>`
`#include <CSFML/Graphics/PrimitiveType.h>`
`#include <CSFML/Graphics/Rect.h>`
`#include <CSFML/Graphics/RenderStates.h>`
`#include <CSFML/Graphics/StencilMode.h>`
`#include <CSFML/Graphics/Types.h>`
`#include <CSFML/Graphics/Vertex.h>`
`#include <CSFML/System/Time.h>`
`#include <CSFML/System/Vector2.h>`
`#include <CSFML/Window/Event.h>`
`#include <CSFML/Window/VideoMode.h>`
`#include <CSFML/Window/Window.h>`
`#include <CSFML/Window/WindowHandle.h>`
`#include <stddef.h>`

Go to the source code of this file.

## Functions
sfRenderWindow * | sfRenderWindow_create (sfVideoMode mode, const char *title, uint32_t style, sfWindowState state, const sfContextSettings *settings)
| Construct a new render window.
sfRenderWindow * | sfRenderWindow_createUnicode (sfVideoMode mode, const sfChar32 *title, uint32_t style, sfWindowState state, const sfContextSettings *settings)
| Construct a new render window (with a UTF-32 title)
sfRenderWindow * | sfRenderWindow_createFromHandle (sfWindowHandle handle, const sfContextSettings *settings)
| Construct a render window from an existing control.
void | sfRenderWindow_destroy (const sfRenderWindow *renderWindow)
| Destroy an existing render window.
void | sfRenderWindow_close (sfRenderWindow *renderWindow)
| Close a render window (but doesn't destroy the internal data)
bool | sfRenderWindow_isOpen (const sfRenderWindow *renderWindow)
| Tell whether or not a render window is opened.
sfContextSettings | sfRenderWindow_getSettings (const sfRenderWindow *renderWindow)
| Get the creation settings of a render window.
bool | sfRenderWindow_pollEvent (sfRenderWindow *renderWindow, sfEvent *event)
| Pop the event on top of event queue, if any, and return it.
bool | sfRenderWindow_waitEvent (sfRenderWindow *renderWindow, sfTime timeout, sfEvent *event)
| Wait for an event and return it.
sfVector2i | sfRenderWindow_getPosition (const sfRenderWindow *renderWindow)
| Get the position of a render window.
void | sfRenderWindow_setPosition (sfRenderWindow *renderWindow, sfVector2i position)
| Change the position of a render window on screen.
sfVector2u | sfRenderWindow_getSize (const sfRenderWindow *renderWindow)
| Get the size of the rendering region of a render window.
bool | sfRenderWindow_isSrgb (const sfRenderWindow *renderWindow)
| Tell if the render window will use sRGB encoding when drawing on it.
void | sfRenderWindow_setSize (sfRenderWindow *renderWindow, sfVector2u size)
| Change the size of the rendering region of a render window.
void | sfRenderWindow_setTitle (sfRenderWindow *renderWindow, const char *title)
| Change the title of a render window.
void | sfRenderWindow_setUnicodeTitle (sfRenderWindow *renderWindow, const sfChar32 *title)
| Change the title of a render window (with a UTF-32 string)
void | sfRenderWindow_setIcon (sfRenderWindow *renderWindow, sfVector2u size, const uint8_t *pixels)
| Change a render window's icon.
void | sfRenderWindow_setVisible (sfRenderWindow *renderWindow, bool visible)
| Show or hide a render window.
void | sfRenderWindow_setVerticalSyncEnabled (sfRenderWindow *renderWindow, bool enabled)
| Enable / disable vertical synchronization on a render window.
void | sfRenderWindow_setMouseCursorVisible (sfRenderWindow *renderWindow, bool show)
| Show or hide the mouse cursor on a render window.
void | sfRenderWindow_setMouseCursorGrabbed (sfRenderWindow *renderWindow, bool grabbed)
| Grab or release the mouse cursor.
void | sfRenderWindow_setMouseCursor (sfRenderWindow *renderWindow, const sfCursor *cursor)
| Set the displayed cursor to a native system cursor.
void | sfRenderWindow_setKeyRepeatEnabled (sfRenderWindow *renderWindow, bool enabled)
| Enable or disable automatic key-repeat for keydown events.
void | sfRenderWindow_setFramerateLimit (sfRenderWindow *renderWindow, unsigned int limit)
| Limit the framerate to a maximum fixed frequency for a render window.
void | sfRenderWindow_setJoystickThreshold (sfRenderWindow *renderWindow, float threshold)
| Change the joystick threshold, ie.
bool | sfRenderWindow_setActive (sfRenderWindow *renderWindow, bool active)
| Activate or deactivate a render window as the current target for rendering.
void | sfRenderWindow_requestFocus (sfRenderWindow *renderWindow)
| Request the current render window to be made the active foreground window.
bool | sfRenderWindow_hasFocus (const sfRenderWindow *renderWindow)
| Check whether the render window has the input focus.
void | sfRenderWindow_display (sfRenderWindow *renderWindow)
| Display a render window on screen.
sfWindowHandle | sfRenderWindow_getNativeHandle (const sfRenderWindow *renderWindow)
| Retrieve the OS-specific handle of a render window.
void | sfRenderWindow_clear (sfRenderWindow *renderWindow, sfColor color)
| Clear a render window with the given color.
void | sfRenderWindow_clearStencil (sfRenderWindow *renderWindow, sfStencilValue stencilValue)
| Clear the stencil buffer to a specific value.
void | sfRenderWindow_clearColorAndStencil (sfRenderWindow *renderWindow, sfColor color, sfStencilValue stencilValue)
| Clear the entire target with a single color and stencil value.
void | sfRenderWindow_setView (sfRenderWindow *renderWindow, const sfView *view)
| Change the current active view of a render window.
const sfView * | sfRenderWindow_getView (const sfRenderWindow *renderWindow)
| Get the current active view of a render window.
const sfView * | sfRenderWindow_getDefaultView (const sfRenderWindow *renderWindow)
| Get the default view of a render window.
sfIntRect | sfRenderWindow_getViewport (const sfRenderWindow *renderWindow, const sfView *view)
| Get the viewport of a view applied to this target.
sfIntRect | sfRenderWindow_getScissor (const sfRenderWindow *renderWindow, const sfView *view)
| Get the scissor rectangle of a view, applied to this render target.
sfVector2f | sfRenderWindow_mapPixelToCoords (const sfRenderWindow *renderWindow, sfVector2i point, const sfView *view)
| Convert a point from window coordinates to world coordinates.
sfVector2i | sfRenderWindow_mapCoordsToPixel (const sfRenderWindow *renderWindow, sfVector2f point, const sfView *view)
| Convert a point from world coordinates to window coordinates.
void | sfRenderWindow_drawSprite (sfRenderWindow *renderWindow, const sfSprite *object, const sfRenderStates *states)
| Draw a drawable object to the render-target.
void | sfRenderWindow_drawText (sfRenderWindow *renderWindow, const sfText *object, const sfRenderStates *states)
void | sfRenderWindow_drawShape (sfRenderWindow *renderWindow, const sfShape *object, const sfRenderStates *states)
void | sfRenderWindow_drawCircleShape (sfRenderWindow *renderWindow, const sfCircleShape *object, const sfRenderStates *states)
void | sfRenderWindow_drawConvexShape (sfRenderWindow *renderWindow, const sfConvexShape *object, const sfRenderStates *states)
void | sfRenderWindow_drawRectangleShape (sfRenderWindow *renderWindow, const sfRectangleShape *object, const sfRenderStates *states)
void | sfRenderWindow_drawVertexArray (sfRenderWindow *renderWindow, const sfVertexArray *object, const sfRenderStates *states)
void | sfRenderWindow_drawVertexBuffer (sfRenderWindow *renderWindow, const sfVertexBuffer *object, const sfRenderStates *states)
void | sfRenderWindow_drawVertexBufferRange (sfRenderWindow *renderWindow, const sfVertexBuffer *object, size_t firstVertex, size_t vertexCount, const sfRenderStates *states)
| Draw primitives defined by a vertex buffer.
void | sfRenderWindow_drawPrimitives (sfRenderWindow *renderWindow, const sfVertex *vertices, size_t vertexCount, sfPrimitiveType type, const sfRenderStates *states)
| Draw primitives defined by an array of vertices to a render window.
void | sfRenderWindow_pushGLStates (sfRenderWindow *renderWindow)
| Save the current OpenGL render states and matrices.
void | sfRenderWindow_popGLStates (sfRenderWindow *renderWindow)
| Restore the previously saved OpenGL render states and matrices.
void | sfRenderWindow_resetGLStates (sfRenderWindow *renderWindow)
| Reset the internal OpenGL states so that the target is ready for drawing.
sfVector2i | sfMouse_getPositionRenderWindow (const sfRenderWindow *relativeTo)
| Get the current position of the mouse relative to a render-window.
void | sfMouse_setPositionRenderWindow (sfVector2i position, const sfRenderWindow *relativeTo)
| Set the current position of the mouse relative to a render window.
sfVector2i | sfTouch_getPositionRenderWindow (unsigned int finger, const sfRenderWindow *relativeTo)
| Get the current position of a touch in window coordinates.
bool | sfRenderWindow_createVulkanSurface (sfRenderWindow *renderWindow, const VkInstance *instance, VkSurfaceKHR *surface, const VkAllocationCallbacks *allocator)
| Create a Vulkan rendering surface.

## Function Documentation

## ◆ sfMouse_getPositionRenderWindow()

sfVector2i sfMouse_getPositionRenderWindow | ( | const sfRenderWindow * | relativeTo | ) |

Get the current position of the mouse relative to a render-window.

This function returns the current position of the mouse cursor relative to the given render-window, or desktop if NULL is passed.

Parameters

  relativeTo | Reference window

Returns
  Position of the mouse cursor, relative to the given render window

## ◆ sfMouse_setPositionRenderWindow()

void sfMouse_setPositionRenderWindow | ( | sfVector2i | position,
|  | const sfRenderWindow * | relativeTo )

Set the current position of the mouse relative to a render window.

This function sets the current position of the mouse cursor relative to the given render-window, or desktop if NULL is passed.

Parameters

  position | New position of the mouse
  relativeTo | Reference window

## ◆ sfRenderWindow_clear()

void sfRenderWindow_clear | ( | sfRenderWindow * | renderWindow,
|  | sfColor | color )

Clear a render window with the given color.

Parameters

  renderWindow | Render window object
  color | Fill color

## ◆ sfRenderWindow_clearColorAndStencil()

void sfRenderWindow_clearColorAndStencil | ( | sfRenderWindow * | renderWindow,
|  | sfColor | color,
|  | sfStencilValue | stencilValue )

Clear the entire target with a single color and stencil value.

The specified stencil value is truncated to the bit width of the current stencil buffer.

Parameters

  renderWindow | Render window object
  color | Fill color to use to clear the render target
  stencilValue | Stencil value to clear to

## ◆ sfRenderWindow_clearStencil()

void sfRenderWindow_clearStencil | ( | sfRenderWindow * | renderWindow,
|  | sfStencilValue | stencilValue )

Clear the stencil buffer to a specific value.

The specified value is truncated to the bit width of the current stencil buffer.

Parameters

  renderWindow | Render window object
  stencilValue | Stencil value to clear to

## ◆ sfRenderWindow_close()

void sfRenderWindow_close | ( | sfRenderWindow * | renderWindow | ) |

Close a render window (but doesn't destroy the internal data)

Parameters

  renderWindow | Render window to close

## ◆ sfRenderWindow_create()

sfRenderWindow * sfRenderWindow_create | ( | sfVideoMode | mode,
|  | const char * | title,
|  | uint32_t | style,
|  | sfWindowState | state,
|  | const sfContextSettings * | settings )

Construct a new render window.

Parameters

  mode | Video mode to use
  title | Title of the window
  style | Window style
  state | Window state
  settings | Creation settings (pass NULL to use default values)

## ◆ sfRenderWindow_createFromHandle()

sfRenderWindow * sfRenderWindow_createFromHandle | ( | sfWindowHandle | handle,
|  | const sfContextSettings * | settings )

Construct a render window from an existing control.

Parameters

  handle | Platform-specific handle of the control
  settings | Creation settings (pass NULL to use default values)

## ◆ sfRenderWindow_createUnicode()

sfRenderWindow * sfRenderWindow_createUnicode | ( | sfVideoMode | mode,
|  | const sfChar32 * | title,
|  | uint32_t | style,
|  | sfWindowState | state,
|  | const sfContextSettings * | settings )

Construct a new render window (with a UTF-32 title)

Parameters

  mode | Video mode to use
  title | Title of the window (UTF-32)
  style | Window style
  state | Window state
  settings | Creation settings (pass NULL to use default values)

## ◆ sfRenderWindow_createVulkanSurface()

bool sfRenderWindow_createVulkanSurface | ( | sfRenderWindow * | renderWindow,
|  | const VkInstance * | instance,
|  | VkSurfaceKHR * | surface,
|  | const VkAllocationCallbacks * | allocator )

Create a Vulkan rendering surface.

Parameters

  renderWindow | RenderWindow object
  instance | Vulkan instance
  surface | Created surface
  allocator | Allocator to use

Returns
  True if surface creation was successful, false otherwise

## ◆ sfRenderWindow_destroy()

void sfRenderWindow_destroy | ( | const sfRenderWindow * | renderWindow | ) |

Destroy an existing render window.

Parameters

  renderWindow | Render window to destroy

## ◆ sfRenderWindow_display()

void sfRenderWindow_display | ( | sfRenderWindow * | renderWindow | ) |

Display a render window on screen.

Parameters

  renderWindow | Render window object

## ◆ sfRenderWindow_drawCircleShape()

void sfRenderWindow_drawCircleShape | ( | sfRenderWindow * | renderWindow,
|  | const sfCircleShape * | object,
|  | const sfRenderStates * | states )

## ◆ sfRenderWindow_drawConvexShape()

void sfRenderWindow_drawConvexShape | ( | sfRenderWindow * | renderWindow,
|  | const sfConvexShape * | object,
|  | const sfRenderStates * | states )

## ◆ sfRenderWindow_drawPrimitives()

void sfRenderWindow_drawPrimitives | ( | sfRenderWindow * | renderWindow,
|  | const sfVertex * | vertices,
|  | size_t | vertexCount,
|  | sfPrimitiveType | type,
|  | const sfRenderStates * | states )

Draw primitives defined by an array of vertices to a render window.

Parameters

  renderWindow | render window object
  vertices | Pointer to the vertices
  vertexCount | Number of vertices in the array
  type | Type of primitives to draw
  states | Render states to use for drawing (NULL to use the default states)

## ◆ sfRenderWindow_drawRectangleShape()

void sfRenderWindow_drawRectangleShape | ( | sfRenderWindow * | renderWindow,
|  | const sfRectangleShape * | object,
|  | const sfRenderStates * | states )

## ◆ sfRenderWindow_drawShape()

void sfRenderWindow_drawShape | ( | sfRenderWindow * | renderWindow,
|  | const sfShape * | object,
|  | const sfRenderStates * | states )

## ◆ sfRenderWindow_drawSprite()

void sfRenderWindow_drawSprite | ( | sfRenderWindow * | renderWindow,
|  | const sfSprite * | object,
|  | const sfRenderStates * | states )

Draw a drawable object to the render-target.

Parameters

  renderWindow | render window object
  object | Object to draw
  states | Render states to use for drawing (NULL to use the default states)

## ◆ sfRenderWindow_drawText()

void sfRenderWindow_drawText | ( | sfRenderWindow * | renderWindow,
|  | const sfText * | object,
|  | const sfRenderStates * | states )

## ◆ sfRenderWindow_drawVertexArray()

void sfRenderWindow_drawVertexArray | ( | sfRenderWindow * | renderWindow,
|  | const sfVertexArray * | object,
|  | const sfRenderStates * | states )

## ◆ sfRenderWindow_drawVertexBuffer()

void sfRenderWindow_drawVertexBuffer | ( | sfRenderWindow * | renderWindow,
|  | const sfVertexBuffer * | object,
|  | const sfRenderStates * | states )

## ◆ sfRenderWindow_drawVertexBufferRange()

void sfRenderWindow_drawVertexBufferRange | ( | sfRenderWindow * | renderWindow,
|  | const sfVertexBuffer * | object,
|  | size_t | firstVertex,
|  | size_t | vertexCount,
|  | const sfRenderStates * | states )

Draw primitives defined by a vertex buffer.

Parameters

  renderWindow | Render window object
  object | Vertex buffer object to draw
  firstVertex | Index of the first vertex to render
  vertexCount | Number of vertices to render
  states | Render states to use for drawing

## ◆ sfRenderWindow_getDefaultView()

const sfView * sfRenderWindow_getDefaultView | ( | const sfRenderWindow * | renderWindow | ) |

Get the default view of a render window.

Parameters

  renderWindow | Render window object

Returns
  Default view of the render window

## ◆ sfRenderWindow_getNativeHandle()

sfWindowHandle sfRenderWindow_getNativeHandle | ( | const sfRenderWindow * | renderWindow | ) |

Retrieve the OS-specific handle of a render window.

Parameters

  renderWindow | Render window object

Returns
  Window handle

## ◆ sfRenderWindow_getPosition()

sfVector2i sfRenderWindow_getPosition | ( | const sfRenderWindow * | renderWindow | ) |

Get the position of a render window.

Parameters

  renderWindow | Render window object

Returns
  Position in pixels

## ◆ sfRenderWindow_getScissor()

sfIntRect sfRenderWindow_getScissor | ( | const sfRenderWindow * | renderWindow,
|  | const sfView * | view )

Get the scissor rectangle of a view, applied to this render target.

The scissor rectangle is defined in the view as a ratio. This function simply applies this ratio to the current dimensions of the render target to calculate the pixels rectangle that the scissor rectangle actually covers in the target.

Parameters

  renderWindow | Render window object
  view | The view for which we want to compute the scissor rectangle

Returns
  Scissor rectangle, expressed in pixels

## ◆ sfRenderWindow_getSettings()

sfContextSettings sfRenderWindow_getSettings | ( | const sfRenderWindow * | renderWindow | ) |

Get the creation settings of a render window.

Parameters

  renderWindow | Render window object

Returns
  Settings used to create the window

## ◆ sfRenderWindow_getSize()

sfVector2u sfRenderWindow_getSize | ( | const sfRenderWindow * | renderWindow | ) |

Get the size of the rendering region of a render window.

Parameters

  renderWindow | Render window object

Returns
  Size in pixels

## ◆ sfRenderWindow_getView()

const sfView * sfRenderWindow_getView | ( | const sfRenderWindow * | renderWindow | ) |

Get the current active view of a render window.

Parameters

  renderWindow | Render window object

Returns
  Current active view

## ◆ sfRenderWindow_getViewport()

sfIntRect sfRenderWindow_getViewport | ( | const sfRenderWindow * | renderWindow,
|  | const sfView * | view )

Get the viewport of a view applied to this target.

Parameters

  renderWindow | Render window object
  view | Target view

Returns
  Viewport rectangle, expressed in pixels in the current target

## ◆ sfRenderWindow_hasFocus()

bool sfRenderWindow_hasFocus | ( | const sfRenderWindow * | renderWindow | ) |

Check whether the render window has the input focus.

At any given time, only one window may have the input focus to receive input events such as keystrokes or most mouse events.

Returns
  True if window has focus, false otherwise

## ◆ sfRenderWindow_isOpen()

bool sfRenderWindow_isOpen | ( | const sfRenderWindow * | renderWindow | ) |

Tell whether or not a render window is opened.

Parameters

  renderWindow | Render window object

## ◆ sfRenderWindow_isSrgb()

bool sfRenderWindow_isSrgb | ( | const sfRenderWindow * | renderWindow | ) |

Tell if the render window will use sRGB encoding when drawing on it.

Parameters

  renderWindow | Render window object

Returns
  true if the render window use sRGB encoding, false otherwise

## ◆ sfRenderWindow_mapCoordsToPixel()

sfVector2i sfRenderWindow_mapCoordsToPixel | ( | const sfRenderWindow * | renderWindow,
|  | sfVector2f | point,
|  | const sfView * | view )

Convert a point from world coordinates to window coordinates.

This function finds the pixel of the render-window that matches the given 2D point. In other words, it goes through the same process as the graphics card, to compute the final position of a rendered point.

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-window, this assertion is not true anymore, ie. a point located at (150, 75) in your 2D world may map to the pixel (10, 50) of your render-window – if the view is translated by (140, 25).

This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-window.

Parameters

  renderWindow | Render window object
  point | Point to convert
  view | The view to use for converting the point

Returns
  The converted point, in target coordinates (pixels)

## ◆ sfRenderWindow_mapPixelToCoords()

sfVector2f sfRenderWindow_mapPixelToCoords | ( | const sfRenderWindow * | renderWindow,
|  | sfVector2i | point,
|  | const sfView * | view )

Convert a point from window coordinates to world coordinates.

This function finds the 2D position that matches the given pixel of the render-window. In other words, it does the inverse of what the graphics card does, to find the initial position of a rendered pixel.

Initially, both coordinate systems (world units and target pixels) match perfectly. But if you define a custom view or resize your render-window, this assertion is not true anymore, ie. a point located at (10, 50) in your render-window may map to the point (150, 75) in your 2D world – if the view is translated by (140, 25).

This function is typically used to find which point (or object) is located below the mouse cursor.

This version uses a custom view for calculations, see the other overload of the function if you want to use the current view of the render-window.

Parameters

  renderWindow | Render window object
  point | Pixel to convert
  view | The view to use for converting the point

Returns
  The converted point, in "world" units

## ◆ sfRenderWindow_pollEvent()

bool sfRenderWindow_pollEvent | ( | sfRenderWindow * | renderWindow,
|  | sfEvent * | event )

Pop the event on top of event queue, if any, and return it.

This function is not blocking: if there's no pending event then it will return false and leave event unmodified. Note that more than one event may be present in the event queue, thus you should always call this function in a loop to make sure that you process every pending event.

Parameters

  renderWindow | Render window object
  event | Event to fill, if any

Returns
  true if an event was returned, or false if the event queue was empty

## ◆ sfRenderWindow_popGLStates()

void sfRenderWindow_popGLStates | ( | sfRenderWindow * | renderWindow | ) |

Restore the previously saved OpenGL render states and matrices.

See the description of pushGLStates to get a detailed description of these functions.

Parameters

  renderWindow | render window object

## ◆ sfRenderWindow_pushGLStates()

void sfRenderWindow_pushGLStates | ( | sfRenderWindow * | renderWindow | ) |

Save the current OpenGL render states and matrices.

This function can be used when you mix SFML drawing and direct OpenGL rendering. Combined with popGLStates, it ensures that:

- SFML's internal states are not messed up by your OpenGL code
- your OpenGL states are not modified by a call to a SFML function

Note that this function is quite expensive: it saves all the possible OpenGL states and matrices, even the ones you don't care about. Therefore it should be used wisely. It is provided for convenience, but the best results will be achieved if you handle OpenGL states yourself (because you know which states have really changed, and need to be saved and restored). Take a look at the resetGLStates function if you do so.

Parameters

  renderWindow | render window object

## ◆ sfRenderWindow_requestFocus()

void sfRenderWindow_requestFocus | ( | sfRenderWindow * | renderWindow | ) |

Request the current render window to be made the active foreground window.

At any given time, only one window may have the input focus to receive input events such as keystrokes or mouse events. If a window requests focus, it only hints to the operating system, that it would like to be focused. The operating system is free to deny the request. This is not to be confused with sfWindow_setActive().

## ◆ sfRenderWindow_resetGLStates()

void sfRenderWindow_resetGLStates | ( | sfRenderWindow * | renderWindow | ) |

Reset the internal OpenGL states so that the target is ready for drawing.

This function can be used when you mix SFML drawing and direct OpenGL rendering, if you choose not to use pushGLStates/popGLStates. It makes sure that all OpenGL states needed by SFML are set, so that subsequent sfRenderWindow_draw*() calls will work as expected.

Parameters

  renderWindow | render window object

## ◆ sfRenderWindow_setActive()

bool sfRenderWindow_setActive | ( | sfRenderWindow * | renderWindow,
|  | bool | active )

Activate or deactivate a render window as the current target for rendering.

Parameters

  renderWindow | Render window object
  active | true to activate, false to deactivate

Returns
  True if operation was successful, false otherwise

## ◆ sfRenderWindow_setFramerateLimit()

void sfRenderWindow_setFramerateLimit | ( | sfRenderWindow * | renderWindow,
|  | unsigned int | limit )

Limit the framerate to a maximum fixed frequency for a render window.

Parameters

  renderWindow | Render window object
  limit | Framerate limit, in frames per seconds (use 0 to disable limit)

## ◆ sfRenderWindow_setIcon()

void sfRenderWindow_setIcon | ( | sfRenderWindow * | renderWindow,
|  | sfVector2u | size,
|  | const uint8_t * | pixels )

Change a render window's icon.

Parameters

  renderWindow | Render window object
  size | Icon's size, in pixels
  pixels | Pointer to the pixels in memory, format must be RGBA 32 bits

## ◆ sfRenderWindow_setJoystickThreshold()

void sfRenderWindow_setJoystickThreshold | ( | sfRenderWindow * | renderWindow,
|  | float | threshold )

Change the joystick threshold, ie.

the value below which no move event will be generated

Parameters

  renderWindow | Render window object
  threshold | New threshold, in range [0, 100]

## ◆ sfRenderWindow_setKeyRepeatEnabled()

void sfRenderWindow_setKeyRepeatEnabled | ( | sfRenderWindow * | renderWindow,
|  | bool | enabled )

Enable or disable automatic key-repeat for keydown events.

Automatic key-repeat is enabled by default

Parameters

  renderWindow | Render window object
  enabled | true to enable, false to disable

## ◆ sfRenderWindow_setMouseCursor()

void sfRenderWindow_setMouseCursor | ( | sfRenderWindow * | renderWindow,
|  | const sfCursor * | cursor )

Set the displayed cursor to a native system cursor.

Upon window creation, the arrow cursor is used by default.

Warning
  The cursor must not be destroyed while in use by the window.
  Features related to Cursor are not supported on iOS and Android.

Parameters

  renderWindow | Render window object
  cursor | Native system cursor type to display

See also
  sfCursor_createFromSystem
  sfCursor_createFromPixels

## ◆ sfRenderWindow_setMouseCursorGrabbed()

void sfRenderWindow_setMouseCursorGrabbed | ( | sfRenderWindow * | renderWindow,
|  | bool | grabbed )

Grab or release the mouse cursor.

If set, grabs the mouse cursor inside this window's client area so it may no longer be moved outside its bounds. Note that grabbing is only active while the window has focus and calling this function for fullscreen windows won't have any effect (fullscreen windows always grab the cursor).

Parameters

  renderWindow | Render window object
  grabbed | true to enable, false to disable

## ◆ sfRenderWindow_setMouseCursorVisible()

void sfRenderWindow_setMouseCursorVisible | ( | sfRenderWindow * | renderWindow,
|  | bool | show )

Show or hide the mouse cursor on a render window.

Parameters

  renderWindow | Render window object
  show | true to show, false to hide

## ◆ sfRenderWindow_setPosition()

void sfRenderWindow_setPosition | ( | sfRenderWindow * | renderWindow,
|  | sfVector2i | position )

Change the position of a render window on screen.

Only works for top-level windows

Parameters

  renderWindow | Render window object
  position | New position, in pixels

## ◆ sfRenderWindow_setSize()

void sfRenderWindow_setSize | ( | sfRenderWindow * | renderWindow,
|  | sfVector2u | size )

Change the size of the rendering region of a render window.

Parameters

  renderWindow | Render window object
  size | New size, in pixels

## ◆ sfRenderWindow_setTitle()

void sfRenderWindow_setTitle | ( | sfRenderWindow * | renderWindow,
|  | const char * | title )

Change the title of a render window.

Parameters

  renderWindow | Render window object
  title | New title

## ◆ sfRenderWindow_setUnicodeTitle()

void sfRenderWindow_setUnicodeTitle | ( | sfRenderWindow * | renderWindow,
|  | const sfChar32 * | title )

Change the title of a render window (with a UTF-32 string)

Parameters

  renderWindow | Render window object
  title | New title

## ◆ sfRenderWindow_setVerticalSyncEnabled()

void sfRenderWindow_setVerticalSyncEnabled | ( | sfRenderWindow * | renderWindow,
|  | bool | enabled )

Enable / disable vertical synchronization on a render window.

Parameters

  renderWindow | Render window object
  enabled | true to enable v-sync, false to deactivate

## ◆ sfRenderWindow_setView()

void sfRenderWindow_setView | ( | sfRenderWindow * | renderWindow,
|  | const sfView * | view )

Change the current active view of a render window.

Parameters

  renderWindow | Render window object
  view | Pointer to the new view

## ◆ sfRenderWindow_setVisible()

void sfRenderWindow_setVisible | ( | sfRenderWindow * | renderWindow,
|  | bool | visible )

Show or hide a render window.

Parameters

  renderWindow | Render window object
  visible | true to show the window, false to hide it

## ◆ sfRenderWindow_waitEvent()

bool sfRenderWindow_waitEvent | ( | sfRenderWindow * | renderWindow,
|  | sfTime | timeout,
|  | sfEvent * | event )

Wait for an event and return it.

This function is blocking: if there's no pending event then it will wait until an event is received or until the provided timeout elapses. Only if an error or a timeout occurs the function returns `false`. This function is typically used when you have a thread that is dedicated to events handling: you want to make this thread sleep as long as no new event is received.

while (sfRenderWindow_waitEvent(renderWindow, timeout, &event))
{
// process event...
}
sfRenderWindow_waitEvent
bool sfRenderWindow_waitEvent(sfRenderWindow *renderWindow, sfTime timeout, sfEvent *event)
Wait for an event and return it.

Parameters

  renderWindow | Render window object
  timeout | Maximum time to wait (`sfTime_Zero` for infinite)
  event | Event to fill, if any

Returns
  true if an event was returned, false if event queue was empty or function timed out

## ◆ sfTouch_getPositionRenderWindow()

sfVector2i sfTouch_getPositionRenderWindow | ( | unsigned int | finger,
|  | const sfRenderWindow * | relativeTo )

Get the current position of a touch in window coordinates.

This function returns the current touch position relative to the given render window, or desktop if NULL is passed.

Parameters

  finger | Finger index
  relativeTo | Reference window

Returns
  Current position of finger, or undefined if it's not down