summaryrefslogtreecommitdiff
path: root/externals/glfw-3.1.1.bin/include/GLFW/glfw3.h
diff options
context:
space:
mode:
Diffstat (limited to 'externals/glfw-3.1.1.bin/include/GLFW/glfw3.h')
-rw-r--r--externals/glfw-3.1.1.bin/include/GLFW/glfw3.h3340
1 files changed, 3340 insertions, 0 deletions
diff --git a/externals/glfw-3.1.1.bin/include/GLFW/glfw3.h b/externals/glfw-3.1.1.bin/include/GLFW/glfw3.h
new file mode 100644
index 000000000..009fa755f
--- /dev/null
+++ b/externals/glfw-3.1.1.bin/include/GLFW/glfw3.h
@@ -0,0 +1,3340 @@
1/*************************************************************************
2 * GLFW 3.1 - www.glfw.org
3 * A library for OpenGL, window and input
4 *------------------------------------------------------------------------
5 * Copyright (c) 2002-2006 Marcus Geelnard
6 * Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
7 *
8 * This software is provided 'as-is', without any express or implied
9 * warranty. In no event will the authors be held liable for any damages
10 * arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose,
13 * including commercial applications, and to alter it and redistribute it
14 * freely, subject to the following restrictions:
15 *
16 * 1. The origin of this software must not be misrepresented; you must not
17 * claim that you wrote the original software. If you use this software
18 * in a product, an acknowledgment in the product documentation would
19 * be appreciated but is not required.
20 *
21 * 2. Altered source versions must be plainly marked as such, and must not
22 * be misrepresented as being the original software.
23 *
24 * 3. This notice may not be removed or altered from any source
25 * distribution.
26 *
27 *************************************************************************/
28
29#ifndef _glfw3_h_
30#define _glfw3_h_
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36
37/*************************************************************************
38 * Doxygen documentation
39 *************************************************************************/
40
41/*! @defgroup context Context handling
42 *
43 * This is the reference documentation for context related functions. For more
44 * information, see the @ref context.
45 */
46/*! @defgroup init Initialization, version and errors
47 *
48 * This is the reference documentation for initialization and termination of
49 * the library, version management and error handling. For more information,
50 * see the @ref intro.
51 */
52/*! @defgroup input Input handling
53 *
54 * This is the reference documentation for input related functions and types.
55 * For more information, see the @ref input.
56 */
57/*! @defgroup monitor Monitor handling
58 *
59 * This is the reference documentation for monitor related functions and types.
60 * For more information, see the @ref monitor.
61 */
62/*! @defgroup window Window handling
63 *
64 * This is the reference documentation for window related functions and types,
65 * including creation, deletion and event polling. For more information, see
66 * the @ref window.
67 */
68
69
70/*************************************************************************
71 * Compiler- and platform-specific preprocessor work
72 *************************************************************************/
73
74/* If we are we on Windows, we want a single define for it.
75 */
76#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
77 #define _WIN32
78#endif /* _WIN32 */
79
80/* It is customary to use APIENTRY for OpenGL function pointer declarations on
81 * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
82 */
83#ifndef APIENTRY
84 #ifdef _WIN32
85 #define APIENTRY __stdcall
86 #else
87 #define APIENTRY
88 #endif
89#endif /* APIENTRY */
90
91/* Some Windows OpenGL headers need this.
92 */
93#if !defined(WINGDIAPI) && defined(_WIN32)
94 #define WINGDIAPI __declspec(dllimport)
95 #define GLFW_WINGDIAPI_DEFINED
96#endif /* WINGDIAPI */
97
98/* Some Windows GLU headers need this.
99 */
100#if !defined(CALLBACK) && defined(_WIN32)
101 #define CALLBACK __stdcall
102 #define GLFW_CALLBACK_DEFINED
103#endif /* CALLBACK */
104
105/* Most Windows GLU headers need wchar_t.
106 * The OS X OpenGL header blocks the definition of ptrdiff_t by glext.h.
107 */
108#if !defined(GLFW_INCLUDE_NONE)
109 #include <stddef.h>
110#endif
111
112/* Include the chosen client API headers.
113 */
114#if defined(__APPLE_CC__)
115 #if defined(GLFW_INCLUDE_GLCOREARB)
116 #include <OpenGL/gl3.h>
117 #if defined(GLFW_INCLUDE_GLEXT)
118 #include <OpenGL/gl3ext.h>
119 #endif
120 #elif !defined(GLFW_INCLUDE_NONE)
121 #if !defined(GLFW_INCLUDE_GLEXT)
122 #define GL_GLEXT_LEGACY
123 #endif
124 #include <OpenGL/gl.h>
125 #endif
126 #if defined(GLFW_INCLUDE_GLU)
127 #include <OpenGL/glu.h>
128 #endif
129#else
130 #if defined(GLFW_INCLUDE_GLCOREARB)
131 #include <GL/glcorearb.h>
132 #elif defined(GLFW_INCLUDE_ES1)
133 #include <GLES/gl.h>
134 #if defined(GLFW_INCLUDE_GLEXT)
135 #include <GLES/glext.h>
136 #endif
137 #elif defined(GLFW_INCLUDE_ES2)
138 #include <GLES2/gl2.h>
139 #if defined(GLFW_INCLUDE_GLEXT)
140 #include <GLES2/gl2ext.h>
141 #endif
142 #elif defined(GLFW_INCLUDE_ES3)
143 #include <GLES3/gl3.h>
144 #if defined(GLFW_INCLUDE_GLEXT)
145 #include <GLES3/gl2ext.h>
146 #endif
147 #elif defined(GLFW_INCLUDE_ES31)
148 #include <GLES3/gl31.h>
149 #if defined(GLFW_INCLUDE_GLEXT)
150 #include <GLES3/gl2ext.h>
151 #endif
152 #elif !defined(GLFW_INCLUDE_NONE)
153 #include <GL/gl.h>
154 #if defined(GLFW_INCLUDE_GLEXT)
155 #include <GL/glext.h>
156 #endif
157 #endif
158 #if defined(GLFW_INCLUDE_GLU)
159 #include <GL/glu.h>
160 #endif
161#endif
162
163#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
164 /* GLFW_DLL must be defined by applications that are linking against the DLL
165 * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
166 * configuration header when compiling the DLL version of the library.
167 */
168 #error "You may not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
169#endif
170
171/* GLFWAPI is used to declare public API functions for export
172 * from the DLL / shared library / dynamic library.
173 */
174#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
175 /* We are building GLFW as a Win32 DLL */
176 #define GLFWAPI __declspec(dllexport)
177#elif defined(_WIN32) && defined(GLFW_DLL)
178 /* We are calling GLFW as a Win32 DLL */
179 #define GLFWAPI __declspec(dllimport)
180#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
181 /* We are building GLFW as a shared / dynamic library */
182 #define GLFWAPI __attribute__((visibility("default")))
183#else
184 /* We are building or calling GLFW as a static library */
185 #define GLFWAPI
186#endif
187
188
189/*************************************************************************
190 * GLFW API tokens
191 *************************************************************************/
192
193/*! @name GLFW version macros
194 * @{ */
195/*! @brief The major version number of the GLFW library.
196 *
197 * This is incremented when the API is changed in non-compatible ways.
198 * @ingroup init
199 */
200#define GLFW_VERSION_MAJOR 3
201/*! @brief The minor version number of the GLFW library.
202 *
203 * This is incremented when features are added to the API but it remains
204 * backward-compatible.
205 * @ingroup init
206 */
207#define GLFW_VERSION_MINOR 1
208/*! @brief The revision number of the GLFW library.
209 *
210 * This is incremented when a bug fix release is made that does not contain any
211 * API changes.
212 * @ingroup init
213 */
214#define GLFW_VERSION_REVISION 1
215/*! @} */
216
217/*! @name Key and button actions
218 * @{ */
219/*! @brief The key or mouse button was released.
220 *
221 * The key or mouse button was released.
222 *
223 * @ingroup input
224 */
225#define GLFW_RELEASE 0
226/*! @brief The key or mouse button was pressed.
227 *
228 * The key or mouse button was pressed.
229 *
230 * @ingroup input
231 */
232#define GLFW_PRESS 1
233/*! @brief The key was held down until it repeated.
234 *
235 * The key was held down until it repeated.
236 *
237 * @ingroup input
238 */
239#define GLFW_REPEAT 2
240/*! @} */
241
242/*! @defgroup keys Keyboard keys
243 *
244 * See [key input](@ref input_key) for how these are used.
245 *
246 * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
247 * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
248 * put in the 256+ range).
249 *
250 * The naming of the key codes follow these rules:
251 * - The US keyboard layout is used
252 * - Names of printable alpha-numeric characters are used (e.g. "A", "R",
253 * "3", etc.)
254 * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
255 * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
256 * correspond to the Unicode standard (usually for brevity)
257 * - Keys that lack a clear US mapping are named "WORLD_x"
258 * - For non-printable keys, custom names are used (e.g. "F4",
259 * "BACKSPACE", etc.)
260 *
261 * @ingroup input
262 * @{
263 */
264
265/* The unknown key */
266#define GLFW_KEY_UNKNOWN -1
267
268/* Printable keys */
269#define GLFW_KEY_SPACE 32
270#define GLFW_KEY_APOSTROPHE 39 /* ' */
271#define GLFW_KEY_COMMA 44 /* , */
272#define GLFW_KEY_MINUS 45 /* - */
273#define GLFW_KEY_PERIOD 46 /* . */
274#define GLFW_KEY_SLASH 47 /* / */
275#define GLFW_KEY_0 48
276#define GLFW_KEY_1 49
277#define GLFW_KEY_2 50
278#define GLFW_KEY_3 51
279#define GLFW_KEY_4 52
280#define GLFW_KEY_5 53
281#define GLFW_KEY_6 54
282#define GLFW_KEY_7 55
283#define GLFW_KEY_8 56
284#define GLFW_KEY_9 57
285#define GLFW_KEY_SEMICOLON 59 /* ; */
286#define GLFW_KEY_EQUAL 61 /* = */
287#define GLFW_KEY_A 65
288#define GLFW_KEY_B 66
289#define GLFW_KEY_C 67
290#define GLFW_KEY_D 68
291#define GLFW_KEY_E 69
292#define GLFW_KEY_F 70
293#define GLFW_KEY_G 71
294#define GLFW_KEY_H 72
295#define GLFW_KEY_I 73
296#define GLFW_KEY_J 74
297#define GLFW_KEY_K 75
298#define GLFW_KEY_L 76
299#define GLFW_KEY_M 77
300#define GLFW_KEY_N 78
301#define GLFW_KEY_O 79
302#define GLFW_KEY_P 80
303#define GLFW_KEY_Q 81
304#define GLFW_KEY_R 82
305#define GLFW_KEY_S 83
306#define GLFW_KEY_T 84
307#define GLFW_KEY_U 85
308#define GLFW_KEY_V 86
309#define GLFW_KEY_W 87
310#define GLFW_KEY_X 88
311#define GLFW_KEY_Y 89
312#define GLFW_KEY_Z 90
313#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
314#define GLFW_KEY_BACKSLASH 92 /* \ */
315#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
316#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
317#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
318#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
319
320/* Function keys */
321#define GLFW_KEY_ESCAPE 256
322#define GLFW_KEY_ENTER 257
323#define GLFW_KEY_TAB 258
324#define GLFW_KEY_BACKSPACE 259
325#define GLFW_KEY_INSERT 260
326#define GLFW_KEY_DELETE 261
327#define GLFW_KEY_RIGHT 262
328#define GLFW_KEY_LEFT 263
329#define GLFW_KEY_DOWN 264
330#define GLFW_KEY_UP 265
331#define GLFW_KEY_PAGE_UP 266
332#define GLFW_KEY_PAGE_DOWN 267
333#define GLFW_KEY_HOME 268
334#define GLFW_KEY_END 269
335#define GLFW_KEY_CAPS_LOCK 280
336#define GLFW_KEY_SCROLL_LOCK 281
337#define GLFW_KEY_NUM_LOCK 282
338#define GLFW_KEY_PRINT_SCREEN 283
339#define GLFW_KEY_PAUSE 284
340#define GLFW_KEY_F1 290
341#define GLFW_KEY_F2 291
342#define GLFW_KEY_F3 292
343#define GLFW_KEY_F4 293
344#define GLFW_KEY_F5 294
345#define GLFW_KEY_F6 295
346#define GLFW_KEY_F7 296
347#define GLFW_KEY_F8 297
348#define GLFW_KEY_F9 298
349#define GLFW_KEY_F10 299
350#define GLFW_KEY_F11 300
351#define GLFW_KEY_F12 301
352#define GLFW_KEY_F13 302
353#define GLFW_KEY_F14 303
354#define GLFW_KEY_F15 304
355#define GLFW_KEY_F16 305
356#define GLFW_KEY_F17 306
357#define GLFW_KEY_F18 307
358#define GLFW_KEY_F19 308
359#define GLFW_KEY_F20 309
360#define GLFW_KEY_F21 310
361#define GLFW_KEY_F22 311
362#define GLFW_KEY_F23 312
363#define GLFW_KEY_F24 313
364#define GLFW_KEY_F25 314
365#define GLFW_KEY_KP_0 320
366#define GLFW_KEY_KP_1 321
367#define GLFW_KEY_KP_2 322
368#define GLFW_KEY_KP_3 323
369#define GLFW_KEY_KP_4 324
370#define GLFW_KEY_KP_5 325
371#define GLFW_KEY_KP_6 326
372#define GLFW_KEY_KP_7 327
373#define GLFW_KEY_KP_8 328
374#define GLFW_KEY_KP_9 329
375#define GLFW_KEY_KP_DECIMAL 330
376#define GLFW_KEY_KP_DIVIDE 331
377#define GLFW_KEY_KP_MULTIPLY 332
378#define GLFW_KEY_KP_SUBTRACT 333
379#define GLFW_KEY_KP_ADD 334
380#define GLFW_KEY_KP_ENTER 335
381#define GLFW_KEY_KP_EQUAL 336
382#define GLFW_KEY_LEFT_SHIFT 340
383#define GLFW_KEY_LEFT_CONTROL 341
384#define GLFW_KEY_LEFT_ALT 342
385#define GLFW_KEY_LEFT_SUPER 343
386#define GLFW_KEY_RIGHT_SHIFT 344
387#define GLFW_KEY_RIGHT_CONTROL 345
388#define GLFW_KEY_RIGHT_ALT 346
389#define GLFW_KEY_RIGHT_SUPER 347
390#define GLFW_KEY_MENU 348
391#define GLFW_KEY_LAST GLFW_KEY_MENU
392
393/*! @} */
394
395/*! @defgroup mods Modifier key flags
396 *
397 * See [key input](@ref input_key) for how these are used.
398 *
399 * @ingroup input
400 * @{ */
401
402/*! @brief If this bit is set one or more Shift keys were held down.
403 */
404#define GLFW_MOD_SHIFT 0x0001
405/*! @brief If this bit is set one or more Control keys were held down.
406 */
407#define GLFW_MOD_CONTROL 0x0002
408/*! @brief If this bit is set one or more Alt keys were held down.
409 */
410#define GLFW_MOD_ALT 0x0004
411/*! @brief If this bit is set one or more Super keys were held down.
412 */
413#define GLFW_MOD_SUPER 0x0008
414
415/*! @} */
416
417/*! @defgroup buttons Mouse buttons
418 *
419 * See [mouse button input](@ref input_mouse_button) for how these are used.
420 *
421 * @ingroup input
422 * @{ */
423#define GLFW_MOUSE_BUTTON_1 0
424#define GLFW_MOUSE_BUTTON_2 1
425#define GLFW_MOUSE_BUTTON_3 2
426#define GLFW_MOUSE_BUTTON_4 3
427#define GLFW_MOUSE_BUTTON_5 4
428#define GLFW_MOUSE_BUTTON_6 5
429#define GLFW_MOUSE_BUTTON_7 6
430#define GLFW_MOUSE_BUTTON_8 7
431#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
432#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
433#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
434#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
435/*! @} */
436
437/*! @defgroup joysticks Joysticks
438 *
439 * See [joystick input](@ref joystick) for how these are used.
440 *
441 * @ingroup input
442 * @{ */
443#define GLFW_JOYSTICK_1 0
444#define GLFW_JOYSTICK_2 1
445#define GLFW_JOYSTICK_3 2
446#define GLFW_JOYSTICK_4 3
447#define GLFW_JOYSTICK_5 4
448#define GLFW_JOYSTICK_6 5
449#define GLFW_JOYSTICK_7 6
450#define GLFW_JOYSTICK_8 7
451#define GLFW_JOYSTICK_9 8
452#define GLFW_JOYSTICK_10 9
453#define GLFW_JOYSTICK_11 10
454#define GLFW_JOYSTICK_12 11
455#define GLFW_JOYSTICK_13 12
456#define GLFW_JOYSTICK_14 13
457#define GLFW_JOYSTICK_15 14
458#define GLFW_JOYSTICK_16 15
459#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
460/*! @} */
461
462/*! @defgroup errors Error codes
463 *
464 * See [error handling](@ref error_handling) for how these are used.
465 *
466 * @ingroup init
467 * @{ */
468/*! @brief GLFW has not been initialized.
469 *
470 * This occurs if a GLFW function was called that may not be called unless the
471 * library is [initialized](@ref intro_init).
472 *
473 * @par Analysis
474 * Application programmer error. Initialize GLFW before calling any function
475 * that requires initialization.
476 */
477#define GLFW_NOT_INITIALIZED 0x00010001
478/*! @brief No context is current for this thread.
479 *
480 * This occurs if a GLFW function was called that needs and operates on the
481 * current OpenGL or OpenGL ES context but no context is current on the calling
482 * thread. One such function is @ref glfwSwapInterval.
483 *
484 * @par Analysis
485 * Application programmer error. Ensure a context is current before calling
486 * functions that require a current context.
487 */
488#define GLFW_NO_CURRENT_CONTEXT 0x00010002
489/*! @brief One of the arguments to the function was an invalid enum value.
490 *
491 * One of the arguments to the function was an invalid enum value, for example
492 * requesting [GLFW_RED_BITS](@ref window_hints_fb) with @ref
493 * glfwGetWindowAttrib.
494 *
495 * @par Analysis
496 * Application programmer error. Fix the offending call.
497 */
498#define GLFW_INVALID_ENUM 0x00010003
499/*! @brief One of the arguments to the function was an invalid value.
500 *
501 * One of the arguments to the function was an invalid value, for example
502 * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
503 *
504 * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
505 * result in a @ref GLFW_VERSION_UNAVAILABLE error.
506 *
507 * @par Analysis
508 * Application programmer error. Fix the offending call.
509 */
510#define GLFW_INVALID_VALUE 0x00010004
511/*! @brief A memory allocation failed.
512 *
513 * A memory allocation failed.
514 *
515 * @par Analysis
516 * A bug in GLFW or the underlying operating system. Report the bug to our
517 * [issue tracker](https://github.com/glfw/glfw/issues).
518 */
519#define GLFW_OUT_OF_MEMORY 0x00010005
520/*! @brief GLFW could not find support for the requested client API on the
521 * system.
522 *
523 * GLFW could not find support for the requested client API on the system. If
524 * emitted by functions other than @ref glfwCreateWindow, no supported client
525 * API was found.
526 *
527 * @par Analysis
528 * The installed graphics driver does not support the requested client API, or
529 * does not support it via the chosen context creation backend. Below are
530 * a few examples.
531 *
532 * @par
533 * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
534 * supports OpenGL ES via EGL, while Nvidia and Intel only supports it via
535 * a WGL or GLX extension. OS X does not provide OpenGL ES at all. The Mesa
536 * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
537 * driver.
538 */
539#define GLFW_API_UNAVAILABLE 0x00010006
540/*! @brief The requested OpenGL or OpenGL ES version is not available.
541 *
542 * The requested OpenGL or OpenGL ES version (including any requested context
543 * or framebuffer hints) is not available on this machine.
544 *
545 * @par Analysis
546 * The machine does not support your requirements. If your application is
547 * sufficiently flexible, downgrade your requirements and try again.
548 * Otherwise, inform the user that their machine does not match your
549 * requirements.
550 *
551 * @par
552 * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
553 * comes out before the 4.x series gets that far, also fail with this error and
554 * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
555 * will exist.
556 */
557#define GLFW_VERSION_UNAVAILABLE 0x00010007
558/*! @brief A platform-specific error occurred that does not match any of the
559 * more specific categories.
560 *
561 * A platform-specific error occurred that does not match any of the more
562 * specific categories.
563 *
564 * @par Analysis
565 * A bug or configuration error in GLFW, the underlying operating system or
566 * its drivers, or a lack of required resources. Report the issue to our
567 * [issue tracker](https://github.com/glfw/glfw/issues).
568 */
569#define GLFW_PLATFORM_ERROR 0x00010008
570/*! @brief The requested format is not supported or available.
571 *
572 * If emitted during window creation, the requested pixel format is not
573 * supported.
574 *
575 * If emitted when querying the clipboard, the contents of the clipboard could
576 * not be converted to the requested format.
577 *
578 * @par Analysis
579 * If emitted during window creation, one or more
580 * [hard constraints](@ref window_hints_hard) did not match any of the
581 * available pixel formats. If your application is sufficiently flexible,
582 * downgrade your requirements and try again. Otherwise, inform the user that
583 * their machine does not match your requirements.
584 *
585 * @par
586 * If emitted when querying the clipboard, ignore the error or report it to
587 * the user, as appropriate.
588 */
589#define GLFW_FORMAT_UNAVAILABLE 0x00010009
590/*! @} */
591
592#define GLFW_FOCUSED 0x00020001
593#define GLFW_ICONIFIED 0x00020002
594#define GLFW_RESIZABLE 0x00020003
595#define GLFW_VISIBLE 0x00020004
596#define GLFW_DECORATED 0x00020005
597#define GLFW_AUTO_ICONIFY 0x00020006
598#define GLFW_FLOATING 0x00020007
599
600#define GLFW_RED_BITS 0x00021001
601#define GLFW_GREEN_BITS 0x00021002
602#define GLFW_BLUE_BITS 0x00021003
603#define GLFW_ALPHA_BITS 0x00021004
604#define GLFW_DEPTH_BITS 0x00021005
605#define GLFW_STENCIL_BITS 0x00021006
606#define GLFW_ACCUM_RED_BITS 0x00021007
607#define GLFW_ACCUM_GREEN_BITS 0x00021008
608#define GLFW_ACCUM_BLUE_BITS 0x00021009
609#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
610#define GLFW_AUX_BUFFERS 0x0002100B
611#define GLFW_STEREO 0x0002100C
612#define GLFW_SAMPLES 0x0002100D
613#define GLFW_SRGB_CAPABLE 0x0002100E
614#define GLFW_REFRESH_RATE 0x0002100F
615#define GLFW_DOUBLEBUFFER 0x00021010
616
617#define GLFW_CLIENT_API 0x00022001
618#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
619#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
620#define GLFW_CONTEXT_REVISION 0x00022004
621#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
622#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
623#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
624#define GLFW_OPENGL_PROFILE 0x00022008
625#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
626
627#define GLFW_OPENGL_API 0x00030001
628#define GLFW_OPENGL_ES_API 0x00030002
629
630#define GLFW_NO_ROBUSTNESS 0
631#define GLFW_NO_RESET_NOTIFICATION 0x00031001
632#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
633
634#define GLFW_OPENGL_ANY_PROFILE 0
635#define GLFW_OPENGL_CORE_PROFILE 0x00032001
636#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
637
638#define GLFW_CURSOR 0x00033001
639#define GLFW_STICKY_KEYS 0x00033002
640#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
641
642#define GLFW_CURSOR_NORMAL 0x00034001
643#define GLFW_CURSOR_HIDDEN 0x00034002
644#define GLFW_CURSOR_DISABLED 0x00034003
645
646#define GLFW_ANY_RELEASE_BEHAVIOR 0
647#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
648#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
649
650/*! @defgroup shapes Standard cursor shapes
651 *
652 * See [standard cursor creation](@ref cursor_standard) for how these are used.
653 *
654 * @ingroup input
655 * @{ */
656
657/*! @brief The regular arrow cursor shape.
658 *
659 * The regular arrow cursor.
660 */
661#define GLFW_ARROW_CURSOR 0x00036001
662/*! @brief The text input I-beam cursor shape.
663 *
664 * The text input I-beam cursor shape.
665 */
666#define GLFW_IBEAM_CURSOR 0x00036002
667/*! @brief The crosshair shape.
668 *
669 * The crosshair shape.
670 */
671#define GLFW_CROSSHAIR_CURSOR 0x00036003
672/*! @brief The hand shape.
673 *
674 * The hand shape.
675 */
676#define GLFW_HAND_CURSOR 0x00036004
677/*! @brief The horizontal resize arrow shape.
678 *
679 * The horizontal resize arrow shape.
680 */
681#define GLFW_HRESIZE_CURSOR 0x00036005
682/*! @brief The vertical resize arrow shape.
683 *
684 * The vertical resize arrow shape.
685 */
686#define GLFW_VRESIZE_CURSOR 0x00036006
687/*! @} */
688
689#define GLFW_CONNECTED 0x00040001
690#define GLFW_DISCONNECTED 0x00040002
691
692#define GLFW_DONT_CARE -1
693
694
695/*************************************************************************
696 * GLFW API types
697 *************************************************************************/
698
699/*! @brief Client API function pointer type.
700 *
701 * Generic function pointer used for returning client API function pointers
702 * without forcing a cast from a regular pointer.
703 *
704 * @ingroup context
705 */
706typedef void (*GLFWglproc)(void);
707
708/*! @brief Opaque monitor object.
709 *
710 * Opaque monitor object.
711 *
712 * @ingroup monitor
713 */
714typedef struct GLFWmonitor GLFWmonitor;
715
716/*! @brief Opaque window object.
717 *
718 * Opaque window object.
719 *
720 * @ingroup window
721 */
722typedef struct GLFWwindow GLFWwindow;
723
724/*! @brief Opaque cursor object.
725 *
726 * Opaque cursor object.
727 *
728 * @ingroup cursor
729 */
730typedef struct GLFWcursor GLFWcursor;
731
732/*! @brief The function signature for error callbacks.
733 *
734 * This is the function signature for error callback functions.
735 *
736 * @param[in] error An [error code](@ref errors).
737 * @param[in] description A UTF-8 encoded string describing the error.
738 *
739 * @sa glfwSetErrorCallback
740 *
741 * @ingroup init
742 */
743typedef void (* GLFWerrorfun)(int,const char*);
744
745/*! @brief The function signature for window position callbacks.
746 *
747 * This is the function signature for window position callback functions.
748 *
749 * @param[in] window The window that was moved.
750 * @param[in] xpos The new x-coordinate, in screen coordinates, of the
751 * upper-left corner of the client area of the window.
752 * @param[in] ypos The new y-coordinate, in screen coordinates, of the
753 * upper-left corner of the client area of the window.
754 *
755 * @sa glfwSetWindowPosCallback
756 *
757 * @ingroup window
758 */
759typedef void (* GLFWwindowposfun)(GLFWwindow*,int,int);
760
761/*! @brief The function signature for window resize callbacks.
762 *
763 * This is the function signature for window size callback functions.
764 *
765 * @param[in] window The window that was resized.
766 * @param[in] width The new width, in screen coordinates, of the window.
767 * @param[in] height The new height, in screen coordinates, of the window.
768 *
769 * @sa glfwSetWindowSizeCallback
770 *
771 * @ingroup window
772 */
773typedef void (* GLFWwindowsizefun)(GLFWwindow*,int,int);
774
775/*! @brief The function signature for window close callbacks.
776 *
777 * This is the function signature for window close callback functions.
778 *
779 * @param[in] window The window that the user attempted to close.
780 *
781 * @sa glfwSetWindowCloseCallback
782 *
783 * @ingroup window
784 */
785typedef void (* GLFWwindowclosefun)(GLFWwindow*);
786
787/*! @brief The function signature for window content refresh callbacks.
788 *
789 * This is the function signature for window refresh callback functions.
790 *
791 * @param[in] window The window whose content needs to be refreshed.
792 *
793 * @sa glfwSetWindowRefreshCallback
794 *
795 * @ingroup window
796 */
797typedef void (* GLFWwindowrefreshfun)(GLFWwindow*);
798
799/*! @brief The function signature for window focus/defocus callbacks.
800 *
801 * This is the function signature for window focus callback functions.
802 *
803 * @param[in] window The window that gained or lost input focus.
804 * @param[in] focused `GL_TRUE` if the window was given input focus, or
805 * `GL_FALSE` if it lost it.
806 *
807 * @sa glfwSetWindowFocusCallback
808 *
809 * @ingroup window
810 */
811typedef void (* GLFWwindowfocusfun)(GLFWwindow*,int);
812
813/*! @brief The function signature for window iconify/restore callbacks.
814 *
815 * This is the function signature for window iconify/restore callback
816 * functions.
817 *
818 * @param[in] window The window that was iconified or restored.
819 * @param[in] iconified `GL_TRUE` if the window was iconified, or `GL_FALSE`
820 * if it was restored.
821 *
822 * @sa glfwSetWindowIconifyCallback
823 *
824 * @ingroup window
825 */
826typedef void (* GLFWwindowiconifyfun)(GLFWwindow*,int);
827
828/*! @brief The function signature for framebuffer resize callbacks.
829 *
830 * This is the function signature for framebuffer resize callback
831 * functions.
832 *
833 * @param[in] window The window whose framebuffer was resized.
834 * @param[in] width The new width, in pixels, of the framebuffer.
835 * @param[in] height The new height, in pixels, of the framebuffer.
836 *
837 * @sa glfwSetFramebufferSizeCallback
838 *
839 * @ingroup window
840 */
841typedef void (* GLFWframebuffersizefun)(GLFWwindow*,int,int);
842
843/*! @brief The function signature for mouse button callbacks.
844 *
845 * This is the function signature for mouse button callback functions.
846 *
847 * @param[in] window The window that received the event.
848 * @param[in] button The [mouse button](@ref buttons) that was pressed or
849 * released.
850 * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`.
851 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
852 * held down.
853 *
854 * @sa glfwSetMouseButtonCallback
855 *
856 * @ingroup input
857 */
858typedef void (* GLFWmousebuttonfun)(GLFWwindow*,int,int,int);
859
860/*! @brief The function signature for cursor position callbacks.
861 *
862 * This is the function signature for cursor position callback functions.
863 *
864 * @param[in] window The window that received the event.
865 * @param[in] xpos The new x-coordinate, in screen coordinates, of the cursor.
866 * @param[in] ypos The new y-coordinate, in screen coordinates, of the cursor.
867 *
868 * @sa glfwSetCursorPosCallback
869 *
870 * @ingroup input
871 */
872typedef void (* GLFWcursorposfun)(GLFWwindow*,double,double);
873
874/*! @brief The function signature for cursor enter/leave callbacks.
875 *
876 * This is the function signature for cursor enter/leave callback functions.
877 *
878 * @param[in] window The window that received the event.
879 * @param[in] entered `GL_TRUE` if the cursor entered the window's client
880 * area, or `GL_FALSE` if it left it.
881 *
882 * @sa glfwSetCursorEnterCallback
883 *
884 * @ingroup input
885 */
886typedef void (* GLFWcursorenterfun)(GLFWwindow*,int);
887
888/*! @brief The function signature for scroll callbacks.
889 *
890 * This is the function signature for scroll callback functions.
891 *
892 * @param[in] window The window that received the event.
893 * @param[in] xoffset The scroll offset along the x-axis.
894 * @param[in] yoffset The scroll offset along the y-axis.
895 *
896 * @sa glfwSetScrollCallback
897 *
898 * @ingroup input
899 */
900typedef void (* GLFWscrollfun)(GLFWwindow*,double,double);
901
902/*! @brief The function signature for keyboard key callbacks.
903 *
904 * This is the function signature for keyboard key callback functions.
905 *
906 * @param[in] window The window that received the event.
907 * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
908 * @param[in] scancode The system-specific scancode of the key.
909 * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`.
910 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
911 * held down.
912 *
913 * @sa glfwSetKeyCallback
914 *
915 * @ingroup input
916 */
917typedef void (* GLFWkeyfun)(GLFWwindow*,int,int,int,int);
918
919/*! @brief The function signature for Unicode character callbacks.
920 *
921 * This is the function signature for Unicode character callback functions.
922 *
923 * @param[in] window The window that received the event.
924 * @param[in] codepoint The Unicode code point of the character.
925 *
926 * @sa glfwSetCharCallback
927 *
928 * @ingroup input
929 */
930typedef void (* GLFWcharfun)(GLFWwindow*,unsigned int);
931
932/*! @brief The function signature for Unicode character with modifiers
933 * callbacks.
934 *
935 * This is the function signature for Unicode character with modifiers callback
936 * functions. It is called for each input character, regardless of what
937 * modifier keys are held down.
938 *
939 * @param[in] window The window that received the event.
940 * @param[in] codepoint The Unicode code point of the character.
941 * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
942 * held down.
943 *
944 * @sa glfwSetCharModsCallback
945 *
946 * @ingroup input
947 */
948typedef void (* GLFWcharmodsfun)(GLFWwindow*,unsigned int,int);
949
950/*! @brief The function signature for file drop callbacks.
951 *
952 * This is the function signature for file drop callbacks.
953 *
954 * @param[in] window The window that received the event.
955 * @param[in] count The number of dropped files.
956 * @param[in] paths The UTF-8 encoded file and/or directory path names.
957 *
958 * @sa glfwSetDropCallback
959 *
960 * @ingroup input
961 */
962typedef void (* GLFWdropfun)(GLFWwindow*,int,const char**);
963
964/*! @brief The function signature for monitor configuration callbacks.
965 *
966 * This is the function signature for monitor configuration callback functions.
967 *
968 * @param[in] monitor The monitor that was connected or disconnected.
969 * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`.
970 *
971 * @sa glfwSetMonitorCallback
972 *
973 * @ingroup monitor
974 */
975typedef void (* GLFWmonitorfun)(GLFWmonitor*,int);
976
977/*! @brief Video mode type.
978 *
979 * This describes a single video mode.
980 *
981 * @ingroup monitor
982 */
983typedef struct GLFWvidmode
984{
985 /*! The width, in screen coordinates, of the video mode.
986 */
987 int width;
988 /*! The height, in screen coordinates, of the video mode.
989 */
990 int height;
991 /*! The bit depth of the red channel of the video mode.
992 */
993 int redBits;
994 /*! The bit depth of the green channel of the video mode.
995 */
996 int greenBits;
997 /*! The bit depth of the blue channel of the video mode.
998 */
999 int blueBits;
1000 /*! The refresh rate, in Hz, of the video mode.
1001 */
1002 int refreshRate;
1003} GLFWvidmode;
1004
1005/*! @brief Gamma ramp.
1006 *
1007 * This describes the gamma ramp for a monitor.
1008 *
1009 * @sa glfwGetGammaRamp glfwSetGammaRamp
1010 *
1011 * @ingroup monitor
1012 */
1013typedef struct GLFWgammaramp
1014{
1015 /*! An array of value describing the response of the red channel.
1016 */
1017 unsigned short* red;
1018 /*! An array of value describing the response of the green channel.
1019 */
1020 unsigned short* green;
1021 /*! An array of value describing the response of the blue channel.
1022 */
1023 unsigned short* blue;
1024 /*! The number of elements in each array.
1025 */
1026 unsigned int size;
1027} GLFWgammaramp;
1028
1029/*! @brief Image data.
1030 */
1031typedef struct GLFWimage
1032{
1033 /*! The width, in pixels, of this image.
1034 */
1035 int width;
1036 /*! The height, in pixels, of this image.
1037 */
1038 int height;
1039 /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
1040 */
1041 unsigned char* pixels;
1042} GLFWimage;
1043
1044
1045/*************************************************************************
1046 * GLFW API functions
1047 *************************************************************************/
1048
1049/*! @brief Initializes the GLFW library.
1050 *
1051 * This function initializes the GLFW library. Before most GLFW functions can
1052 * be used, GLFW must be initialized, and before an application terminates GLFW
1053 * should be terminated in order to free any resources allocated during or
1054 * after initialization.
1055 *
1056 * If this function fails, it calls @ref glfwTerminate before returning. If it
1057 * succeeds, you should call @ref glfwTerminate before the application exits.
1058 *
1059 * Additional calls to this function after successful initialization but before
1060 * termination will return `GL_TRUE` immediately.
1061 *
1062 * @return `GL_TRUE` if successful, or `GL_FALSE` if an
1063 * [error](@ref error_handling) occurred.
1064 *
1065 * @remarks __OS X:__ This function will change the current directory of the
1066 * application to the `Contents/Resources` subdirectory of the application's
1067 * bundle, if present. This can be disabled with a
1068 * [compile-time option](@ref compile_options_osx).
1069 *
1070 * @remarks __X11:__ If the `LC_CTYPE` category of the current locale is set to
1071 * `"C"` then the environment's locale will be applied to that category. This
1072 * is done because character input will not function when `LC_CTYPE` is set to
1073 * `"C"`. If another locale was set before this function was called, it will
1074 * be left untouched.
1075 *
1076 * @par Thread Safety
1077 * This function may only be called from the main thread.
1078 *
1079 * @sa @ref intro_init
1080 * @sa glfwTerminate
1081 *
1082 * @since Added in GLFW 1.0.
1083 *
1084 * @ingroup init
1085 */
1086GLFWAPI int glfwInit(void);
1087
1088/*! @brief Terminates the GLFW library.
1089 *
1090 * This function destroys all remaining windows and cursors, restores any
1091 * modified gamma ramps and frees any other allocated resources. Once this
1092 * function is called, you must again call @ref glfwInit successfully before
1093 * you will be able to use most GLFW functions.
1094 *
1095 * If GLFW has been successfully initialized, this function should be called
1096 * before the application exits. If initialization fails, there is no need to
1097 * call this function, as it is called by @ref glfwInit before it returns
1098 * failure.
1099 *
1100 * @remarks This function may be called before @ref glfwInit.
1101 *
1102 * @warning No window's context may be current on another thread when this
1103 * function is called.
1104 *
1105 * @par Reentrancy
1106 * This function may not be called from a callback.
1107 *
1108 * @par Thread Safety
1109 * This function may only be called from the main thread.
1110 *
1111 * @sa @ref intro_init
1112 * @sa glfwInit
1113 *
1114 * @since Added in GLFW 1.0.
1115 *
1116 * @ingroup init
1117 */
1118GLFWAPI void glfwTerminate(void);
1119
1120/*! @brief Retrieves the version of the GLFW library.
1121 *
1122 * This function retrieves the major, minor and revision numbers of the GLFW
1123 * library. It is intended for when you are using GLFW as a shared library and
1124 * want to ensure that you are using the minimum required version.
1125 *
1126 * Any or all of the version arguments may be `NULL`. This function always
1127 * succeeds.
1128 *
1129 * @param[out] major Where to store the major version number, or `NULL`.
1130 * @param[out] minor Where to store the minor version number, or `NULL`.
1131 * @param[out] rev Where to store the revision number, or `NULL`.
1132 *
1133 * @remarks This function may be called before @ref glfwInit.
1134 *
1135 * @par Thread Safety
1136 * This function may be called from any thread.
1137 *
1138 * @sa @ref intro_version
1139 * @sa glfwGetVersionString
1140 *
1141 * @since Added in GLFW 1.0.
1142 *
1143 * @ingroup init
1144 */
1145GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
1146
1147/*! @brief Returns a string describing the compile-time configuration.
1148 *
1149 * This function returns the compile-time generated
1150 * [version string](@ref intro_version_string) of the GLFW library binary. It
1151 * describes the version, platform, compiler and any platform-specific
1152 * compile-time options.
1153 *
1154 * __Do not use the version string__ to parse the GLFW library version. The
1155 * @ref glfwGetVersion function already provides the version of the running
1156 * library binary.
1157 *
1158 * This function always succeeds.
1159 *
1160 * @return The GLFW version string.
1161 *
1162 * @remarks This function may be called before @ref glfwInit.
1163 *
1164 * @par Pointer Lifetime
1165 * The returned string is static and compile-time generated.
1166 *
1167 * @par Thread Safety
1168 * This function may be called from any thread.
1169 *
1170 * @sa @ref intro_version
1171 * @sa glfwGetVersion
1172 *
1173 * @since Added in GLFW 3.0.
1174 *
1175 * @ingroup init
1176 */
1177GLFWAPI const char* glfwGetVersionString(void);
1178
1179/*! @brief Sets the error callback.
1180 *
1181 * This function sets the error callback, which is called with an error code
1182 * and a human-readable description each time a GLFW error occurs.
1183 *
1184 * The error callback is called on the thread where the error occurred. If you
1185 * are using GLFW from multiple threads, your error callback needs to be
1186 * written accordingly.
1187 *
1188 * Because the description string may have been generated specifically for that
1189 * error, it is not guaranteed to be valid after the callback has returned. If
1190 * you wish to use it after the callback returns, you need to make a copy.
1191 *
1192 * Once set, the error callback remains set even after the library has been
1193 * terminated.
1194 *
1195 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1196 * callback.
1197 * @return The previously set callback, or `NULL` if no callback was set.
1198 *
1199 * @remarks This function may be called before @ref glfwInit.
1200 *
1201 * @par Thread Safety
1202 * This function may only be called from the main thread.
1203 *
1204 * @sa @ref error_handling
1205 *
1206 * @since Added in GLFW 3.0.
1207 *
1208 * @ingroup init
1209 */
1210GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun);
1211
1212/*! @brief Returns the currently connected monitors.
1213 *
1214 * This function returns an array of handles for all currently connected
1215 * monitors.
1216 *
1217 * @param[out] count Where to store the number of monitors in the returned
1218 * array. This is set to zero if an error occurred.
1219 * @return An array of monitor handles, or `NULL` if an
1220 * [error](@ref error_handling) occurred.
1221 *
1222 * @par Pointer Lifetime
1223 * The returned array is allocated and freed by GLFW. You should not free it
1224 * yourself. It is guaranteed to be valid only until the monitor configuration
1225 * changes or the library is terminated.
1226 *
1227 * @par Thread Safety
1228 * This function may only be called from the main thread.
1229 *
1230 * @sa @ref monitor_monitors
1231 * @sa @ref monitor_event
1232 * @sa glfwGetPrimaryMonitor
1233 *
1234 * @since Added in GLFW 3.0.
1235 *
1236 * @ingroup monitor
1237 */
1238GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
1239
1240/*! @brief Returns the primary monitor.
1241 *
1242 * This function returns the primary monitor. This is usually the monitor
1243 * where elements like the Windows task bar or the OS X menu bar is located.
1244 *
1245 * @return The primary monitor, or `NULL` if an [error](@ref error_handling)
1246 * occurred.
1247 *
1248 * @par Thread Safety
1249 * This function may only be called from the main thread.
1250 *
1251 * @sa @ref monitor_monitors
1252 * @sa glfwGetMonitors
1253 *
1254 * @since Added in GLFW 3.0.
1255 *
1256 * @ingroup monitor
1257 */
1258GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
1259
1260/*! @brief Returns the position of the monitor's viewport on the virtual screen.
1261 *
1262 * This function returns the position, in screen coordinates, of the upper-left
1263 * corner of the specified monitor.
1264 *
1265 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1266 * non-`NULL` position arguments will be set to zero.
1267 *
1268 * @param[in] monitor The monitor to query.
1269 * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
1270 * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
1271 *
1272 * @par Thread Safety
1273 * This function may only be called from the main thread.
1274 *
1275 * @sa @ref monitor_properties
1276 *
1277 * @since Added in GLFW 3.0.
1278 *
1279 * @ingroup monitor
1280 */
1281GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
1282
1283/*! @brief Returns the physical size of the monitor.
1284 *
1285 * This function returns the size, in millimetres, of the display area of the
1286 * specified monitor.
1287 *
1288 * Some systems do not provide accurate monitor size information, either
1289 * because the monitor
1290 * [EDID](https://en.wikipedia.org/wiki/Extended_display_identification_data)
1291 * data is incorrect or because the driver does not report it accurately.
1292 *
1293 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1294 * non-`NULL` size arguments will be set to zero.
1295 *
1296 * @param[in] monitor The monitor to query.
1297 * @param[out] widthMM Where to store the width, in millimetres, of the
1298 * monitor's display area, or `NULL`.
1299 * @param[out] heightMM Where to store the height, in millimetres, of the
1300 * monitor's display area, or `NULL`.
1301 *
1302 * @remarks __Windows:__ The OS calculates the returned physical size from the
1303 * current resolution and system DPI instead of querying the monitor EDID data.
1304 *
1305 * @par Thread Safety
1306 * This function may only be called from the main thread.
1307 *
1308 * @sa @ref monitor_properties
1309 *
1310 * @since Added in GLFW 3.0.
1311 *
1312 * @ingroup monitor
1313 */
1314GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
1315
1316/*! @brief Returns the name of the specified monitor.
1317 *
1318 * This function returns a human-readable name, encoded as UTF-8, of the
1319 * specified monitor. The name typically reflects the make and model of the
1320 * monitor and is not guaranteed to be unique among the connected monitors.
1321 *
1322 * @param[in] monitor The monitor to query.
1323 * @return The UTF-8 encoded name of the monitor, or `NULL` if an
1324 * [error](@ref error_handling) occurred.
1325 *
1326 * @par Pointer Lifetime
1327 * The returned string is allocated and freed by GLFW. You should not free it
1328 * yourself. It is valid until the specified monitor is disconnected or the
1329 * library is terminated.
1330 *
1331 * @par Thread Safety
1332 * This function may only be called from the main thread.
1333 *
1334 * @sa @ref monitor_properties
1335 *
1336 * @since Added in GLFW 3.0.
1337 *
1338 * @ingroup monitor
1339 */
1340GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
1341
1342/*! @brief Sets the monitor configuration callback.
1343 *
1344 * This function sets the monitor configuration callback, or removes the
1345 * currently set callback. This is called when a monitor is connected to or
1346 * disconnected from the system.
1347 *
1348 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
1349 * callback.
1350 * @return The previously set callback, or `NULL` if no callback was set or the
1351 * library had not been [initialized](@ref intro_init).
1352 *
1353 * @bug __X11:__ This callback is not yet called on monitor configuration
1354 * changes.
1355 *
1356 * @par Thread Safety
1357 * This function may only be called from the main thread.
1358 *
1359 * @sa @ref monitor_event
1360 *
1361 * @since Added in GLFW 3.0.
1362 *
1363 * @ingroup monitor
1364 */
1365GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun);
1366
1367/*! @brief Returns the available video modes for the specified monitor.
1368 *
1369 * This function returns an array of all video modes supported by the specified
1370 * monitor. The returned array is sorted in ascending order, first by color
1371 * bit depth (the sum of all channel depths) and then by resolution area (the
1372 * product of width and height).
1373 *
1374 * @param[in] monitor The monitor to query.
1375 * @param[out] count Where to store the number of video modes in the returned
1376 * array. This is set to zero if an error occurred.
1377 * @return An array of video modes, or `NULL` if an
1378 * [error](@ref error_handling) occurred.
1379 *
1380 * @par Pointer Lifetime
1381 * The returned array is allocated and freed by GLFW. You should not free it
1382 * yourself. It is valid until the specified monitor is disconnected, this
1383 * function is called again for that monitor or the library is terminated.
1384 *
1385 * @par Thread Safety
1386 * This function may only be called from the main thread.
1387 *
1388 * @sa @ref monitor_modes
1389 * @sa glfwGetVideoMode
1390 *
1391 * @since Added in GLFW 1.0.
1392 *
1393 * @par
1394 * __GLFW 3:__ Changed to return an array of modes for a specific monitor.
1395 *
1396 * @ingroup monitor
1397 */
1398GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
1399
1400/*! @brief Returns the current mode of the specified monitor.
1401 *
1402 * This function returns the current video mode of the specified monitor. If
1403 * you have created a full screen window for that monitor, the return value
1404 * will depend on whether that window is iconified.
1405 *
1406 * @param[in] monitor The monitor to query.
1407 * @return The current mode of the monitor, or `NULL` if an
1408 * [error](@ref error_handling) occurred.
1409 *
1410 * @par Pointer Lifetime
1411 * The returned array is allocated and freed by GLFW. You should not free it
1412 * yourself. It is valid until the specified monitor is disconnected or the
1413 * library is terminated.
1414 *
1415 * @par Thread Safety
1416 * This function may only be called from the main thread.
1417 *
1418 * @sa @ref monitor_modes
1419 * @sa glfwGetVideoModes
1420 *
1421 * @since Added in GLFW 3.0. Replaces `glfwGetDesktopMode`.
1422 *
1423 * @ingroup monitor
1424 */
1425GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
1426
1427/*! @brief Generates a gamma ramp and sets it for the specified monitor.
1428 *
1429 * This function generates a 256-element gamma ramp from the specified exponent
1430 * and then calls @ref glfwSetGammaRamp with it. The value must be a finite
1431 * number greater than zero.
1432 *
1433 * @param[in] monitor The monitor whose gamma ramp to set.
1434 * @param[in] gamma The desired exponent.
1435 *
1436 * @par Thread Safety
1437 * This function may only be called from the main thread.
1438 *
1439 * @sa @ref monitor_gamma
1440 *
1441 * @since Added in GLFW 3.0.
1442 *
1443 * @ingroup monitor
1444 */
1445GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
1446
1447/*! @brief Returns the current gamma ramp for the specified monitor.
1448 *
1449 * This function returns the current gamma ramp of the specified monitor.
1450 *
1451 * @param[in] monitor The monitor to query.
1452 * @return The current gamma ramp, or `NULL` if an
1453 * [error](@ref error_handling) occurred.
1454 *
1455 * @par Pointer Lifetime
1456 * The returned structure and its arrays are allocated and freed by GLFW. You
1457 * should not free them yourself. They are valid until the specified monitor
1458 * is disconnected, this function is called again for that monitor or the
1459 * library is terminated.
1460 *
1461 * @par Thread Safety
1462 * This function may only be called from the main thread.
1463 *
1464 * @sa @ref monitor_gamma
1465 *
1466 * @since Added in GLFW 3.0.
1467 *
1468 * @ingroup monitor
1469 */
1470GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
1471
1472/*! @brief Sets the current gamma ramp for the specified monitor.
1473 *
1474 * This function sets the current gamma ramp for the specified monitor. The
1475 * original gamma ramp for that monitor is saved by GLFW the first time this
1476 * function is called and is restored by @ref glfwTerminate.
1477 *
1478 * @param[in] monitor The monitor whose gamma ramp to set.
1479 * @param[in] ramp The gamma ramp to use.
1480 *
1481 * @remarks Gamma ramp sizes other than 256 are not supported by all platforms
1482 * or graphics hardware.
1483 *
1484 * @remarks __Windows:__ The gamma ramp size must be 256.
1485 *
1486 * @par Pointer Lifetime
1487 * The specified gamma ramp is copied before this function returns.
1488 *
1489 * @par Thread Safety
1490 * This function may only be called from the main thread.
1491 *
1492 * @sa @ref monitor_gamma
1493 *
1494 * @since Added in GLFW 3.0.
1495 *
1496 * @ingroup monitor
1497 */
1498GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
1499
1500/*! @brief Resets all window hints to their default values.
1501 *
1502 * This function resets all window hints to their
1503 * [default values](@ref window_hints_values).
1504 *
1505 * @par Thread Safety
1506 * This function may only be called from the main thread.
1507 *
1508 * @sa @ref window_hints
1509 * @sa glfwWindowHint
1510 *
1511 * @since Added in GLFW 3.0.
1512 *
1513 * @ingroup window
1514 */
1515GLFWAPI void glfwDefaultWindowHints(void);
1516
1517/*! @brief Sets the specified window hint to the desired value.
1518 *
1519 * This function sets hints for the next call to @ref glfwCreateWindow. The
1520 * hints, once set, retain their values until changed by a call to @ref
1521 * glfwWindowHint or @ref glfwDefaultWindowHints, or until the library is
1522 * terminated.
1523 *
1524 * @param[in] target The [window hint](@ref window_hints) to set.
1525 * @param[in] hint The new value of the window hint.
1526 *
1527 * @par Thread Safety
1528 * This function may only be called from the main thread.
1529 *
1530 * @sa @ref window_hints
1531 * @sa glfwDefaultWindowHints
1532 *
1533 * @since Added in GLFW 3.0. Replaces `glfwOpenWindowHint`.
1534 *
1535 * @ingroup window
1536 */
1537GLFWAPI void glfwWindowHint(int target, int hint);
1538
1539/*! @brief Creates a window and its associated context.
1540 *
1541 * This function creates a window and its associated OpenGL or OpenGL ES
1542 * context. Most of the options controlling how the window and its context
1543 * should be created are specified with [window hints](@ref window_hints).
1544 *
1545 * Successful creation does not change which context is current. Before you
1546 * can use the newly created context, you need to
1547 * [make it current](@ref context_current). For information about the `share`
1548 * parameter, see @ref context_sharing.
1549 *
1550 * The created window, framebuffer and context may differ from what you
1551 * requested, as not all parameters and hints are
1552 * [hard constraints](@ref window_hints_hard). This includes the size of the
1553 * window, especially for full screen windows. To query the actual attributes
1554 * of the created window, framebuffer and context, use queries like @ref
1555 * glfwGetWindowAttrib and @ref glfwGetWindowSize.
1556 *
1557 * To create a full screen window, you need to specify the monitor the window
1558 * will cover. If no monitor is specified, windowed mode will be used. Unless
1559 * you have a way for the user to choose a specific monitor, it is recommended
1560 * that you pick the primary monitor. For more information on how to query
1561 * connected monitors, see @ref monitor_monitors.
1562 *
1563 * For full screen windows, the specified size becomes the resolution of the
1564 * window's _desired video mode_. As long as a full screen window has input
1565 * focus, the supported video mode most closely matching the desired video mode
1566 * is set for the specified monitor. For more information about full screen
1567 * windows, including the creation of so called _windowed full screen_ or
1568 * _borderless full screen_ windows, see @ref window_windowed_full_screen.
1569 *
1570 * By default, newly created windows use the placement recommended by the
1571 * window system. To create the window at a specific position, make it
1572 * initially invisible using the [GLFW_VISIBLE](@ref window_hints_wnd) window
1573 * hint, set its [position](@ref window_pos) and then [show](@ref window_hide)
1574 * it.
1575 *
1576 * If a full screen window has input focus, the screensaver is prohibited from
1577 * starting.
1578 *
1579 * Window systems put limits on window sizes. Very large or very small window
1580 * dimensions may be overridden by the window system on creation. Check the
1581 * actual [size](@ref window_size) after creation.
1582 *
1583 * The [swap interval](@ref buffer_swap) is not set during window creation and
1584 * the initial value may vary depending on driver settings and defaults.
1585 *
1586 * @param[in] width The desired width, in screen coordinates, of the window.
1587 * This must be greater than zero.
1588 * @param[in] height The desired height, in screen coordinates, of the window.
1589 * This must be greater than zero.
1590 * @param[in] title The initial, UTF-8 encoded window title.
1591 * @param[in] monitor The monitor to use for full screen mode, or `NULL` to use
1592 * windowed mode.
1593 * @param[in] share The window whose context to share resources with, or `NULL`
1594 * to not share resources.
1595 * @return The handle of the created window, or `NULL` if an
1596 * [error](@ref error_handling) occurred.
1597 *
1598 * @remarks __Windows:__ Window creation will fail if the Microsoft GDI
1599 * software OpenGL implementation is the only one available.
1600 *
1601 * @remarks __Windows:__ If the executable has an icon resource named
1602 * `GLFW_ICON,` it will be set as the icon for the window. If no such icon is
1603 * present, the `IDI_WINLOGO` icon will be used instead.
1604 *
1605 * @remarks __Windows:__ The context to share resources with may not be current
1606 * on any other thread.
1607 *
1608 * @remarks __OS X:__ The GLFW window has no icon, as it is not a document
1609 * window, but the dock icon will be the same as the application bundle's icon.
1610 * For more information on bundles, see the
1611 * [Bundle Programming Guide](https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/)
1612 * in the Mac Developer Library.
1613 *
1614 * @remarks __OS X:__ The first time a window is created the menu bar is
1615 * populated with common commands like Hide, Quit and About. The About entry
1616 * opens a minimal about dialog with information from the application's bundle.
1617 * The menu bar can be disabled with a
1618 * [compile-time option](@ref compile_options_osx).
1619 *
1620 * @remarks __OS X:__ On OS X 10.10 and later the window frame will not be
1621 * rendered at full resolution on Retina displays unless the
1622 * `NSHighResolutionCapable` key is enabled in the application bundle's
1623 * `Info.plist`. For more information, see
1624 * [High Resolution Guidelines for OS X](https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html)
1625 * in the Mac Developer Library.
1626 *
1627 * @remarks __X11:__ There is no mechanism for setting the window icon yet.
1628 *
1629 * @remarks __X11:__ Some window managers will not respect the placement of
1630 * initially hidden windows.
1631 *
1632 * @par Reentrancy
1633 * This function may not be called from a callback.
1634 *
1635 * @par Thread Safety
1636 * This function may only be called from the main thread.
1637 *
1638 * @sa @ref window_creation
1639 * @sa glfwDestroyWindow
1640 *
1641 * @since Added in GLFW 3.0. Replaces `glfwOpenWindow`.
1642 *
1643 * @ingroup window
1644 */
1645GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
1646
1647/*! @brief Destroys the specified window and its context.
1648 *
1649 * This function destroys the specified window and its context. On calling
1650 * this function, no further callbacks will be called for that window.
1651 *
1652 * If the context of the specified window is current on the main thread, it is
1653 * detached before being destroyed.
1654 *
1655 * @param[in] window The window to destroy.
1656 *
1657 * @note The context of the specified window must not be current on any other
1658 * thread when this function is called.
1659 *
1660 * @par Reentrancy
1661 * This function may not be called from a callback.
1662 *
1663 * @par Thread Safety
1664 * This function may only be called from the main thread.
1665 *
1666 * @sa @ref window_creation
1667 * @sa glfwCreateWindow
1668 *
1669 * @since Added in GLFW 3.0. Replaces `glfwCloseWindow`.
1670 *
1671 * @ingroup window
1672 */
1673GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
1674
1675/*! @brief Checks the close flag of the specified window.
1676 *
1677 * This function returns the value of the close flag of the specified window.
1678 *
1679 * @param[in] window The window to query.
1680 * @return The value of the close flag.
1681 *
1682 * @par Thread Safety
1683 * This function may be called from any thread. Access is not synchronized.
1684 *
1685 * @sa @ref window_close
1686 *
1687 * @since Added in GLFW 3.0.
1688 *
1689 * @ingroup window
1690 */
1691GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
1692
1693/*! @brief Sets the close flag of the specified window.
1694 *
1695 * This function sets the value of the close flag of the specified window.
1696 * This can be used to override the user's attempt to close the window, or
1697 * to signal that it should be closed.
1698 *
1699 * @param[in] window The window whose flag to change.
1700 * @param[in] value The new value.
1701 *
1702 * @par Thread Safety
1703 * This function may be called from any thread. Access is not synchronized.
1704 *
1705 * @sa @ref window_close
1706 *
1707 * @since Added in GLFW 3.0.
1708 *
1709 * @ingroup window
1710 */
1711GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
1712
1713/*! @brief Sets the title of the specified window.
1714 *
1715 * This function sets the window title, encoded as UTF-8, of the specified
1716 * window.
1717 *
1718 * @param[in] window The window whose title to change.
1719 * @param[in] title The UTF-8 encoded window title.
1720 *
1721 * @par Thread Safety
1722 * This function may only be called from the main thread.
1723 *
1724 * @sa @ref window_title
1725 *
1726 * @since Added in GLFW 1.0.
1727 *
1728 * @par
1729 * __GLFW 3:__ Added window handle parameter.
1730 *
1731 * @ingroup window
1732 */
1733GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
1734
1735/*! @brief Retrieves the position of the client area of the specified window.
1736 *
1737 * This function retrieves the position, in screen coordinates, of the
1738 * upper-left corner of the client area of the specified window.
1739 *
1740 * Any or all of the position arguments may be `NULL`. If an error occurs, all
1741 * non-`NULL` position arguments will be set to zero.
1742 *
1743 * @param[in] window The window to query.
1744 * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
1745 * the client area, or `NULL`.
1746 * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
1747 * the client area, or `NULL`.
1748 *
1749 * @par Thread Safety
1750 * This function may only be called from the main thread.
1751 *
1752 * @sa @ref window_pos
1753 * @sa glfwSetWindowPos
1754 *
1755 * @since Added in GLFW 3.0.
1756 *
1757 * @ingroup window
1758 */
1759GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
1760
1761/*! @brief Sets the position of the client area of the specified window.
1762 *
1763 * This function sets the position, in screen coordinates, of the upper-left
1764 * corner of the client area of the specified windowed mode window. If the
1765 * window is a full screen window, this function does nothing.
1766 *
1767 * __Do not use this function__ to move an already visible window unless you
1768 * have very good reasons for doing so, as it will confuse and annoy the user.
1769 *
1770 * The window manager may put limits on what positions are allowed. GLFW
1771 * cannot and should not override these limits.
1772 *
1773 * @param[in] window The window to query.
1774 * @param[in] xpos The x-coordinate of the upper-left corner of the client area.
1775 * @param[in] ypos The y-coordinate of the upper-left corner of the client area.
1776 *
1777 * @par Thread Safety
1778 * This function may only be called from the main thread.
1779 *
1780 * @sa @ref window_pos
1781 * @sa glfwGetWindowPos
1782 *
1783 * @since Added in GLFW 1.0.
1784 *
1785 * @par
1786 * __GLFW 3:__ Added window handle parameter.
1787 *
1788 * @ingroup window
1789 */
1790GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
1791
1792/*! @brief Retrieves the size of the client area of the specified window.
1793 *
1794 * This function retrieves the size, in screen coordinates, of the client area
1795 * of the specified window. If you wish to retrieve the size of the
1796 * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
1797 *
1798 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1799 * non-`NULL` size arguments will be set to zero.
1800 *
1801 * @param[in] window The window whose size to retrieve.
1802 * @param[out] width Where to store the width, in screen coordinates, of the
1803 * client area, or `NULL`.
1804 * @param[out] height Where to store the height, in screen coordinates, of the
1805 * client area, or `NULL`.
1806 *
1807 * @par Thread Safety
1808 * This function may only be called from the main thread.
1809 *
1810 * @sa @ref window_size
1811 * @sa glfwSetWindowSize
1812 *
1813 * @since Added in GLFW 1.0.
1814 *
1815 * @par
1816 * __GLFW 3:__ Added window handle parameter.
1817 *
1818 * @ingroup window
1819 */
1820GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
1821
1822/*! @brief Sets the size of the client area of the specified window.
1823 *
1824 * This function sets the size, in screen coordinates, of the client area of
1825 * the specified window.
1826 *
1827 * For full screen windows, this function selects and switches to the resolution
1828 * closest to the specified size, without affecting the window's context. As
1829 * the context is unaffected, the bit depths of the framebuffer remain
1830 * unchanged.
1831 *
1832 * The window manager may put limits on what sizes are allowed. GLFW cannot
1833 * and should not override these limits.
1834 *
1835 * @param[in] window The window to resize.
1836 * @param[in] width The desired width of the specified window.
1837 * @param[in] height The desired height of the specified window.
1838 *
1839 * @par Thread Safety
1840 * This function may only be called from the main thread.
1841 *
1842 * @sa @ref window_size
1843 * @sa glfwGetWindowSize
1844 *
1845 * @since Added in GLFW 1.0.
1846 *
1847 * @par
1848 * __GLFW 3:__ Added window handle parameter.
1849 *
1850 * @ingroup window
1851 */
1852GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
1853
1854/*! @brief Retrieves the size of the framebuffer of the specified window.
1855 *
1856 * This function retrieves the size, in pixels, of the framebuffer of the
1857 * specified window. If you wish to retrieve the size of the window in screen
1858 * coordinates, see @ref glfwGetWindowSize.
1859 *
1860 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1861 * non-`NULL` size arguments will be set to zero.
1862 *
1863 * @param[in] window The window whose framebuffer to query.
1864 * @param[out] width Where to store the width, in pixels, of the framebuffer,
1865 * or `NULL`.
1866 * @param[out] height Where to store the height, in pixels, of the framebuffer,
1867 * or `NULL`.
1868 *
1869 * @par Thread Safety
1870 * This function may only be called from the main thread.
1871 *
1872 * @sa @ref window_fbsize
1873 * @sa glfwSetFramebufferSizeCallback
1874 *
1875 * @since Added in GLFW 3.0.
1876 *
1877 * @ingroup window
1878 */
1879GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
1880
1881/*! @brief Retrieves the size of the frame of the window.
1882 *
1883 * This function retrieves the size, in screen coordinates, of each edge of the
1884 * frame of the specified window. This size includes the title bar, if the
1885 * window has one. The size of the frame may vary depending on the
1886 * [window-related hints](@ref window_hints_wnd) used to create it.
1887 *
1888 * Because this function retrieves the size of each window frame edge and not
1889 * the offset along a particular coordinate axis, the retrieved values will
1890 * always be zero or positive.
1891 *
1892 * Any or all of the size arguments may be `NULL`. If an error occurs, all
1893 * non-`NULL` size arguments will be set to zero.
1894 *
1895 * @param[in] window The window whose frame size to query.
1896 * @param[out] left Where to store the size, in screen coordinates, of the left
1897 * edge of the window frame, or `NULL`.
1898 * @param[out] top Where to store the size, in screen coordinates, of the top
1899 * edge of the window frame, or `NULL`.
1900 * @param[out] right Where to store the size, in screen coordinates, of the
1901 * right edge of the window frame, or `NULL`.
1902 * @param[out] bottom Where to store the size, in screen coordinates, of the
1903 * bottom edge of the window frame, or `NULL`.
1904 *
1905 * @par Thread Safety
1906 * This function may only be called from the main thread.
1907 *
1908 * @sa @ref window_size
1909 *
1910 * @since Added in GLFW 3.1.
1911 *
1912 * @ingroup window
1913 */
1914GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
1915
1916/*! @brief Iconifies the specified window.
1917 *
1918 * This function iconifies (minimizes) the specified window if it was
1919 * previously restored. If the window is already iconified, this function does
1920 * nothing.
1921 *
1922 * If the specified window is a full screen window, the original monitor
1923 * resolution is restored until the window is restored.
1924 *
1925 * @param[in] window The window to iconify.
1926 *
1927 * @par Thread Safety
1928 * This function may only be called from the main thread.
1929 *
1930 * @sa @ref window_iconify
1931 * @sa glfwRestoreWindow
1932 *
1933 * @since Added in GLFW 2.1.
1934 *
1935 * @par
1936 * __GLFW 3:__ Added window handle parameter.
1937 *
1938 * @ingroup window
1939 */
1940GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
1941
1942/*! @brief Restores the specified window.
1943 *
1944 * This function restores the specified window if it was previously iconified
1945 * (minimized). If the window is already restored, this function does nothing.
1946 *
1947 * If the specified window is a full screen window, the resolution chosen for
1948 * the window is restored on the selected monitor.
1949 *
1950 * @param[in] window The window to restore.
1951 *
1952 * @par Thread Safety
1953 * This function may only be called from the main thread.
1954 *
1955 * @sa @ref window_iconify
1956 * @sa glfwIconifyWindow
1957 *
1958 * @since Added in GLFW 2.1.
1959 *
1960 * @par
1961 * __GLFW 3:__ Added window handle parameter.
1962 *
1963 * @ingroup window
1964 */
1965GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
1966
1967/*! @brief Makes the specified window visible.
1968 *
1969 * This function makes the specified window visible if it was previously
1970 * hidden. If the window is already visible or is in full screen mode, this
1971 * function does nothing.
1972 *
1973 * @param[in] window The window to make visible.
1974 *
1975 * @par Thread Safety
1976 * This function may only be called from the main thread.
1977 *
1978 * @sa @ref window_hide
1979 * @sa glfwHideWindow
1980 *
1981 * @since Added in GLFW 3.0.
1982 *
1983 * @ingroup window
1984 */
1985GLFWAPI void glfwShowWindow(GLFWwindow* window);
1986
1987/*! @brief Hides the specified window.
1988 *
1989 * This function hides the specified window if it was previously visible. If
1990 * the window is already hidden or is in full screen mode, this function does
1991 * nothing.
1992 *
1993 * @param[in] window The window to hide.
1994 *
1995 * @par Thread Safety
1996 * This function may only be called from the main thread.
1997 *
1998 * @sa @ref window_hide
1999 * @sa glfwShowWindow
2000 *
2001 * @since Added in GLFW 3.0.
2002 *
2003 * @ingroup window
2004 */
2005GLFWAPI void glfwHideWindow(GLFWwindow* window);
2006
2007/*! @brief Returns the monitor that the window uses for full screen mode.
2008 *
2009 * This function returns the handle of the monitor that the specified window is
2010 * in full screen on.
2011 *
2012 * @param[in] window The window to query.
2013 * @return The monitor, or `NULL` if the window is in windowed mode or an error
2014 * occurred.
2015 *
2016 * @par Thread Safety
2017 * This function may only be called from the main thread.
2018 *
2019 * @sa @ref window_monitor
2020 *
2021 * @since Added in GLFW 3.0.
2022 *
2023 * @ingroup window
2024 */
2025GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
2026
2027/*! @brief Returns an attribute of the specified window.
2028 *
2029 * This function returns the value of an attribute of the specified window or
2030 * its OpenGL or OpenGL ES context.
2031 *
2032 * @param[in] window The window to query.
2033 * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
2034 * return.
2035 * @return The value of the attribute, or zero if an
2036 * [error](@ref error_handling) occurred.
2037 *
2038 * @par Thread Safety
2039 * This function may only be called from the main thread.
2040 *
2041 * @sa @ref window_attribs
2042 *
2043 * @since Added in GLFW 3.0. Replaces `glfwGetWindowParam` and
2044 * `glfwGetGLVersion`.
2045 *
2046 * @ingroup window
2047 */
2048GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
2049
2050/*! @brief Sets the user pointer of the specified window.
2051 *
2052 * This function sets the user-defined pointer of the specified window. The
2053 * current value is retained until the window is destroyed. The initial value
2054 * is `NULL`.
2055 *
2056 * @param[in] window The window whose pointer to set.
2057 * @param[in] pointer The new value.
2058 *
2059 * @par Thread Safety
2060 * This function may be called from any thread. Access is not synchronized.
2061 *
2062 * @sa @ref window_userptr
2063 * @sa glfwGetWindowUserPointer
2064 *
2065 * @since Added in GLFW 3.0.
2066 *
2067 * @ingroup window
2068 */
2069GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
2070
2071/*! @brief Returns the user pointer of the specified window.
2072 *
2073 * This function returns the current value of the user-defined pointer of the
2074 * specified window. The initial value is `NULL`.
2075 *
2076 * @param[in] window The window whose pointer to return.
2077 *
2078 * @par Thread Safety
2079 * This function may be called from any thread. Access is not synchronized.
2080 *
2081 * @sa @ref window_userptr
2082 * @sa glfwSetWindowUserPointer
2083 *
2084 * @since Added in GLFW 3.0.
2085 *
2086 * @ingroup window
2087 */
2088GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
2089
2090/*! @brief Sets the position callback for the specified window.
2091 *
2092 * This function sets the position callback of the specified window, which is
2093 * called when the window is moved. The callback is provided with the screen
2094 * position of the upper-left corner of the client area of the window.
2095 *
2096 * @param[in] window The window whose callback to set.
2097 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2098 * callback.
2099 * @return The previously set callback, or `NULL` if no callback was set or the
2100 * library had not been [initialized](@ref intro_init).
2101 *
2102 * @par Thread Safety
2103 * This function may only be called from the main thread.
2104 *
2105 * @sa @ref window_pos
2106 *
2107 * @since Added in GLFW 3.0.
2108 *
2109 * @ingroup window
2110 */
2111GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun cbfun);
2112
2113/*! @brief Sets the size callback for the specified window.
2114 *
2115 * This function sets the size callback of the specified window, which is
2116 * called when the window is resized. The callback is provided with the size,
2117 * in screen coordinates, of the client area of the window.
2118 *
2119 * @param[in] window The window whose callback to set.
2120 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2121 * callback.
2122 * @return The previously set callback, or `NULL` if no callback was set or the
2123 * library had not been [initialized](@ref intro_init).
2124 *
2125 * @par Thread Safety
2126 * This function may only be called from the main thread.
2127 *
2128 * @sa @ref window_size
2129 *
2130 * @since Added in GLFW 1.0.
2131 *
2132 * @par
2133 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
2134 *
2135 * @ingroup window
2136 */
2137GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun cbfun);
2138
2139/*! @brief Sets the close callback for the specified window.
2140 *
2141 * This function sets the close callback of the specified window, which is
2142 * called when the user attempts to close the window, for example by clicking
2143 * the close widget in the title bar.
2144 *
2145 * The close flag is set before this callback is called, but you can modify it
2146 * at any time with @ref glfwSetWindowShouldClose.
2147 *
2148 * The close callback is not triggered by @ref glfwDestroyWindow.
2149 *
2150 * @param[in] window The window whose callback to set.
2151 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2152 * callback.
2153 * @return The previously set callback, or `NULL` if no callback was set or the
2154 * library had not been [initialized](@ref intro_init).
2155 *
2156 * @remarks __OS X:__ Selecting Quit from the application menu will
2157 * trigger the close callback for all windows.
2158 *
2159 * @par Thread Safety
2160 * This function may only be called from the main thread.
2161 *
2162 * @sa @ref window_close
2163 *
2164 * @since Added in GLFW 2.5.
2165 *
2166 * @par
2167 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
2168 *
2169 * @ingroup window
2170 */
2171GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun cbfun);
2172
2173/*! @brief Sets the refresh callback for the specified window.
2174 *
2175 * This function sets the refresh callback of the specified window, which is
2176 * called when the client area of the window needs to be redrawn, for example
2177 * if the window has been exposed after having been covered by another window.
2178 *
2179 * On compositing window systems such as Aero, Compiz or Aqua, where the window
2180 * contents are saved off-screen, this callback may be called only very
2181 * infrequently or never at all.
2182 *
2183 * @param[in] window The window whose callback to set.
2184 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2185 * callback.
2186 * @return The previously set callback, or `NULL` if no callback was set or the
2187 * library had not been [initialized](@ref intro_init).
2188 *
2189 * @par Thread Safety
2190 * This function may only be called from the main thread.
2191 *
2192 * @sa @ref window_refresh
2193 *
2194 * @since Added in GLFW 2.5.
2195 *
2196 * @par
2197 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
2198 *
2199 * @ingroup window
2200 */
2201GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun cbfun);
2202
2203/*! @brief Sets the focus callback for the specified window.
2204 *
2205 * This function sets the focus callback of the specified window, which is
2206 * called when the window gains or loses input focus.
2207 *
2208 * After the focus callback is called for a window that lost input focus,
2209 * synthetic key and mouse button release events will be generated for all such
2210 * that had been pressed. For more information, see @ref glfwSetKeyCallback
2211 * and @ref glfwSetMouseButtonCallback.
2212 *
2213 * @param[in] window The window whose callback to set.
2214 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2215 * callback.
2216 * @return The previously set callback, or `NULL` if no callback was set or the
2217 * library had not been [initialized](@ref intro_init).
2218 *
2219 * @par Thread Safety
2220 * This function may only be called from the main thread.
2221 *
2222 * @sa @ref window_focus
2223 *
2224 * @since Added in GLFW 3.0.
2225 *
2226 * @ingroup window
2227 */
2228GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun cbfun);
2229
2230/*! @brief Sets the iconify callback for the specified window.
2231 *
2232 * This function sets the iconification callback of the specified window, which
2233 * is called when the window is iconified or restored.
2234 *
2235 * @param[in] window The window whose callback to set.
2236 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2237 * callback.
2238 * @return The previously set callback, or `NULL` if no callback was set or the
2239 * library had not been [initialized](@ref intro_init).
2240 *
2241 * @par Thread Safety
2242 * This function may only be called from the main thread.
2243 *
2244 * @sa @ref window_iconify
2245 *
2246 * @since Added in GLFW 3.0.
2247 *
2248 * @ingroup window
2249 */
2250GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun cbfun);
2251
2252/*! @brief Sets the framebuffer resize callback for the specified window.
2253 *
2254 * This function sets the framebuffer resize callback of the specified window,
2255 * which is called when the framebuffer of the specified window is resized.
2256 *
2257 * @param[in] window The window whose callback to set.
2258 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2259 * callback.
2260 * @return The previously set callback, or `NULL` if no callback was set or the
2261 * library had not been [initialized](@ref intro_init).
2262 *
2263 * @par Thread Safety
2264 * This function may only be called from the main thread.
2265 *
2266 * @sa @ref window_fbsize
2267 *
2268 * @since Added in GLFW 3.0.
2269 *
2270 * @ingroup window
2271 */
2272GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun cbfun);
2273
2274/*! @brief Processes all pending events.
2275 *
2276 * This function processes only those events that are already in the event
2277 * queue and then returns immediately. Processing events will cause the window
2278 * and input callbacks associated with those events to be called.
2279 *
2280 * On some platforms, a window move, resize or menu operation will cause event
2281 * processing to block. This is due to how event processing is designed on
2282 * those platforms. You can use the
2283 * [window refresh callback](@ref window_refresh) to redraw the contents of
2284 * your window when necessary during such operations.
2285 *
2286 * On some platforms, certain events are sent directly to the application
2287 * without going through the event queue, causing callbacks to be called
2288 * outside of a call to one of the event processing functions.
2289 *
2290 * Event processing is not required for joystick input to work.
2291 *
2292 * @par Reentrancy
2293 * This function may not be called from a callback.
2294 *
2295 * @par Thread Safety
2296 * This function may only be called from the main thread.
2297 *
2298 * @sa @ref events
2299 * @sa glfwWaitEvents
2300 *
2301 * @since Added in GLFW 1.0.
2302 *
2303 * @ingroup window
2304 */
2305GLFWAPI void glfwPollEvents(void);
2306
2307/*! @brief Waits until events are queued and processes them.
2308 *
2309 * This function puts the calling thread to sleep until at least one event is
2310 * available in the event queue. Once one or more events are available,
2311 * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
2312 * are processed and the function then returns immediately. Processing events
2313 * will cause the window and input callbacks associated with those events to be
2314 * called.
2315 *
2316 * Since not all events are associated with callbacks, this function may return
2317 * without a callback having been called even if you are monitoring all
2318 * callbacks.
2319 *
2320 * On some platforms, a window move, resize or menu operation will cause event
2321 * processing to block. This is due to how event processing is designed on
2322 * those platforms. You can use the
2323 * [window refresh callback](@ref window_refresh) to redraw the contents of
2324 * your window when necessary during such operations.
2325 *
2326 * On some platforms, certain callbacks may be called outside of a call to one
2327 * of the event processing functions.
2328 *
2329 * If no windows exist, this function returns immediately. For synchronization
2330 * of threads in applications that do not create windows, use your threading
2331 * library of choice.
2332 *
2333 * Event processing is not required for joystick input to work.
2334 *
2335 * @par Reentrancy
2336 * This function may not be called from a callback.
2337 *
2338 * @par Thread Safety
2339 * This function may only be called from the main thread.
2340 *
2341 * @sa @ref events
2342 * @sa glfwPollEvents
2343 *
2344 * @since Added in GLFW 2.5.
2345 *
2346 * @ingroup window
2347 */
2348GLFWAPI void glfwWaitEvents(void);
2349
2350/*! @brief Posts an empty event to the event queue.
2351 *
2352 * This function posts an empty event from the current thread to the event
2353 * queue, causing @ref glfwWaitEvents to return.
2354 *
2355 * If no windows exist, this function returns immediately. For synchronization
2356 * of threads in applications that do not create windows, use your threading
2357 * library of choice.
2358 *
2359 * @par Thread Safety
2360 * This function may be called from any thread.
2361 *
2362 * @sa @ref events
2363 * @sa glfwWaitEvents
2364 *
2365 * @since Added in GLFW 3.1.
2366 *
2367 * @ingroup window
2368 */
2369GLFWAPI void glfwPostEmptyEvent(void);
2370
2371/*! @brief Returns the value of an input option for the specified window.
2372 *
2373 * This function returns the value of an input option for the specified window.
2374 * The mode must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2375 * `GLFW_STICKY_MOUSE_BUTTONS`.
2376 *
2377 * @param[in] window The window to query.
2378 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2379 * `GLFW_STICKY_MOUSE_BUTTONS`.
2380 *
2381 * @par Thread Safety
2382 * This function may only be called from the main thread.
2383 *
2384 * @sa glfwSetInputMode
2385 *
2386 * @since Added in GLFW 3.0.
2387 *
2388 * @ingroup input
2389 */
2390GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
2391
2392/*! @brief Sets an input option for the specified window.
2393 *
2394 * This function sets an input mode option for the specified window. The mode
2395 * must be one of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2396 * `GLFW_STICKY_MOUSE_BUTTONS`.
2397 *
2398 * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
2399 * modes:
2400 * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
2401 * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the client
2402 * area of the window but does not restrict the cursor from leaving.
2403 * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
2404 * and unlimited cursor movement. This is useful for implementing for
2405 * example 3D camera controls.
2406 *
2407 * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GL_TRUE` to
2408 * enable sticky keys, or `GL_FALSE` to disable it. If sticky keys are
2409 * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
2410 * the next time it is called even if the key had been released before the
2411 * call. This is useful when you are only interested in whether keys have been
2412 * pressed but not when or in which order.
2413 *
2414 * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
2415 * `GL_TRUE` to enable sticky mouse buttons, or `GL_FALSE` to disable it. If
2416 * sticky mouse buttons are enabled, a mouse button press will ensure that @ref
2417 * glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even if
2418 * the mouse button had been released before the call. This is useful when you
2419 * are only interested in whether mouse buttons have been pressed but not when
2420 * or in which order.
2421 *
2422 * @param[in] window The window whose input mode to set.
2423 * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS` or
2424 * `GLFW_STICKY_MOUSE_BUTTONS`.
2425 * @param[in] value The new value of the specified input mode.
2426 *
2427 * @par Thread Safety
2428 * This function may only be called from the main thread.
2429 *
2430 * @sa glfwGetInputMode
2431 *
2432 * @since Added in GLFW 3.0. Replaces `glfwEnable` and `glfwDisable`.
2433 *
2434 * @ingroup input
2435 */
2436GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
2437
2438/*! @brief Returns the last reported state of a keyboard key for the specified
2439 * window.
2440 *
2441 * This function returns the last state reported for the specified key to the
2442 * specified window. The returned state is one of `GLFW_PRESS` or
2443 * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to
2444 * the key callback.
2445 *
2446 * If the `GLFW_STICKY_KEYS` input mode is enabled, this function returns
2447 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
2448 * that key has already been released.
2449 *
2450 * The key functions deal with physical keys, with [key tokens](@ref keys)
2451 * named after their use on the standard US keyboard layout. If you want to
2452 * input text, use the Unicode character callback instead.
2453 *
2454 * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
2455 * used with this function.
2456 *
2457 * @param[in] window The desired window.
2458 * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
2459 * not a valid key for this function.
2460 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
2461 *
2462 * @par Thread Safety
2463 * This function may only be called from the main thread.
2464 *
2465 * @sa @ref input_key
2466 *
2467 * @since Added in GLFW 1.0.
2468 *
2469 * @par
2470 * __GLFW 3:__ Added window handle parameter.
2471 *
2472 * @ingroup input
2473 */
2474GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
2475
2476/*! @brief Returns the last reported state of a mouse button for the specified
2477 * window.
2478 *
2479 * This function returns the last state reported for the specified mouse button
2480 * to the specified window. The returned state is one of `GLFW_PRESS` or
2481 * `GLFW_RELEASE`.
2482 *
2483 * If the `GLFW_STICKY_MOUSE_BUTTONS` input mode is enabled, this function
2484 * `GLFW_PRESS` the first time you call it for a mouse button that was pressed,
2485 * even if that mouse button has already been released.
2486 *
2487 * @param[in] window The desired window.
2488 * @param[in] button The desired [mouse button](@ref buttons).
2489 * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
2490 *
2491 * @par Thread Safety
2492 * This function may only be called from the main thread.
2493 *
2494 * @sa @ref input_mouse_button
2495 *
2496 * @since Added in GLFW 1.0.
2497 *
2498 * @par
2499 * __GLFW 3:__ Added window handle parameter.
2500 *
2501 * @ingroup input
2502 */
2503GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
2504
2505/*! @brief Retrieves the position of the cursor relative to the client area of
2506 * the window.
2507 *
2508 * This function returns the position of the cursor, in screen coordinates,
2509 * relative to the upper-left corner of the client area of the specified
2510 * window.
2511 *
2512 * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
2513 * position is unbounded and limited only by the minimum and maximum values of
2514 * a `double`.
2515 *
2516 * The coordinate can be converted to their integer equivalents with the
2517 * `floor` function. Casting directly to an integer type works for positive
2518 * coordinates, but fails for negative ones.
2519 *
2520 * Any or all of the position arguments may be `NULL`. If an error occurs, all
2521 * non-`NULL` position arguments will be set to zero.
2522 *
2523 * @param[in] window The desired window.
2524 * @param[out] xpos Where to store the cursor x-coordinate, relative to the
2525 * left edge of the client area, or `NULL`.
2526 * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
2527 * top edge of the client area, or `NULL`.
2528 *
2529 * @par Thread Safety
2530 * This function may only be called from the main thread.
2531 *
2532 * @sa @ref cursor_pos
2533 * @sa glfwSetCursorPos
2534 *
2535 * @since Added in GLFW 3.0. Replaces `glfwGetMousePos`.
2536 *
2537 * @ingroup input
2538 */
2539GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
2540
2541/*! @brief Sets the position of the cursor, relative to the client area of the
2542 * window.
2543 *
2544 * This function sets the position, in screen coordinates, of the cursor
2545 * relative to the upper-left corner of the client area of the specified
2546 * window. The window must have input focus. If the window does not have
2547 * input focus when this function is called, it fails silently.
2548 *
2549 * __Do not use this function__ to implement things like camera controls. GLFW
2550 * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
2551 * cursor, transparently re-centers it and provides unconstrained cursor
2552 * motion. See @ref glfwSetInputMode for more information.
2553 *
2554 * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
2555 * unconstrained and limited only by the minimum and maximum values of
2556 * a `double`.
2557 *
2558 * @param[in] window The desired window.
2559 * @param[in] xpos The desired x-coordinate, relative to the left edge of the
2560 * client area.
2561 * @param[in] ypos The desired y-coordinate, relative to the top edge of the
2562 * client area.
2563 *
2564 * @remarks __X11:__ Due to the asynchronous nature of a modern X desktop, it
2565 * may take a moment for the window focus event to arrive. This means you will
2566 * not be able to set the cursor position directly after window creation.
2567 *
2568 * @par Thread Safety
2569 * This function may only be called from the main thread.
2570 *
2571 * @sa @ref cursor_pos
2572 * @sa glfwGetCursorPos
2573 *
2574 * @since Added in GLFW 3.0. Replaces `glfwSetMousePos`.
2575 *
2576 * @ingroup input
2577 */
2578GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
2579
2580/*! @brief Creates a custom cursor.
2581 *
2582 * Creates a new custom cursor image that can be set for a window with @ref
2583 * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
2584 * Any remaining cursors are destroyed by @ref glfwTerminate.
2585 *
2586 * The pixels are 32-bit little-endian RGBA, i.e. eight bits per channel. They
2587 * are arranged canonically as packed sequential rows, starting from the
2588 * top-left corner.
2589 *
2590 * The cursor hotspot is specified in pixels, relative to the upper-left corner
2591 * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
2592 * points to the right and the Y-axis points down.
2593 *
2594 * @param[in] image The desired cursor image.
2595 * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
2596 * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
2597 *
2598 * @return The handle of the created cursor, or `NULL` if an
2599 * [error](@ref error_handling) occurred.
2600 *
2601 * @par Pointer Lifetime
2602 * The specified image data is copied before this function returns.
2603 *
2604 * @par Reentrancy
2605 * This function may not be called from a callback.
2606 *
2607 * @par Thread Safety
2608 * This function may only be called from the main thread.
2609 *
2610 * @sa @ref cursor_object
2611 * @sa glfwDestroyCursor
2612 * @sa glfwCreateStandardCursor
2613 *
2614 * @since Added in GLFW 3.1.
2615 *
2616 * @ingroup input
2617 */
2618GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
2619
2620/*! @brief Creates a cursor with a standard shape.
2621 *
2622 * Returns a cursor with a [standard shape](@ref shapes), that can be set for
2623 * a window with @ref glfwSetCursor.
2624 *
2625 * @param[in] shape One of the [standard shapes](@ref shapes).
2626 *
2627 * @return A new cursor ready to use or `NULL` if an
2628 * [error](@ref error_handling) occurred.
2629 *
2630 * @par Reentrancy
2631 * This function may not be called from a callback.
2632 *
2633 * @par Thread Safety
2634 * This function may only be called from the main thread.
2635 *
2636 * @sa @ref cursor_object
2637 * @sa glfwCreateCursor
2638 *
2639 * @since Added in GLFW 3.1.
2640 *
2641 * @ingroup input
2642 */
2643GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
2644
2645/*! @brief Destroys a cursor.
2646 *
2647 * This function destroys a cursor previously created with @ref
2648 * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
2649 * glfwTerminate.
2650 *
2651 * @param[in] cursor The cursor object to destroy.
2652 *
2653 * @par Reentrancy
2654 * This function may not be called from a callback.
2655 *
2656 * @par Thread Safety
2657 * This function may only be called from the main thread.
2658 *
2659 * @sa @ref cursor_object
2660 * @sa glfwCreateCursor
2661 *
2662 * @since Added in GLFW 3.1.
2663 *
2664 * @ingroup input
2665 */
2666GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
2667
2668/*! @brief Sets the cursor for the window.
2669 *
2670 * This function sets the cursor image to be used when the cursor is over the
2671 * client area of the specified window. The set cursor will only be visible
2672 * when the [cursor mode](@ref cursor_mode) of the window is
2673 * `GLFW_CURSOR_NORMAL`.
2674 *
2675 * On some platforms, the set cursor may not be visible unless the window also
2676 * has input focus.
2677 *
2678 * @param[in] window The window to set the cursor for.
2679 * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
2680 * arrow cursor.
2681 *
2682 * @par Thread Safety
2683 * This function may only be called from the main thread.
2684 *
2685 * @sa @ref cursor_object
2686 *
2687 * @since Added in GLFW 3.1.
2688 *
2689 * @ingroup input
2690 */
2691GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
2692
2693/*! @brief Sets the key callback.
2694 *
2695 * This function sets the key callback of the specified window, which is called
2696 * when a key is pressed, repeated or released.
2697 *
2698 * The key functions deal with physical keys, with layout independent
2699 * [key tokens](@ref keys) named after their values in the standard US keyboard
2700 * layout. If you want to input text, use the
2701 * [character callback](@ref glfwSetCharCallback) instead.
2702 *
2703 * When a window loses input focus, it will generate synthetic key release
2704 * events for all pressed keys. You can tell these events from user-generated
2705 * events by the fact that the synthetic ones are generated after the focus
2706 * loss event has been processed, i.e. after the
2707 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
2708 *
2709 * The scancode of a key is specific to that platform or sometimes even to that
2710 * machine. Scancodes are intended to allow users to bind keys that don't have
2711 * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
2712 * state is not saved and so it cannot be queried with @ref glfwGetKey.
2713 *
2714 * Sometimes GLFW needs to generate synthetic key events, in which case the
2715 * scancode may be zero.
2716 *
2717 * @param[in] window The window whose callback to set.
2718 * @param[in] cbfun The new key callback, or `NULL` to remove the currently
2719 * set callback.
2720 * @return The previously set callback, or `NULL` if no callback was set or the
2721 * library had not been [initialized](@ref intro_init).
2722 *
2723 * @par Thread Safety
2724 * This function may only be called from the main thread.
2725 *
2726 * @sa @ref input_key
2727 *
2728 * @since Added in GLFW 1.0.
2729 *
2730 * @par
2731 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
2732 *
2733 * @ingroup input
2734 */
2735GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun cbfun);
2736
2737/*! @brief Sets the Unicode character callback.
2738 *
2739 * This function sets the character callback of the specified window, which is
2740 * called when a Unicode character is input.
2741 *
2742 * The character callback is intended for Unicode text input. As it deals with
2743 * characters, it is keyboard layout dependent, whereas the
2744 * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
2745 * to physical keys, as a key may produce zero, one or more characters. If you
2746 * want to know whether a specific physical key was pressed or released, see
2747 * the key callback instead.
2748 *
2749 * The character callback behaves as system text input normally does and will
2750 * not be called if modifier keys are held down that would prevent normal text
2751 * input on that platform, for example a Super (Command) key on OS X or Alt key
2752 * on Windows. There is a
2753 * [character with modifiers callback](@ref glfwSetCharModsCallback) that
2754 * receives these events.
2755 *
2756 * @param[in] window The window whose callback to set.
2757 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2758 * callback.
2759 * @return The previously set callback, or `NULL` if no callback was set or the
2760 * library had not been [initialized](@ref intro_init).
2761 *
2762 * @par Thread Safety
2763 * This function may only be called from the main thread.
2764 *
2765 * @sa @ref input_char
2766 *
2767 * @since Added in GLFW 2.4.
2768 *
2769 * @par
2770 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
2771 *
2772 * @ingroup input
2773 */
2774GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun cbfun);
2775
2776/*! @brief Sets the Unicode character with modifiers callback.
2777 *
2778 * This function sets the character with modifiers callback of the specified
2779 * window, which is called when a Unicode character is input regardless of what
2780 * modifier keys are used.
2781 *
2782 * The character with modifiers callback is intended for implementing custom
2783 * Unicode character input. For regular Unicode text input, see the
2784 * [character callback](@ref glfwSetCharCallback). Like the character
2785 * callback, the character with modifiers callback deals with characters and is
2786 * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
2787 * a key may produce zero, one or more characters. If you want to know whether
2788 * a specific physical key was pressed or released, see the
2789 * [key callback](@ref glfwSetKeyCallback) instead.
2790 *
2791 * @param[in] window The window whose callback to set.
2792 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2793 * callback.
2794 * @return The previously set callback, or `NULL` if no callback was set or an
2795 * error occurred.
2796 *
2797 * @par Thread Safety
2798 * This function may only be called from the main thread.
2799 *
2800 * @sa @ref input_char
2801 *
2802 * @since Added in GLFW 3.1.
2803 *
2804 * @ingroup input
2805 */
2806GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun cbfun);
2807
2808/*! @brief Sets the mouse button callback.
2809 *
2810 * This function sets the mouse button callback of the specified window, which
2811 * is called when a mouse button is pressed or released.
2812 *
2813 * When a window loses input focus, it will generate synthetic mouse button
2814 * release events for all pressed mouse buttons. You can tell these events
2815 * from user-generated events by the fact that the synthetic ones are generated
2816 * after the focus loss event has been processed, i.e. after the
2817 * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
2818 *
2819 * @param[in] window The window whose callback to set.
2820 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2821 * callback.
2822 * @return The previously set callback, or `NULL` if no callback was set or the
2823 * library had not been [initialized](@ref intro_init).
2824 *
2825 * @par Thread Safety
2826 * This function may only be called from the main thread.
2827 *
2828 * @sa @ref input_mouse_button
2829 *
2830 * @since Added in GLFW 1.0.
2831 *
2832 * @par
2833 * __GLFW 3:__ Added window handle parameter. Updated callback signature.
2834 *
2835 * @ingroup input
2836 */
2837GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun cbfun);
2838
2839/*! @brief Sets the cursor position callback.
2840 *
2841 * This function sets the cursor position callback of the specified window,
2842 * which is called when the cursor is moved. The callback is provided with the
2843 * position, in screen coordinates, relative to the upper-left corner of the
2844 * client area of the window.
2845 *
2846 * @param[in] window The window whose callback to set.
2847 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2848 * callback.
2849 * @return The previously set callback, or `NULL` if no callback was set or the
2850 * library had not been [initialized](@ref intro_init).
2851 *
2852 * @par Thread Safety
2853 * This function may only be called from the main thread.
2854 *
2855 * @sa @ref cursor_pos
2856 *
2857 * @since Added in GLFW 3.0. Replaces `glfwSetMousePosCallback`.
2858 *
2859 * @ingroup input
2860 */
2861GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun cbfun);
2862
2863/*! @brief Sets the cursor enter/exit callback.
2864 *
2865 * This function sets the cursor boundary crossing callback of the specified
2866 * window, which is called when the cursor enters or leaves the client area of
2867 * the window.
2868 *
2869 * @param[in] window The window whose callback to set.
2870 * @param[in] cbfun The new callback, or `NULL` to remove the currently set
2871 * callback.
2872 * @return The previously set callback, or `NULL` if no callback was set or the
2873 * library had not been [initialized](@ref intro_init).
2874 *
2875 * @par Thread Safety
2876 * This function may only be called from the main thread.
2877 *
2878 * @sa @ref cursor_enter
2879 *
2880 * @since Added in GLFW 3.0.
2881 *
2882 * @ingroup input
2883 */
2884GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
2885
2886/*! @brief Sets the scroll callback.
2887 *
2888 * This function sets the scroll callback of the specified window, which is
2889 * called when a scrolling device is used, such as a mouse wheel or scrolling
2890 * area of a touchpad.
2891 *
2892 * The scroll callback receives all scrolling input, like that from a mouse
2893 * wheel or a touchpad scrolling area.
2894 *
2895 * @param[in] window The window whose callback to set.
2896 * @param[in] cbfun The new scroll callback, or `NULL` to remove the currently
2897 * set callback.
2898 * @return The previously set callback, or `NULL` if no callback was set or the
2899 * library had not been [initialized](@ref intro_init).
2900 *
2901 * @par Thread Safety
2902 * This function may only be called from the main thread.
2903 *
2904 * @sa @ref scrolling
2905 *
2906 * @since Added in GLFW 3.0. Replaces `glfwSetMouseWheelCallback`.
2907 *
2908 * @ingroup input
2909 */
2910GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun cbfun);
2911
2912/*! @brief Sets the file drop callback.
2913 *
2914 * This function sets the file drop callback of the specified window, which is
2915 * called when one or more dragged files are dropped on the window.
2916 *
2917 * Because the path array and its strings may have been generated specifically
2918 * for that event, they are not guaranteed to be valid after the callback has
2919 * returned. If you wish to use them after the callback returns, you need to
2920 * make a deep copy.
2921 *
2922 * @param[in] window The window whose callback to set.
2923 * @param[in] cbfun The new file drop callback, or `NULL` to remove the
2924 * currently set callback.
2925 * @return The previously set callback, or `NULL` if no callback was set or the
2926 * library had not been [initialized](@ref intro_init).
2927 *
2928 * @par Thread Safety
2929 * This function may only be called from the main thread.
2930 *
2931 * @sa @ref path_drop
2932 *
2933 * @since Added in GLFW 3.1.
2934 *
2935 * @ingroup input
2936 */
2937GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun cbfun);
2938
2939/*! @brief Returns whether the specified joystick is present.
2940 *
2941 * This function returns whether the specified joystick is present.
2942 *
2943 * @param[in] joy The [joystick](@ref joysticks) to query.
2944 * @return `GL_TRUE` if the joystick is present, or `GL_FALSE` otherwise.
2945 *
2946 * @par Thread Safety
2947 * This function may only be called from the main thread.
2948 *
2949 * @sa @ref joystick
2950 *
2951 * @since Added in GLFW 3.0. Replaces `glfwGetJoystickParam`.
2952 *
2953 * @ingroup input
2954 */
2955GLFWAPI int glfwJoystickPresent(int joy);
2956
2957/*! @brief Returns the values of all axes of the specified joystick.
2958 *
2959 * This function returns the values of all axes of the specified joystick.
2960 * Each element in the array is a value between -1.0 and 1.0.
2961 *
2962 * @param[in] joy The [joystick](@ref joysticks) to query.
2963 * @param[out] count Where to store the number of axis values in the returned
2964 * array. This is set to zero if an error occurred.
2965 * @return An array of axis values, or `NULL` if the joystick is not present.
2966 *
2967 * @par Pointer Lifetime
2968 * The returned array is allocated and freed by GLFW. You should not free it
2969 * yourself. It is valid until the specified joystick is disconnected, this
2970 * function is called again for that joystick or the library is terminated.
2971 *
2972 * @par Thread Safety
2973 * This function may only be called from the main thread.
2974 *
2975 * @sa @ref joystick_axis
2976 *
2977 * @since Added in GLFW 3.0. Replaces `glfwGetJoystickPos`.
2978 *
2979 * @ingroup input
2980 */
2981GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count);
2982
2983/*! @brief Returns the state of all buttons of the specified joystick.
2984 *
2985 * This function returns the state of all buttons of the specified joystick.
2986 * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
2987 *
2988 * @param[in] joy The [joystick](@ref joysticks) to query.
2989 * @param[out] count Where to store the number of button states in the returned
2990 * array. This is set to zero if an error occurred.
2991 * @return An array of button states, or `NULL` if the joystick is not present.
2992 *
2993 * @par Pointer Lifetime
2994 * The returned array is allocated and freed by GLFW. You should not free it
2995 * yourself. It is valid until the specified joystick is disconnected, this
2996 * function is called again for that joystick or the library is terminated.
2997 *
2998 * @par Thread Safety
2999 * This function may only be called from the main thread.
3000 *
3001 * @sa @ref joystick_button
3002 *
3003 * @since Added in GLFW 2.2.
3004 *
3005 * @par
3006 * __GLFW 3:__ Changed to return a dynamic array.
3007 *
3008 * @ingroup input
3009 */
3010GLFWAPI const unsigned char* glfwGetJoystickButtons(int joy, int* count);
3011
3012/*! @brief Returns the name of the specified joystick.
3013 *
3014 * This function returns the name, encoded as UTF-8, of the specified joystick.
3015 * The returned string is allocated and freed by GLFW. You should not free it
3016 * yourself.
3017 *
3018 * @param[in] joy The [joystick](@ref joysticks) to query.
3019 * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
3020 * is not present.
3021 *
3022 * @par Pointer Lifetime
3023 * The returned string is allocated and freed by GLFW. You should not free it
3024 * yourself. It is valid until the specified joystick is disconnected, this
3025 * function is called again for that joystick or the library is terminated.
3026 *
3027 * @par Thread Safety
3028 * This function may only be called from the main thread.
3029 *
3030 * @sa @ref joystick_name
3031 *
3032 * @since Added in GLFW 3.0.
3033 *
3034 * @ingroup input
3035 */
3036GLFWAPI const char* glfwGetJoystickName(int joy);
3037
3038/*! @brief Sets the clipboard to the specified string.
3039 *
3040 * This function sets the system clipboard to the specified, UTF-8 encoded
3041 * string.
3042 *
3043 * @param[in] window The window that will own the clipboard contents.
3044 * @param[in] string A UTF-8 encoded string.
3045 *
3046 * @par Pointer Lifetime
3047 * The specified string is copied before this function returns.
3048 *
3049 * @par Thread Safety
3050 * This function may only be called from the main thread.
3051 *
3052 * @sa @ref clipboard
3053 * @sa glfwGetClipboardString
3054 *
3055 * @since Added in GLFW 3.0.
3056 *
3057 * @ingroup input
3058 */
3059GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
3060
3061/*! @brief Returns the contents of the clipboard as a string.
3062 *
3063 * This function returns the contents of the system clipboard, if it contains
3064 * or is convertible to a UTF-8 encoded string.
3065 *
3066 * @param[in] window The window that will request the clipboard contents.
3067 * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
3068 * if an [error](@ref error_handling) occurred.
3069 *
3070 * @par Pointer Lifetime
3071 * The returned string is allocated and freed by GLFW. You should not free it
3072 * yourself. It is valid until the next call to @ref
3073 * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
3074 * is terminated.
3075 *
3076 * @par Thread Safety
3077 * This function may only be called from the main thread.
3078 *
3079 * @sa @ref clipboard
3080 * @sa glfwSetClipboardString
3081 *
3082 * @since Added in GLFW 3.0.
3083 *
3084 * @ingroup input
3085 */
3086GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
3087
3088/*! @brief Returns the value of the GLFW timer.
3089 *
3090 * This function returns the value of the GLFW timer. Unless the timer has
3091 * been set using @ref glfwSetTime, the timer measures time elapsed since GLFW
3092 * was initialized.
3093 *
3094 * The resolution of the timer is system dependent, but is usually on the order
3095 * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
3096 * time source on each supported platform.
3097 *
3098 * @return The current value, in seconds, or zero if an
3099 * [error](@ref error_handling) occurred.
3100 *
3101 * @par Thread Safety
3102 * This function may be called from any thread. Access is not synchronized.
3103 *
3104 * @sa @ref time
3105 *
3106 * @since Added in GLFW 1.0.
3107 *
3108 * @ingroup input
3109 */
3110GLFWAPI double glfwGetTime(void);
3111
3112/*! @brief Sets the GLFW timer.
3113 *
3114 * This function sets the value of the GLFW timer. It then continues to count
3115 * up from that value. The value must be a positive finite number less than
3116 * or equal to 18446744073.0, which is approximately 584.5 years.
3117 *
3118 * @param[in] time The new value, in seconds.
3119 *
3120 * @remarks The upper limit of the timer is calculated as
3121 * floor((2<sup>64</sup> - 1) / 10<sup>9</sup>) and is due to implementations
3122 * storing nanoseconds in 64 bits. The limit may be increased in the future.
3123 *
3124 * @par Thread Safety
3125 * This function may only be called from the main thread.
3126 *
3127 * @sa @ref time
3128 *
3129 * @since Added in GLFW 2.2.
3130 *
3131 * @ingroup input
3132 */
3133GLFWAPI void glfwSetTime(double time);
3134
3135/*! @brief Makes the context of the specified window current for the calling
3136 * thread.
3137 *
3138 * This function makes the OpenGL or OpenGL ES context of the specified window
3139 * current on the calling thread. A context can only be made current on
3140 * a single thread at a time and each thread can have only a single current
3141 * context at a time.
3142 *
3143 * By default, making a context non-current implicitly forces a pipeline flush.
3144 * On machines that support `GL_KHR_context_flush_control`, you can control
3145 * whether a context performs this flush by setting the
3146 * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref window_hints_ctx) window hint.
3147 *
3148 * @param[in] window The window whose context to make current, or `NULL` to
3149 * detach the current context.
3150 *
3151 * @par Thread Safety
3152 * This function may be called from any thread.
3153 *
3154 * @sa @ref context_current
3155 * @sa glfwGetCurrentContext
3156 *
3157 * @since Added in GLFW 3.0.
3158 *
3159 * @ingroup context
3160 */
3161GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
3162
3163/*! @brief Returns the window whose context is current on the calling thread.
3164 *
3165 * This function returns the window whose OpenGL or OpenGL ES context is
3166 * current on the calling thread.
3167 *
3168 * @return The window whose context is current, or `NULL` if no window's
3169 * context is current.
3170 *
3171 * @par Thread Safety
3172 * This function may be called from any thread.
3173 *
3174 * @sa @ref context_current
3175 * @sa glfwMakeContextCurrent
3176 *
3177 * @since Added in GLFW 3.0.
3178 *
3179 * @ingroup context
3180 */
3181GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
3182
3183/*! @brief Swaps the front and back buffers of the specified window.
3184 *
3185 * This function swaps the front and back buffers of the specified window. If
3186 * the swap interval is greater than zero, the GPU driver waits the specified
3187 * number of screen updates before swapping the buffers.
3188 *
3189 * @param[in] window The window whose buffers to swap.
3190 *
3191 * @par Thread Safety
3192 * This function may be called from any thread.
3193 *
3194 * @sa @ref buffer_swap
3195 * @sa glfwSwapInterval
3196 *
3197 * @since Added in GLFW 1.0.
3198 *
3199 * @par
3200 * __GLFW 3:__ Added window handle parameter.
3201 *
3202 * @ingroup window
3203 */
3204GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
3205
3206/*! @brief Sets the swap interval for the current context.
3207 *
3208 * This function sets the swap interval for the current context, i.e. the
3209 * number of screen updates to wait from the time @ref glfwSwapBuffers was
3210 * called before swapping the buffers and returning. This is sometimes called
3211 * _vertical synchronization_, _vertical retrace synchronization_ or just
3212 * _vsync_.
3213 *
3214 * Contexts that support either of the `WGL_EXT_swap_control_tear` and
3215 * `GLX_EXT_swap_control_tear` extensions also accept negative swap intervals,
3216 * which allow the driver to swap even if a frame arrives a little bit late.
3217 * You can check for the presence of these extensions using @ref
3218 * glfwExtensionSupported. For more information about swap tearing, see the
3219 * extension specifications.
3220 *
3221 * A context must be current on the calling thread. Calling this function
3222 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
3223 *
3224 * @param[in] interval The minimum number of screen updates to wait for
3225 * until the buffers are swapped by @ref glfwSwapBuffers.
3226 *
3227 * @remarks This function is not called during context creation, leaving the
3228 * swap interval set to whatever is the default on that platform. This is done
3229 * because some swap interval extensions used by GLFW do not allow the swap
3230 * interval to be reset to zero once it has been set to a non-zero value.
3231 *
3232 * @remarks Some GPU drivers do not honor the requested swap interval, either
3233 * because of a user setting that overrides the application's request or due to
3234 * bugs in the driver.
3235 *
3236 * @par Thread Safety
3237 * This function may be called from any thread.
3238 *
3239 * @sa @ref buffer_swap
3240 * @sa glfwSwapBuffers
3241 *
3242 * @since Added in GLFW 1.0.
3243 *
3244 * @ingroup context
3245 */
3246GLFWAPI void glfwSwapInterval(int interval);
3247
3248/*! @brief Returns whether the specified extension is available.
3249 *
3250 * This function returns whether the specified
3251 * [client API extension](@ref context_glext) is supported by the current
3252 * OpenGL or OpenGL ES context. It searches both for OpenGL and OpenGL ES
3253 * extension and platform-specific context creation API extensions.
3254 *
3255 * A context must be current on the calling thread. Calling this function
3256 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
3257 *
3258 * As this functions retrieves and searches one or more extension strings each
3259 * call, it is recommended that you cache its results if it is going to be used
3260 * frequently. The extension strings will not change during the lifetime of
3261 * a context, so there is no danger in doing this.
3262 *
3263 * @param[in] extension The ASCII encoded name of the extension.
3264 * @return `GL_TRUE` if the extension is available, or `GL_FALSE` otherwise.
3265 *
3266 * @par Thread Safety
3267 * This function may be called from any thread.
3268 *
3269 * @sa @ref context_glext
3270 * @sa glfwGetProcAddress
3271 *
3272 * @since Added in GLFW 1.0.
3273 *
3274 * @ingroup context
3275 */
3276GLFWAPI int glfwExtensionSupported(const char* extension);
3277
3278/*! @brief Returns the address of the specified function for the current
3279 * context.
3280 *
3281 * This function returns the address of the specified
3282 * [core or extension function](@ref context_glext), if it is supported
3283 * by the current context.
3284 *
3285 * A context must be current on the calling thread. Calling this function
3286 * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
3287 *
3288 * @param[in] procname The ASCII encoded name of the function.
3289 * @return The address of the function, or `NULL` if the function is
3290 * unavailable or an [error](@ref error_handling) occurred.
3291 *
3292 * @remarks The addresses of a given function is not guaranteed to be the same
3293 * between contexts.
3294 *
3295 * @remarks This function may return a non-`NULL` address despite the
3296 * associated version or extension not being available. Always check the
3297 * context version or extension string presence first.
3298 *
3299 * @par Pointer Lifetime
3300 * The returned function pointer is valid until the context is destroyed or the
3301 * library is terminated.
3302 *
3303 * @par Thread Safety
3304 * This function may be called from any thread.
3305 *
3306 * @sa @ref context_glext
3307 * @sa glfwExtensionSupported
3308 *
3309 * @since Added in GLFW 1.0.
3310 *
3311 * @ingroup context
3312 */
3313GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
3314
3315
3316/*************************************************************************
3317 * Global definition cleanup
3318 *************************************************************************/
3319
3320/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
3321
3322#ifdef GLFW_WINGDIAPI_DEFINED
3323 #undef WINGDIAPI
3324 #undef GLFW_WINGDIAPI_DEFINED
3325#endif
3326
3327#ifdef GLFW_CALLBACK_DEFINED
3328 #undef CALLBACK
3329 #undef GLFW_CALLBACK_DEFINED
3330#endif
3331
3332/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
3333
3334
3335#ifdef __cplusplus
3336}
3337#endif
3338
3339#endif /* _glfw3_h_ */
3340