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#pragma once
26
28// Headers
30#include <CSFML/Window/Export.h>
31
32#include <CSFML/System/Time.h>
34#include <CSFML/Window/Event.h>
35#include <CSFML/Window/Types.h>
39
40
45typedef enum
46{
48 sfContextCore = 1 << 0,
49 sfContextDebug = 1 << 2
51
52
57typedef struct
58{
59 unsigned int depthBits;
60 unsigned int stencilBits;
61 unsigned int antiAliasingLevel;
62 unsigned int majorVersion;
63 unsigned int minorVersion;
64 uint32_t attributeFlags;
67
68
92 const char* title,
93 uint32_t style,
94 sfWindowState state,
95 const sfContextSettings* settings);
96
120 sfVideoMode mode,
121 const sfChar32* title,
122 uint32_t style,
123 sfWindowState state,
124 const sfContextSettings* settings);
125
143
151
165
179
194
211
237
247
260
273
282
290CSFML_WINDOW_API void sfWindow_setTitle(sfWindow* window, const char* title);
291
300
312CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, sfVector2u size, const uint8_t* pixels);
313
322
336
345
361
381
396
408CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit);
409
421
440
454
466
479
495
508 const VkInstance* instance,
509 VkSurfaceKHR* surface,
510 const VkAllocationCallbacks* allocator);
uint32_t sfChar32
Define sfChar32.
Definition Config.h:161
uint64_t VkSurfaceKHR
Definition Vulkan.h:42
struct VkInstance_T * VkInstance
Definition Vulkan.h:33
struct VkAllocationCallbacks VkAllocationCallbacks
Definition Vulkan.h:46
sfWindowState
Enumeration of the window states.
Definition WindowBase.h:61
#define CSFML_WINDOW_API
struct sfWindow sfWindow
struct sfCursor sfCursor
bool sfWindow_hasFocus(const sfWindow *window)
Check whether the window has the input focus.
void sfWindow_destroy(const sfWindow *window)
Destroy a window.
void sfWindow_setFramerateLimit(sfWindow *window, unsigned int limit)
Limit the framerate to a maximum fixed frequency.
void sfWindow_requestFocus(sfWindow *window)
Request the current window to be made the active foreground window.
bool sfWindow_setActive(sfWindow *window, bool active)
Activate or deactivate a window as the current target for OpenGL rendering.
sfContextSettings sfWindow_getSettings(const sfWindow *window)
Get the settings of the OpenGL context of a window.
bool sfWindow_waitEvent(sfWindow *window, sfTime timeout, sfEvent *event)
Wait for an event and return it.
void sfWindow_setJoystickThreshold(sfWindow *window, float threshold)
Change the joystick threshold.
sfVector2i sfWindow_getPosition(const sfWindow *window)
Get the position of a window.
bool sfWindow_pollEvent(sfWindow *window, sfEvent *event)
Pop the event on top of event queue, if any, and return it.
void sfWindow_setKeyRepeatEnabled(sfWindow *window, bool enabled)
Enable or disable automatic key-repeat.
sfWindow * sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings *settings)
Construct a window from an existing control.
void sfWindow_setUnicodeTitle(sfWindow *window, const sfChar32 *title)
Change the title of a window (with a UTF-32 string)
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_setVerticalSyncEnabled(sfWindow *window, bool enabled)
Enable or disable vertical synchronization.
void sfWindow_setMouseCursorGrabbed(sfWindow *window, bool grabbed)
Grab or release the mouse cursor.
void sfWindow_setMouseCursorVisible(sfWindow *window, bool visible)
Show or hide the mouse cursor.
sfWindowHandle sfWindow_getNativeHandle(const sfWindow *window)
Get the OS-specific handle of the window.
bool sfWindow_createVulkanSurface(sfWindow *window, const VkInstance *instance, VkSurfaceKHR *surface, const VkAllocationCallbacks *allocator)
Create a Vulkan rendering surface.
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_setMouseCursor(sfWindow *window, const sfCursor *cursor)
Set the displayed cursor to a native system cursor.
void sfWindow_setVisible(sfWindow *window, bool visible)
Show or hide a window.
void sfWindow_display(sfWindow *window)
Display on screen what has been rendered to the window so far.
sfWindow * sfWindow_create(sfVideoMode mode, const char *title, uint32_t style, sfWindowState state, const sfContextSettings *settings)
Construct a new window.
void sfWindow_setSize(sfWindow *window, sfVector2u size)
Change the size of the rendering region of a window.
void sfWindow_setIcon(sfWindow *window, sfVector2u size, const uint8_t *pixels)
Change a window's icon.
void sfWindow_close(sfWindow *window)
Close a window and destroy all the attached resources.
bool sfWindow_isOpen(const sfWindow *window)
Tell whether or not a window is opened.
sfWindow * sfWindow_createUnicode(sfVideoMode mode, const sfChar32 *title, uint32_t style, sfWindowState state, const sfContextSettings *settings)
Construct a new window (with a UTF-32 title)
void sfWindow_setPosition(sfWindow *window, sfVector2i position)
Change the position of a window on screen.
Structure defining the window's creation settings.
unsigned int antiAliasingLevel
Level of anti-aliasing.
unsigned int depthBits
Bits of the depth buffer.
bool sRgbCapable
Whether the context framebuffer is sRGB capable.
unsigned int stencilBits
Bits of the stencil buffer.
unsigned int majorVersion
Major number of the context version to create.
uint32_t attributeFlags
The attribute flags to create the context with.
unsigned int minorVersion
Minor number of the context version to create.
Represents a time value.
Definition Time.h:38
2-component vector of integers
Definition Vector2.h:38
2-component vector of unsigned integers
Definition Vector2.h:49
sfVideoMode defines a video mode (width, height, bpp, frequency) and provides functions for getting m...
Definition VideoMode.h:44
sfEvent defines a system event and its parameters
Definition Event.h:210