Loading...
Searching...
No Matches
Window/Window.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 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#ifndef SFML_WINDOW_H
26#define SFML_WINDOW_H
27
29// Headers
31#include <SFML/Window/Export.h>
32#include <SFML/Window/Event.h>
36#include <SFML/Window/Types.h>
37#include <SFML/System/Vector2.h>
38
39
44typedef enum
45{
47 sfContextCore = 1 << 0,
48 sfContextDebug = 1 << 2
50
51
56typedef struct
57{
58 unsigned int depthBits;
59 unsigned int stencilBits;
60 unsigned int antialiasingLevel;
61 unsigned int majorVersion;
62 unsigned int minorVersion;
66
67
89CSFML_WINDOW_API sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings);
90
113
131
139
153
167
182
199
218
228
241
254
263
271CSFML_WINDOW_API void sfWindow_setTitle(sfWindow* window, const char* title);
272
281
294CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels);
295
304
318
327
342
362
377
389CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit);
390
402
421
435
447
460
476
489
490
491#endif // SFML_WINDOW_H
unsigned int sfUint32
Definition Config.h:176
int sfBool
Definition Config.h:153
unsigned char sfUint8
Definition Config.h:168
struct VkInstance_T * VkInstance
Definition Vulkan.h:32
struct VkAllocationCallbacks VkAllocationCallbacks
Definition Vulkan.h:44
sfUint64 VkSurfaceKHR
Definition Vulkan.h:40
#define CSFML_WINDOW_API
struct sfWindow sfWindow
struct sfCursor sfCursor
void sfWindow_setFramerateLimit(sfWindow *window, unsigned int limit)
Limit the framerate to a maximum fixed frequency.
void sfWindow_destroy(sfWindow *window)
Destroy a window.
void sfWindow_requestFocus(sfWindow *window)
Request the current window to be made the active foreground window.
void sfWindow_setMouseCursorGrabbed(sfWindow *window, sfBool grabbed)
Grab or release the mouse cursor.
void sfWindow_setMouseCursorVisible(sfWindow *window, sfBool visible)
Show or hide the mouse cursor.
sfContextSettings sfWindow_getSettings(const sfWindow *window)
Get the settings of the OpenGL context of a window.
void sfWindow_setJoystickThreshold(sfWindow *window, float threshold)
Change the joystick threshold.
void sfWindow_setVerticalSyncEnabled(sfWindow *window, sfBool enabled)
Enable or disable vertical synchronization.
sfVector2i sfWindow_getPosition(const sfWindow *window)
Get the position of a window.
sfBool sfWindow_waitEvent(sfWindow *window, sfEvent *event)
Wait for an event and return it.
sfBool sfWindow_pollEvent(sfWindow *window, sfEvent *event)
Pop the event on top of event queue, if any, and return it.
sfWindow * sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings *settings)
Construct a window from an existing control.
sfContextAttribute
Enumeration of the context attribute flags.
@ sfContextCore
Core attribute.
@ sfContextDebug
Debug attribute.
@ sfContextDefault
Non-debug, compatibility context (this and the core attribute are mutually exclusive)
void sfWindow_setKeyRepeatEnabled(sfWindow *window, sfBool enabled)
Enable or disable automatic key-repeat.
sfWindowHandle sfWindow_getSystemHandle(const sfWindow *window)
Get the OS-specific handle of the window.
sfWindow * sfWindow_createUnicode(sfVideoMode mode, const sfUint32 *title, sfUint32 style, const sfContextSettings *settings)
Construct a new window (with a UTF-32 title)
sfBool sfWindow_isOpen(const sfWindow *window)
Tell whether or not a window is opened.
sfBool sfWindow_hasFocus(const sfWindow *window)
Check whether the window has the input focus.
sfVector2u sfWindow_getSize(const sfWindow *window)
Get the size of the rendering region of a window.
void sfWindow_setTitle(sfWindow *window, const char *title)
Change the title of a window.
void sfWindow_setIcon(sfWindow *window, unsigned int width, unsigned int height, const sfUint8 *pixels)
Change a window's icon.
void sfWindow_setMouseCursor(sfWindow *window, const sfCursor *cursor)
Set the displayed cursor to a native system cursor.
sfBool sfWindow_setActive(sfWindow *window, sfBool active)
Activate or deactivate a window as the current target for OpenGL rendering.
void sfWindow_display(sfWindow *window)
Display on screen what has been rendered to the window so far.
void sfWindow_setUnicodeTitle(sfWindow *window, const sfUint32 *title)
Change the title of a window (with a UTF-32 string)
void sfWindow_setSize(sfWindow *window, sfVector2u size)
Change the size of the rendering region of a window.
sfWindow * sfWindow_create(sfVideoMode mode, const char *title, sfUint32 style, const sfContextSettings *settings)
Construct a new window.
void sfWindow_close(sfWindow *window)
Close a window and destroy all the attached resources.
sfBool sfWindow_createVulkanSurface(sfWindow *window, const VkInstance *instance, VkSurfaceKHR *surface, const VkAllocationCallbacks *allocator)
Create a Vulkan rendering surface.
void sfWindow_setVisible(sfWindow *window, sfBool visible)
Show or hide a window.
void sfWindow_setPosition(sfWindow *window, sfVector2i position)
Change the position of a window on screen.
Structure defining the window's creation settings.
sfUint32 attributeFlags
The attribute flags to create the context with.
unsigned int depthBits
Bits of the depth buffer.
unsigned int stencilBits
Bits of the stencil buffer.
unsigned int majorVersion
Major number of the context version to create.
unsigned int minorVersion
Minor number of the context version to create.
unsigned int antialiasingLevel
Level of antialiasing.
sfBool sRgbCapable
Whether the context framebuffer is sRGB capable.
2-component vector of integers
Definition Vector2.h:39
2-component vector of unsigned integers
Definition Vector2.h:50
sfVideoMode defines a video mode (width, height, bpp, frequency) and provides functions for getting m...
Definition VideoMode.h:42
sfEvent defines a system event and its parameters
Definition Event.h:222