CSFML - C binding of the Simple and Fast Multimedia Library

CSFML

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Window/Window.h
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2023 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>
33#include <SFML/Window/VideoMode.h>
34#include <SFML/Window/WindowBase.h>
35#include <SFML/Window/WindowHandle.h>
36#include <SFML/Window/Types.h>
37#include <SFML/System/Vector2.h>
38
39
44typedef enum
45{
46 sfContextDefault = 0,
47 sfContextCore = 1 << 0,
48 sfContextDebug = 1 << 2
49} sfContextAttribute;
50
51
56 typedef struct
57{
58 unsigned int depthBits;
59 unsigned int stencilBits;
60 unsigned int antialiasingLevel;
61 unsigned int majorVersion;
62 unsigned int minorVersion;
63 sfUint32 attributeFlags;
64 sfBool sRgbCapable;
65} sfContextSettings;
66
67
89CSFML_WINDOW_API sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings);
90
112CSFML_WINDOW_API sfWindow* sfWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings);
113
130CSFML_WINDOW_API sfWindow* sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings);
131
138CSFML_WINDOW_API void sfWindow_destroy(sfWindow* window);
139
152CSFML_WINDOW_API void sfWindow_close(sfWindow* window);
153
166CSFML_WINDOW_API sfBool sfWindow_isOpen(const sfWindow* window);
167
181CSFML_WINDOW_API sfContextSettings sfWindow_getSettings(const sfWindow* window);
182
198CSFML_WINDOW_API sfBool sfWindow_pollEvent(sfWindow* window, sfEvent* event);
199
217CSFML_WINDOW_API sfBool sfWindow_waitEvent(sfWindow* window, sfEvent* event);
218
227CSFML_WINDOW_API sfVector2i sfWindow_getPosition(const sfWindow* window);
228
240CSFML_WINDOW_API void sfWindow_setPosition(sfWindow* window, sfVector2i position);
241
253CSFML_WINDOW_API sfVector2u sfWindow_getSize(const sfWindow* window);
254
262CSFML_WINDOW_API void sfWindow_setSize(sfWindow* window, sfVector2u size);
263
271CSFML_WINDOW_API void sfWindow_setTitle(sfWindow* window, const char* title);
272
280CSFML_WINDOW_API void sfWindow_setUnicodeTitle(sfWindow* window, const sfUint32* title);
281
294CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels);
295
303CSFML_WINDOW_API void sfWindow_setVisible(sfWindow* window, sfBool visible);
304
317CSFML_WINDOW_API void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool enabled);
318
326CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool visible);
327
341CSFML_WINDOW_API void sfWindow_setMouseCursorGrabbed(sfWindow* window, sfBool grabbed);
342
361CSFML_WINDOW_API void sfWindow_setMouseCursor(sfWindow* window, const sfCursor* cursor);
362
376CSFML_WINDOW_API void sfWindow_setKeyRepeatEnabled(sfWindow* window, sfBool enabled);
377
389CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit);
390
401CSFML_WINDOW_API void sfWindow_setJoystickThreshold(sfWindow* window, float threshold);
402
420CSFML_WINDOW_API sfBool sfWindow_setActive(sfWindow* window, sfBool active);
421
434CSFML_WINDOW_API void sfWindow_requestFocus(sfWindow* window);
435
446CSFML_WINDOW_API sfBool sfWindow_hasFocus(const sfWindow* window);
447
459CSFML_WINDOW_API void sfWindow_display(sfWindow* window);
460
475CSFML_WINDOW_API sfWindowHandle sfWindow_getSystemHandle(const sfWindow* window);
476
477
478#endif // SFML_WINDOW_H
sfContextSettings
Structure defining the window's creation settings.
Definition Window/Window.h:57
sfContextSettings::attributeFlags
sfUint32 attributeFlags
The attribute flags to create the context with.
Definition Window/Window.h:63
sfContextSettings::depthBits
unsigned int depthBits
Bits of the depth buffer.
Definition Window/Window.h:58
sfContextSettings::stencilBits
unsigned int stencilBits
Bits of the stencil buffer.
Definition Window/Window.h:59
sfContextSettings::majorVersion
unsigned int majorVersion
Major number of the context version to create.
Definition Window/Window.h:61
sfContextSettings::minorVersion
unsigned int minorVersion
Minor number of the context version to create.
Definition Window/Window.h:62
sfContextSettings::antialiasingLevel
unsigned int antialiasingLevel
Level of antialiasing.
Definition Window/Window.h:60
sfContextSettings::sRgbCapable
sfBool sRgbCapable
Whether the context framebuffer is sRGB capable.
Definition Window/Window.h:64
sfVector2i
2-component vector of integers
Definition Vector2.h:39
sfVector2u
2-component vector of unsigned integers
Definition Vector2.h:50
sfVideoMode
sfVideoMode defines a video mode (width, height, bpp, frequency) and provides functions for getting m...
Definition VideoMode.h:42
sfEvent
sfEvent defines a system event and its parameters
Definition Event.h:222