CSFML

- Main Page
- Data Structures
- Files

- File List
- Globals

Window/Window.h
Go to the documentation of this file.
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
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/WindowHandle.h>
35 #include <SFML/Window/Types.h>
36 #include <SFML/System/Vector2.h>
37
38
43 enum
44 {
45 sfNone = 0,
46 sfTitlebar = 1 << 0,
47 sfResize = 1 << 1,
48 sfClose = 1 << 2,
49 sfFullscreen = 1 << 3,
50 sfDefaultStyle = sfTitlebar | sfResize | sfClose
51 };
52
53
58 typedef struct
59 {
60 unsigned int depthBits;
61 unsigned int stencilBits;
62 unsigned int antialiasingLevel;
63 unsigned int majorVersion;
64 unsigned int minorVersion;
65 } sfContextSettings;
66
67
89 CSFML_WINDOW_API sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings);
90
112 CSFML_WINDOW_API sfWindow* sfWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings);
113
130 CSFML_WINDOW_API sfWindow* sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings);
131
138 CSFML_WINDOW_API void sfWindow_destroy(sfWindow* window);
139
152 CSFML_WINDOW_API void sfWindow_close(sfWindow* window);
153
166 CSFML_WINDOW_API sfBool sfWindow_isOpen(const sfWindow* window);
167
181 CSFML_WINDOW_API sfContextSettings sfWindow_getSettings(const sfWindow* window);
182
198 CSFML_WINDOW_API sfBool sfWindow_pollEvent(sfWindow* window, sfEvent* event);
199
217 CSFML_WINDOW_API sfBool sfWindow_waitEvent(sfWindow* window, sfEvent* event);
218
227 CSFML_WINDOW_API sfVector2i sfWindow_getPosition(const sfWindow* window);
228
240 CSFML_WINDOW_API void sfWindow_setPosition(sfWindow* window, sfVector2i position);
241
253 CSFML_WINDOW_API sfVector2u sfWindow_getSize(const sfWindow* window);
254
262 CSFML_WINDOW_API void sfWindow_setSize(sfWindow* window, sfVector2u size);
263
271 CSFML_WINDOW_API void sfWindow_setTitle(sfWindow* window, const char* title);
272
280 CSFML_WINDOW_API void sfWindow_setUnicodeTitle(sfWindow* window, const sfUint32* title);
281
294 CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels);
295
303 CSFML_WINDOW_API void sfWindow_setVisible(sfWindow* window, sfBool visible);
304
312 CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool visible);
313
326 CSFML_WINDOW_API void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool enabled);
327
341 CSFML_WINDOW_API void sfWindow_setKeyRepeatEnabled(sfWindow* window, sfBool enabled);
342
359 CSFML_WINDOW_API sfBool sfWindow_setActive(sfWindow* window, sfBool active);
360
372 CSFML_WINDOW_API void sfWindow_display(sfWindow* window);
373
385 CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit);
386
397 CSFML_WINDOW_API void sfWindow_setJoystickThreshold(sfWindow* window, float threshold);
398
413 CSFML_WINDOW_API sfWindowHandle sfWindow_getSystemHandle(const sfWindow* window);
414
415
416 #endif // SFML_WINDOW_H
sfClose
Titlebar + close button.
Definition: Window/Window.h:48
sfWindow_destroy
CSFML_WINDOW_API void sfWindow_destroy(sfWindow *window)
Destroy a window.
sfWindow_createFromHandle
CSFML_WINDOW_API sfWindow * sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings *settings)
Construct a window from an existing control.
sfContextSettings::antialiasingLevel
unsigned int antialiasingLevel
Level of antialiasing.
Definition: Window/Window.h:62
sfContextSettings::stencilBits
unsigned int stencilBits
Bits of the stencil buffer.
Definition: Window/Window.h:61
sfWindow
struct sfWindow sfWindow
Definition: Window/Types.h:30
sfWindow_waitEvent
CSFML_WINDOW_API sfBool sfWindow_waitEvent(sfWindow *window, sfEvent *event)
Wait for an event and return it.
sfContextSettings::minorVersion
unsigned int minorVersion
Minor number of the context version to create.
Definition: Window/Window.h:64
sfWindow_setActive
CSFML_WINDOW_API sfBool sfWindow_setActive(sfWindow *window, sfBool active)
Activate or deactivate a window as the current target for OpenGL rendering.
sfContextSettings::majorVersion
unsigned int majorVersion
Major number of the context version to create.
Definition: Window/Window.h:63
sfWindow_setVisible
CSFML_WINDOW_API void sfWindow_setVisible(sfWindow *window, sfBool visible)
Show or hide a window.
sfWindow_create
CSFML_WINDOW_API sfWindow * sfWindow_create(sfVideoMode mode, const char *title, sfUint32 style, const sfContextSettings *settings)
Construct a new window.
Export.h
sfWindow_setPosition
CSFML_WINDOW_API void sfWindow_setPosition(sfWindow *window, sfVector2i position)
Change the position of a window on screen.
sfBool
int sfBool
Definition: Config.h:106
CSFML_WINDOW_API
#define CSFML_WINDOW_API
Definition: Window/Export.h:43
sfWindow_setTitle
CSFML_WINDOW_API void sfWindow_setTitle(sfWindow *window, const char *title)
Change the title of a window.
sfVector2i
2-component vector of integers
Definition: Vector2.h:38
sfEvent
sfEvent defines a system event and its parameters
Definition: Event.h:171
sfVector2u
2-component vector of unsigned integers
Definition: Vector2.h:49
sfWindow_getSystemHandle
CSFML_WINDOW_API sfWindowHandle sfWindow_getSystemHandle(const sfWindow *window)
Get the OS-specific handle of the window.
sfWindow_display
CSFML_WINDOW_API void sfWindow_display(sfWindow *window)
Display on screen what has been rendered to the window so far.
sfWindow_setFramerateLimit
CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow *window, unsigned int limit)
Limit the framerate to a maximum fixed frequency.
sfWindow_setKeyRepeatEnabled
CSFML_WINDOW_API void sfWindow_setKeyRepeatEnabled(sfWindow *window, sfBool enabled)
Enable or disable automatic key-repeat.
Vector2.h
sfWindow_pollEvent
CSFML_WINDOW_API sfBool sfWindow_pollEvent(sfWindow *window, sfEvent *event)
Pop the event on top of event queue, if any, and return it.
Types.h
sfUint32
unsigned int sfUint32
Definition: Config.h:129
sfWindow_getSettings
CSFML_WINDOW_API sfContextSettings sfWindow_getSettings(const sfWindow *window)
Get the settings of the OpenGL context of a window.
sfWindow_setIcon
CSFML_WINDOW_API void sfWindow_setIcon(sfWindow *window, unsigned int width, unsigned int height, const sfUint8 *pixels)
Change a window's icon.
WindowHandle.h
sfWindow_getSize
CSFML_WINDOW_API sfVector2u sfWindow_getSize(const sfWindow *window)
Get the size of the rendering region of a window.
sfWindow_setJoystickThreshold
CSFML_WINDOW_API void sfWindow_setJoystickThreshold(sfWindow *window, float threshold)
Change the joystick threshold.
sfWindow_isOpen
CSFML_WINDOW_API sfBool sfWindow_isOpen(const sfWindow *window)
Tell whether or not a window is opened.
sfNone
No border / title bar (this flag and all others are mutually exclusive)
Definition: Window/Window.h:45
sfWindow_createUnicode
CSFML_WINDOW_API sfWindow * sfWindow_createUnicode(sfVideoMode mode, const sfUint32 *title, sfUint32 style, const sfContextSettings *settings)
Construct a new window (with a UTF-32 title)
sfDefaultStyle
Default window style.
Definition: Window/Window.h:50
sfVideoMode
sfVideoMode defines a video mode (width, height, bpp, frequency) and provides functions for getting m...
Definition: VideoMode.h:40
VideoMode.h
sfWindow_close
CSFML_WINDOW_API void sfWindow_close(sfWindow *window)
Close a window and destroy all the attached resources.
sfFullscreen
Fullscreen mode (this flag and all others are mutually exclusive)
Definition: Window/Window.h:49
sfWindow_setUnicodeTitle
CSFML_WINDOW_API void sfWindow_setUnicodeTitle(sfWindow *window, const sfUint32 *title)
Change the title of a window (with a UTF-32 string)
sfUint8
unsigned char sfUint8
Definition: Config.h:121
sfWindow_setMouseCursorVisible
CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow *window, sfBool visible)
Show or hide the mouse cursor.
sfWindow_setVerticalSyncEnabled
CSFML_WINDOW_API void sfWindow_setVerticalSyncEnabled(sfWindow *window, sfBool enabled)
Enable or disable vertical synchronization.
Event.h
sfTitlebar
Title bar + fixed border.
Definition: Window/Window.h:46
sfWindow_getPosition
CSFML_WINDOW_API sfVector2i sfWindow_getPosition(const sfWindow *window)
Get the position of a window.
sfWindow_setSize
CSFML_WINDOW_API void sfWindow_setSize(sfWindow *window, sfVector2u size)
Change the size of the rendering region of a window.
sfContextSettings
Structure defining the window's creation settings.
Definition: Window/Window.h:58
sfContextSettings::depthBits
unsigned int depthBits
Bits of the depth buffer.
Definition: Window/Window.h:60
sfResize
Titlebar + resizable border + maximize button.
Definition: Window/Window.h:47