CSFML 3.0.0
Loading...
Searching...
No Matches
RenderWindow.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
30#include <CSFML/Graphics/Export.h>
31
32#include <CSFML/Graphics/Color.h>
33#include <CSFML/Graphics/PrimitiveType.h>
34#include <CSFML/Graphics/Rect.h>
35#include <CSFML/Graphics/RenderStates.h>
36#include <CSFML/Graphics/StencilMode.h>
37#include <CSFML/Graphics/Types.h>
38#include <CSFML/Graphics/Vertex.h>
39#include <CSFML/System/Time.h>
40#include <CSFML/System/Vector2.h>
41#include <CSFML/Window/Event.h>
42#include <CSFML/Window/VideoMode.h>
43#include <CSFML/Window/Window.h>
44#include <CSFML/Window/WindowHandle.h>
45
46#include <stddef.h>
47
48
59 CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_create(
60 sfVideoMode mode,
61 const char* title,
62 uint32_t style,
63 sfWindowState state,
64 const sfContextSettings* settings);
65
76 CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_createUnicode(
77 sfVideoMode mode,
78 const sfChar32* title,
79 uint32_t style,
80 sfWindowState state,
81 const sfContextSettings* settings);
82
90 CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings);
91
98 CSFML_GRAPHICS_API void sfRenderWindow_destroy(const sfRenderWindow* renderWindow);
99
106 CSFML_GRAPHICS_API void sfRenderWindow_close(sfRenderWindow* renderWindow);
107
114 CSFML_GRAPHICS_API bool sfRenderWindow_isOpen(const sfRenderWindow* renderWindow);
115
124 CSFML_GRAPHICS_API sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow);
125
141 CSFML_GRAPHICS_API bool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event);
142
167 CSFML_GRAPHICS_API bool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfTime timeout, sfEvent* event);
168
177 CSFML_GRAPHICS_API sfVector2i sfRenderWindow_getPosition(const sfRenderWindow* renderWindow);
178
188 CSFML_GRAPHICS_API void sfRenderWindow_setPosition(sfRenderWindow* renderWindow, sfVector2i position);
189
198 CSFML_GRAPHICS_API sfVector2u sfRenderWindow_getSize(const sfRenderWindow* renderWindow);
199
208 CSFML_GRAPHICS_API bool sfRenderWindow_isSrgb(const sfRenderWindow* renderWindow);
209
217 CSFML_GRAPHICS_API void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size);
218
228 CSFML_GRAPHICS_API void sfRenderWindow_setMinimumSize(sfRenderWindow* renderWindow, const sfVector2u* minimumSize);
229
239 CSFML_GRAPHICS_API void sfRenderWindow_setMaximumSize(sfRenderWindow* renderWindow, const sfVector2u* maximumSize);
240
248 CSFML_GRAPHICS_API void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title);
249
257 CSFML_GRAPHICS_API void sfRenderWindow_setUnicodeTitle(sfRenderWindow* renderWindow, const sfChar32* title);
258
267 CSFML_GRAPHICS_API void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, sfVector2u size, const uint8_t* pixels);
268
276 CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, bool visible);
277
285 CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, bool enabled);
286
294 CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, bool show);
295
310 CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, bool grabbed);
311
330 CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursor(sfRenderWindow* renderWindow, const sfCursor* cursor);
331
341 CSFML_GRAPHICS_API void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, bool enabled);
342
350 CSFML_GRAPHICS_API void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit);
351
359 CSFML_GRAPHICS_API void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold);
360
370 CSFML_GRAPHICS_API bool sfRenderWindow_setActive(sfRenderWindow* renderWindow, bool active);
371
384 CSFML_GRAPHICS_API void sfRenderWindow_requestFocus(sfRenderWindow* renderWindow);
385
396 CSFML_GRAPHICS_API bool sfRenderWindow_hasFocus(const sfRenderWindow* renderWindow);
397
404 CSFML_GRAPHICS_API void sfRenderWindow_display(sfRenderWindow* renderWindow);
405
414 CSFML_GRAPHICS_API sfWindowHandle sfRenderWindow_getNativeHandle(const sfRenderWindow* renderWindow);
415
423 CSFML_GRAPHICS_API void sfRenderWindow_clear(sfRenderWindow* renderWindow, sfColor color);
424
435 CSFML_GRAPHICS_API void sfRenderWindow_clearStencil(sfRenderWindow* renderWindow, sfStencilValue stencilValue);
436
448 CSFML_GRAPHICS_API void sfRenderWindow_clearColorAndStencil(sfRenderWindow* renderWindow, sfColor color, sfStencilValue stencilValue);
449
457 CSFML_GRAPHICS_API void sfRenderWindow_setView(sfRenderWindow* renderWindow, const sfView* view);
458
467 CSFML_GRAPHICS_API const sfView* sfRenderWindow_getView(const sfRenderWindow* renderWindow);
468
477 CSFML_GRAPHICS_API const sfView* sfRenderWindow_getDefaultView(const sfRenderWindow* renderWindow);
478
488 CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const sfView* view);
489
504 CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getScissor(const sfRenderWindow* renderWindow, const sfView* view);
505
534 CSFML_GRAPHICS_API sfVector2f
535 sfRenderWindow_mapPixelToCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* view);
536
561 CSFML_GRAPHICS_API sfVector2i
562 sfRenderWindow_mapCoordsToPixel(const sfRenderWindow* renderWindow, sfVector2f point, const sfView* view);
563
572 CSFML_GRAPHICS_API void sfRenderWindow_drawSprite(sfRenderWindow* renderWindow,
573 const sfSprite* object,
574 const sfRenderStates* states);
575 CSFML_GRAPHICS_API void sfRenderWindow_drawText(sfRenderWindow* renderWindow, const sfText* object, const sfRenderStates* states);
576 CSFML_GRAPHICS_API void sfRenderWindow_drawShape(sfRenderWindow* renderWindow, const sfShape* object, const sfRenderStates* states);
577 CSFML_GRAPHICS_API void sfRenderWindow_drawCircleShape(sfRenderWindow* renderWindow,
578 const sfCircleShape* object,
579 const sfRenderStates* states);
580 CSFML_GRAPHICS_API void sfRenderWindow_drawConvexShape(sfRenderWindow* renderWindow,
581 const sfConvexShape* object,
582 const sfRenderStates* states);
583 CSFML_GRAPHICS_API void sfRenderWindow_drawRectangleShape(sfRenderWindow* renderWindow,
584 const sfRectangleShape* object,
585 const sfRenderStates* states);
586 CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow,
587 const sfVertexArray* object,
588 const sfRenderStates* states);
589 CSFML_GRAPHICS_API void sfRenderWindow_drawVertexBuffer(sfRenderWindow* renderWindow,
590 const sfVertexBuffer* object,
591 const sfRenderStates* states);
592
603 CSFML_GRAPHICS_API void sfRenderWindow_drawVertexBufferRange(
604 sfRenderWindow* renderWindow,
605 const sfVertexBuffer* object,
606 size_t firstVertex,
607 size_t vertexCount,
608 const sfRenderStates* states);
609
620 CSFML_GRAPHICS_API void sfRenderWindow_drawPrimitives(
621 sfRenderWindow* renderWindow,
622 const sfVertex* vertices,
623 size_t vertexCount,
624 sfPrimitiveType type,
625 const sfRenderStates* states);
626
648 CSFML_GRAPHICS_API void sfRenderWindow_pushGLStates(sfRenderWindow* renderWindow);
649
659 CSFML_GRAPHICS_API void sfRenderWindow_popGLStates(sfRenderWindow* renderWindow);
660
673 CSFML_GRAPHICS_API void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow);
674
686 CSFML_GRAPHICS_API sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWindow* relativeTo);
687
698 CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow* relativeTo);
699
712 CSFML_GRAPHICS_API sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo);
713
725 CSFML_GRAPHICS_API bool sfRenderWindow_createVulkanSurface(
726 sfRenderWindow* renderWindow,
727 const VkInstance* instance,
728 VkSurfaceKHR* surface,
729 const VkAllocationCallbacks* allocator);
Color.h
sfChar32
uint32_t sfChar32
Define sfChar32.
Definition Config.h:161
Event.h
Export.h
CSFML_GRAPHICS_API
#define CSFML_GRAPHICS_API
Definition Graphics/Export.h:42
Types.h
sfRenderWindow
struct sfRenderWindow sfRenderWindow
Definition Graphics/Types.h:35
sfCircleShape
struct sfCircleShape sfCircleShape
Definition Graphics/Types.h:28
sfVertexBuffer
struct sfVertexBuffer sfVertexBuffer
Definition Graphics/Types.h:42
sfShape
struct sfShape sfShape
Definition Graphics/Types.h:36
sfVertexArray
struct sfVertexArray sfVertexArray
Definition Graphics/Types.h:41
sfSprite
struct sfSprite sfSprite
Definition Graphics/Types.h:37
sfRectangleShape
struct sfRectangleShape sfRectangleShape
Definition Graphics/Types.h:33
sfText
struct sfText sfText
Definition Graphics/Types.h:38
sfConvexShape
struct sfConvexShape sfConvexShape
Definition Graphics/Types.h:29
sfView
struct sfView sfView
Definition Graphics/Types.h:43
PrimitiveType.h
sfPrimitiveType
sfPrimitiveType
Types of primitives that an sfVertexArray can render.
Definition PrimitiveType.h:42
Rect.h
RenderStates.h
sfRenderWindow_resetGLStates
void sfRenderWindow_resetGLStates(sfRenderWindow *renderWindow)
Reset the internal OpenGL states so that the target is ready for drawing.
sfRenderWindow_pollEvent
bool sfRenderWindow_pollEvent(sfRenderWindow *renderWindow, sfEvent *event)
Pop the event on top of event queue, if any, and return it.
sfRenderWindow_getSettings
sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow *renderWindow)
Get the creation settings of a render window.
sfRenderWindow_waitEvent
bool sfRenderWindow_waitEvent(sfRenderWindow *renderWindow, sfTime timeout, sfEvent *event)
Wait for an event and return it.
sfRenderWindow_getDefaultView
const sfView * sfRenderWindow_getDefaultView(const sfRenderWindow *renderWindow)
Get the default view of a render window.
sfRenderWindow_setFramerateLimit
void sfRenderWindow_setFramerateLimit(sfRenderWindow *renderWindow, unsigned int limit)
Limit the framerate to a maximum fixed frequency for a render window.
sfRenderWindow_drawVertexBuffer
void sfRenderWindow_drawVertexBuffer(sfRenderWindow *renderWindow, const sfVertexBuffer *object, const sfRenderStates *states)
sfRenderWindow_setSize
void sfRenderWindow_setSize(sfRenderWindow *renderWindow, sfVector2u size)
Change the size of the rendering region of a render window.
sfRenderWindow_setMouseCursor
void sfRenderWindow_setMouseCursor(sfRenderWindow *renderWindow, const sfCursor *cursor)
Set the displayed cursor to a native system cursor.
sfRenderWindow_clearColorAndStencil
void sfRenderWindow_clearColorAndStencil(sfRenderWindow *renderWindow, sfColor color, sfStencilValue stencilValue)
Clear the entire target with a single color and stencil value.
sfRenderWindow_setJoystickThreshold
void sfRenderWindow_setJoystickThreshold(sfRenderWindow *renderWindow, float threshold)
Change the joystick threshold, ie.
sfRenderWindow_display
void sfRenderWindow_display(sfRenderWindow *renderWindow)
Display a render window on screen.
sfRenderWindow_getViewport
sfIntRect sfRenderWindow_getViewport(const sfRenderWindow *renderWindow, const sfView *view)
Get the viewport of a view applied to this target.
sfRenderWindow_isOpen
bool sfRenderWindow_isOpen(const sfRenderWindow *renderWindow)
Tell whether or not a render window is opened.
sfRenderWindow_getView
const sfView * sfRenderWindow_getView(const sfRenderWindow *renderWindow)
Get the current active view of a render window.
sfTouch_getPositionRenderWindow
sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow *relativeTo)
Get the current position of a touch in window coordinates.
sfRenderWindow_hasFocus
bool sfRenderWindow_hasFocus(const sfRenderWindow *renderWindow)
Check whether the render window has the input focus.
sfMouse_getPositionRenderWindow
sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWindow *relativeTo)
Get the current position of the mouse relative to a render-window.
sfRenderWindow_clear
void sfRenderWindow_clear(sfRenderWindow *renderWindow, sfColor color)
Clear a render window with the given color.
sfRenderWindow_isSrgb
bool sfRenderWindow_isSrgb(const sfRenderWindow *renderWindow)
Tell if the render window will use sRGB encoding when drawing on it.
sfRenderWindow_setMouseCursorVisible
void sfRenderWindow_setMouseCursorVisible(sfRenderWindow *renderWindow, bool show)
Show or hide the mouse cursor on a render window.
sfRenderWindow_drawVertexArray
void sfRenderWindow_drawVertexArray(sfRenderWindow *renderWindow, const sfVertexArray *object, const sfRenderStates *states)
sfRenderWindow_pushGLStates
void sfRenderWindow_pushGLStates(sfRenderWindow *renderWindow)
Save the current OpenGL render states and matrices.
sfRenderWindow_drawShape
void sfRenderWindow_drawShape(sfRenderWindow *renderWindow, const sfShape *object, const sfRenderStates *states)
sfRenderWindow_getNativeHandle
sfWindowHandle sfRenderWindow_getNativeHandle(const sfRenderWindow *renderWindow)
Retrieve the OS-specific handle of a render window.
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).
sfRenderWindow_createVulkanSurface
bool sfRenderWindow_createVulkanSurface(sfRenderWindow *renderWindow, const VkInstance *instance, VkSurfaceKHR *surface, const VkAllocationCallbacks *allocator)
Create a Vulkan rendering surface.
sfRenderWindow_setUnicodeTitle
void sfRenderWindow_setUnicodeTitle(sfRenderWindow *renderWindow, const sfChar32 *title)
Change the title of a render window (with a UTF-32 string).
sfRenderWindow_mapCoordsToPixel
sfVector2i sfRenderWindow_mapCoordsToPixel(const sfRenderWindow *renderWindow, sfVector2f point, const sfView *view)
Convert a point from world coordinates to window coordinates.
sfRenderWindow_getScissor
sfIntRect sfRenderWindow_getScissor(const sfRenderWindow *renderWindow, const sfView *view)
Get the scissor rectangle of a view, applied to this render target.
sfRenderWindow_createFromHandle
sfRenderWindow * sfRenderWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings *settings)
Construct a render window from an existing control.
sfRenderWindow_drawSprite
void sfRenderWindow_drawSprite(sfRenderWindow *renderWindow, const sfSprite *object, const sfRenderStates *states)
Draw a drawable object to the render-target.
sfRenderWindow_destroy
void sfRenderWindow_destroy(const sfRenderWindow *renderWindow)
Destroy an existing render window.
sfRenderWindow_drawCircleShape
void sfRenderWindow_drawCircleShape(sfRenderWindow *renderWindow, const sfCircleShape *object, const sfRenderStates *states)
sfRenderWindow_setMinimumSize
void sfRenderWindow_setMinimumSize(sfRenderWindow *renderWindow, const sfVector2u *minimumSize)
Set the minimum window rendering region size.
sfRenderWindow_create
sfRenderWindow * sfRenderWindow_create(sfVideoMode mode, const char *title, uint32_t style, sfWindowState state, const sfContextSettings *settings)
Construct a new render window.
sfRenderWindow_clearStencil
void sfRenderWindow_clearStencil(sfRenderWindow *renderWindow, sfStencilValue stencilValue)
Clear the stencil buffer to a specific value.
sfRenderWindow_setView
void sfRenderWindow_setView(sfRenderWindow *renderWindow, const sfView *view)
Change the current active view of a render window.
sfRenderWindow_setTitle
void sfRenderWindow_setTitle(sfRenderWindow *renderWindow, const char *title)
Change the title of a render window.
sfRenderWindow_requestFocus
void sfRenderWindow_requestFocus(sfRenderWindow *renderWindow)
Request the current render window to be made the active foreground window.
sfRenderWindow_drawConvexShape
void sfRenderWindow_drawConvexShape(sfRenderWindow *renderWindow, const sfConvexShape *object, const sfRenderStates *states)
sfMouse_setPositionRenderWindow
void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow *relativeTo)
Set the current position of the mouse relative to a render window.
sfRenderWindow_drawText
void sfRenderWindow_drawText(sfRenderWindow *renderWindow, const sfText *object, const sfRenderStates *states)
sfRenderWindow_setPosition
void sfRenderWindow_setPosition(sfRenderWindow *renderWindow, sfVector2i position)
Change the position of a render window on screen.
sfRenderWindow_setVisible
void sfRenderWindow_setVisible(sfRenderWindow *renderWindow, bool visible)
Show or hide a render window.
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.
sfRenderWindow_setActive
bool sfRenderWindow_setActive(sfRenderWindow *renderWindow, bool active)
Activate or deactivate a render window as the current target for rendering.
sfRenderWindow_close
void sfRenderWindow_close(sfRenderWindow *renderWindow)
Close a render window (but doesn't destroy the internal data).
sfRenderWindow_setVerticalSyncEnabled
void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow *renderWindow, bool enabled)
Enable / disable vertical synchronization on a render window.
sfRenderWindow_setMouseCursorGrabbed
void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow *renderWindow, bool grabbed)
Grab or release the mouse cursor.
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.
sfRenderWindow_mapPixelToCoords
sfVector2f sfRenderWindow_mapPixelToCoords(const sfRenderWindow *renderWindow, sfVector2i point, const sfView *view)
Convert a point from window coordinates to world coordinates.
sfRenderWindow_drawRectangleShape
void sfRenderWindow_drawRectangleShape(sfRenderWindow *renderWindow, const sfRectangleShape *object, const sfRenderStates *states)
sfRenderWindow_popGLStates
void sfRenderWindow_popGLStates(sfRenderWindow *renderWindow)
Restore the previously saved OpenGL render states and matrices.
sfRenderWindow_setKeyRepeatEnabled
void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow *renderWindow, bool enabled)
Enable or disable automatic key-repeat for keydown events.
sfRenderWindow_getPosition
sfVector2i sfRenderWindow_getPosition(const sfRenderWindow *renderWindow)
Get the position of a render window.
sfRenderWindow_getSize
sfVector2u sfRenderWindow_getSize(const sfRenderWindow *renderWindow)
Get the size of the rendering region of a render window.
sfRenderWindow_setMaximumSize
void sfRenderWindow_setMaximumSize(sfRenderWindow *renderWindow, const sfVector2u *maximumSize)
Set the maximum window rendering region size.
sfRenderWindow_setIcon
void sfRenderWindow_setIcon(sfRenderWindow *renderWindow, sfVector2u size, const uint8_t *pixels)
Change a render window's icon.
StencilMode.h
Time.h
Vector2.h
Vertex.h
VideoMode.h
VkSurfaceKHR
uint64_t VkSurfaceKHR
Definition Vulkan.h:42
VkInstance
struct VkInstance_T * VkInstance
Definition Vulkan.h:33
VkAllocationCallbacks
struct VkAllocationCallbacks VkAllocationCallbacks
Definition Vulkan.h:46
sfWindowState
sfWindowState
Enumeration of the window states.
Definition WindowBase.h:61
WindowHandle.h
sfCursor
struct sfCursor sfCursor
Definition Window/Types.h:29
Window.h
sfColor
Utility class for manpulating RGBA colors.
Definition Color.h:38
sfContextSettings
Structure defining the window's creation settings.
Definition Window/Window.h:58
sfIntRect
Definition Rect.h:46
sfRenderStates
Define the states used for drawing to a RenderTarget.
Definition RenderStates.h:44
sfStencilValue
Stencil value type (also used as a mask).
Definition StencilMode.h:74
sfTime
Represents a time value.
Definition Time.h:38
sfVector2f
2-component vector of floats
Definition Vector2.h:60
sfVector2i
2-component vector of integers
Definition Vector2.h:38
sfVector2u
2-component vector of unsigned integers
Definition Vector2.h:49
sfVertex
Define a point with color and texture coordinates.
Definition Vertex.h:40
sfVideoMode
sfVideoMode defines a video mode (width, height, bpp, frequency) and provides functions for getting m...
Definition VideoMode.h:44
sfEvent
sfEvent defines a system event and its parameters
Definition Event.h:210