CSFML 3.0.0
Loading...
Searching...
No Matches
WindowBase.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/Window/Export.h>
31
32#include <CSFML/System/Time.h>
33#include <CSFML/System/Vector2.h>
34#include <CSFML/Window/Event.h>
35#include <CSFML/Window/Types.h>
36#include <CSFML/Window/VideoMode.h>
37#include <CSFML/Window/Vulkan.h>
38#include <CSFML/Window/WindowHandle.h>
39
40
45 typedef enum
46{
47 sfNone = 0,
48 sfTitlebar = 1 << 0,
49 sfResize = 1 << 1,
50 sfClose = 1 << 2,
51
52 sfDefaultStyle = sfTitlebar | sfResize | sfClose
53} sfWindowStyle;
54
55
60 typedef enum
61{
62 sfWindowed,
63 sfFullscreen
64} sfWindowState;
65
66
84 CSFML_WINDOW_API sfWindowBase* sfWindowBase_create(sfVideoMode mode, const char* title, uint32_t style, sfWindowState state);
85
103 CSFML_WINDOW_API sfWindowBase* sfWindowBase_createUnicode(sfVideoMode mode, const sfChar32* title, uint32_t style, sfWindowState state);
104
113 CSFML_WINDOW_API sfWindowBase* sfWindowBase_createFromHandle(sfWindowHandle handle);
114
121 CSFML_WINDOW_API void sfWindowBase_destroy(const sfWindowBase* windowBase);
122
135 CSFML_WINDOW_API void sfWindowBase_close(sfWindowBase* windowBase);
136
149 CSFML_WINDOW_API bool sfWindowBase_isOpen(const sfWindowBase* windowBase);
150
166 CSFML_WINDOW_API bool sfWindowBase_pollEvent(sfWindowBase* windowBase, sfEvent* event);
167
192 CSFML_WINDOW_API bool sfWindowBase_waitEvent(sfWindowBase* windowBase, sfTime timeout, sfEvent* event);
193
202 CSFML_WINDOW_API sfVector2i sfWindowBase_getPosition(const sfWindowBase* windowBase);
203
215 CSFML_WINDOW_API void sfWindowBase_setPosition(sfWindowBase* windowBase, sfVector2i position);
216
228 CSFML_WINDOW_API sfVector2u sfWindowBase_getSize(const sfWindowBase* windowBase);
229
237 CSFML_WINDOW_API void sfWindowBase_setSize(sfWindowBase* windowBase, sfVector2u size);
238
248 CSFML_WINDOW_API void sfWindowBase_setMinimumSize(sfWindowBase* windowBase, const sfVector2u* minimumSize);
249
259 CSFML_WINDOW_API void sfWindowBase_setMaximumSize(sfWindowBase* windowBase, const sfVector2u* maximumSize);
260
268 CSFML_WINDOW_API void sfWindowBase_setTitle(sfWindowBase* windowBase, const char* title);
269
277 CSFML_WINDOW_API void sfWindowBase_setUnicodeTitle(sfWindowBase* windowBase, const sfChar32* title);
278
290 CSFML_WINDOW_API void sfWindowBase_setIcon(sfWindowBase* windowBase, sfVector2u size, const uint8_t* pixels);
291
299 CSFML_WINDOW_API void sfWindowBase_setVisible(sfWindowBase* windowBase, bool visible);
300
308 CSFML_WINDOW_API void sfWindowBase_setMouseCursorVisible(sfWindowBase* windowBase, bool visible);
309
324 CSFML_WINDOW_API void sfWindowBase_setMouseCursorGrabbed(sfWindowBase* windowBase, bool grabbed);
325
344 CSFML_WINDOW_API void sfWindowBase_setMouseCursor(sfWindowBase* windowBase, const sfCursor* cursor);
345
359 CSFML_WINDOW_API void sfWindowBase_setKeyRepeatEnabled(sfWindowBase* windowBase, bool enabled);
360
371 CSFML_WINDOW_API void sfWindowBase_setJoystickThreshold(sfWindowBase* windowBase, float threshold);
372
384 CSFML_WINDOW_API void sfWindowBase_requestFocus(sfWindowBase* windowBase);
385
396 CSFML_WINDOW_API bool sfWindowBase_hasFocus(const sfWindowBase* windowBase);
397
412 CSFML_WINDOW_API sfWindowHandle sfWindowBase_getNativeHandle(const sfWindowBase* windowBase);
413
425 CSFML_WINDOW_API bool sfWindowBase_createVulkanSurface(sfWindowBase* windowBase,
426 const VkInstance* instance,
427 VkSurfaceKHR* surface,
428 const VkAllocationCallbacks* allocator);
sfChar32
uint32_t sfChar32
Define sfChar32.
Definition Config.h:161
Event.h
Time.h
Vector2.h
VideoMode.h
Vulkan.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
sfWindowBase_getPosition
sfVector2i sfWindowBase_getPosition(const sfWindowBase *windowBase)
Get the position of a window.
sfWindowBase_setUnicodeTitle
void sfWindowBase_setUnicodeTitle(sfWindowBase *windowBase, const sfChar32 *title)
Change the title of a window (with a UTF-32 string).
sfWindowBase_hasFocus
bool sfWindowBase_hasFocus(const sfWindowBase *windowBase)
Check whether the window has the input focus.
sfWindowBase_createVulkanSurface
bool sfWindowBase_createVulkanSurface(sfWindowBase *windowBase, const VkInstance *instance, VkSurfaceKHR *surface, const VkAllocationCallbacks *allocator)
Create a Vulkan rendering surface.
sfWindowBase_setSize
void sfWindowBase_setSize(sfWindowBase *windowBase, sfVector2u size)
Change the size of the rendering region of a window.
sfWindowBase_close
void sfWindowBase_close(sfWindowBase *windowBase)
Close a window and destroy all the attached resources.
sfWindowBase_setVisible
void sfWindowBase_setVisible(sfWindowBase *windowBase, bool visible)
Show or hide a window.
sfWindowBase_create
sfWindowBase * sfWindowBase_create(sfVideoMode mode, const char *title, uint32_t style, sfWindowState state)
Construct a new window.
sfWindowBase_setMinimumSize
void sfWindowBase_setMinimumSize(sfWindowBase *windowBase, const sfVector2u *minimumSize)
Set the minimum window rendering region size.
sfWindowBase_getSize
sfVector2u sfWindowBase_getSize(const sfWindowBase *windowBase)
Get the size of the rendering region of a window.
sfWindowBase_destroy
void sfWindowBase_destroy(const sfWindowBase *windowBase)
Destroy a window.
sfWindowBase_pollEvent
bool sfWindowBase_pollEvent(sfWindowBase *windowBase, sfEvent *event)
Pop the event on top of event queue, if any, and return it.
sfWindowBase_createUnicode
sfWindowBase * sfWindowBase_createUnicode(sfVideoMode mode, const sfChar32 *title, uint32_t style, sfWindowState state)
Construct a new window (with a UTF-32 title).
sfWindowBase_waitEvent
bool sfWindowBase_waitEvent(sfWindowBase *windowBase, sfTime timeout, sfEvent *event)
Wait for an event and return it.
sfWindowStyle
sfWindowStyle
Enumeration of window creation styles.
Definition WindowBase.h:46
sfResize
@ sfResize
Titlebar + resizable border + maximize button.
Definition WindowBase.h:49
sfDefaultStyle
@ sfDefaultStyle
Default window style.
Definition WindowBase.h:52
sfNone
@ sfNone
No border / title bar (this flag and all others are mutually exclusive).
Definition WindowBase.h:47
sfTitlebar
@ sfTitlebar
Title bar + fixed border.
Definition WindowBase.h:48
sfClose
@ sfClose
Titlebar + close button.
Definition WindowBase.h:50
sfWindowBase_setKeyRepeatEnabled
void sfWindowBase_setKeyRepeatEnabled(sfWindowBase *windowBase, bool enabled)
Enable or disable automatic key-repeat.
sfWindowBase_setIcon
void sfWindowBase_setIcon(sfWindowBase *windowBase, sfVector2u size, const uint8_t *pixels)
Change a window's icon.
sfWindowBase_createFromHandle
sfWindowBase * sfWindowBase_createFromHandle(sfWindowHandle handle)
Construct a window from an existing control.
sfWindowBase_getNativeHandle
sfWindowHandle sfWindowBase_getNativeHandle(const sfWindowBase *windowBase)
Get the OS-specific handle of the window.
sfWindowBase_setPosition
void sfWindowBase_setPosition(sfWindowBase *windowBase, sfVector2i position)
Change the position of a window on screen.
sfWindowBase_setTitle
void sfWindowBase_setTitle(sfWindowBase *windowBase, const char *title)
Change the title of a window.
sfWindowBase_requestFocus
void sfWindowBase_requestFocus(sfWindowBase *windowBase)
Request the current window to be made the active foreground window.
sfWindowBase_setJoystickThreshold
void sfWindowBase_setJoystickThreshold(sfWindowBase *windowBase, float threshold)
Change the joystick threshold.
sfWindowState
sfWindowState
Enumeration of the window states.
Definition WindowBase.h:61
sfFullscreen
@ sfFullscreen
Fullscreen window.
Definition WindowBase.h:63
sfWindowed
@ sfWindowed
Floating window.
Definition WindowBase.h:62
sfWindowBase_setMouseCursor
void sfWindowBase_setMouseCursor(sfWindowBase *windowBase, const sfCursor *cursor)
Set the displayed cursor to a native system cursor.
sfWindowBase_setMaximumSize
void sfWindowBase_setMaximumSize(sfWindowBase *windowBase, const sfVector2u *maximumSize)
Set the maximum window rendering region size.
sfWindowBase_setMouseCursorVisible
void sfWindowBase_setMouseCursorVisible(sfWindowBase *windowBase, bool visible)
Show or hide the mouse cursor.
sfWindowBase_setMouseCursorGrabbed
void sfWindowBase_setMouseCursorGrabbed(sfWindowBase *windowBase, bool grabbed)
Grab or release the mouse cursor.
sfWindowBase_isOpen
bool sfWindowBase_isOpen(const sfWindowBase *windowBase)
Tell whether or not a window is opened.
WindowHandle.h
Export.h
CSFML_WINDOW_API
#define CSFML_WINDOW_API
Definition Window/Export.h:42
Types.h
sfCursor
struct sfCursor sfCursor
Definition Window/Types.h:29
sfWindowBase
struct sfWindowBase sfWindowBase
Definition Window/Types.h:31
sfTime
Represents a time value.
Definition Time.h:38
sfVector2i
2-component vector of integers
Definition Vector2.h:38
sfVector2u
2-component vector of unsigned integers
Definition Vector2.h:49
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