glfw3.h 209 KB
Newer Older
Camilla Berglund's avatar
Camilla Berglund committed
1
/*************************************************************************
Camilla Berglund's avatar
Camilla Berglund committed
2
 * GLFW 3.3 - www.glfw.org
3
 * A library for OpenGL, window and input
Camilla Berglund's avatar
Camilla Berglund committed
4
5
 *------------------------------------------------------------------------
 * Copyright (c) 2002-2006 Marcus Geelnard
Camilla Löwy's avatar
Camilla Löwy committed
6
 * Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
Camilla Berglund's avatar
Camilla Berglund committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 *
 * This software is provided 'as-is', without any express or implied
 * warranty. In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 *    claim that you wrote the original software. If you use this software
 *    in a product, an acknowledgment in the product documentation would
 *    be appreciated but is not required.
 *
 * 2. Altered source versions must be plainly marked as such, and must not
 *    be misrepresented as being the original software.
 *
 * 3. This notice may not be removed or altered from any source
 *    distribution.
 *
 *************************************************************************/

Camilla Berglund's avatar
Camilla Berglund committed
29
30
#ifndef _glfw3_h_
#define _glfw3_h_
Camilla Berglund's avatar
Camilla Berglund committed
31
32
33
34
35
36

#ifdef __cplusplus
extern "C" {
#endif


37
38
39
40
/*************************************************************************
 * Doxygen documentation
 *************************************************************************/

41
42
43
44
45
46
47
48
/*! @file glfw3.h
 *  @brief The header of the GLFW 3 API.
 *
 *  This is the header file of the GLFW 3 API.  It defines all its types and
 *  declares all its functions.
 *
 *  For more information about how to use this file, see @ref build_include.
 */
49
/*! @defgroup context Context reference
Camilla Löwy's avatar
Camilla Löwy committed
50
 *  @brief Functions and types related to OpenGL and OpenGL ES contexts.
Camilla Berglund's avatar
Camilla Berglund committed
51
 *
52
53
 *  This is the reference documentation for OpenGL and OpenGL ES context related
 *  functions.  For more task-oriented information, see the @ref context_guide.
54
 */
55
/*! @defgroup vulkan Vulkan reference
Camilla Löwy's avatar
Camilla Löwy committed
56
 *  @brief Functions and types related to Vulkan.
Camilla Berglund's avatar
Camilla Berglund committed
57
 *
58
59
 *  This is the reference documentation for Vulkan related functions and types.
 *  For more task-oriented information, see the @ref vulkan_guide.
Camilla Berglund's avatar
Camilla Berglund committed
60
 */
61
/*! @defgroup init Initialization, version and error reference
Camilla Löwy's avatar
Camilla Löwy committed
62
 *  @brief Functions and types related to initialization and error handling.
Camilla Berglund's avatar
Camilla Berglund committed
63
64
 *
 *  This is the reference documentation for initialization and termination of
65
66
 *  the library, version management and error handling.  For more task-oriented
 *  information, see the @ref intro_guide.
67
 */
68
/*! @defgroup input Input reference
Camilla Löwy's avatar
Camilla Löwy committed
69
 *  @brief Functions and types related to input handling.
Camilla Berglund's avatar
Camilla Berglund committed
70
71
 *
 *  This is the reference documentation for input related functions and types.
72
 *  For more task-oriented information, see the @ref input_guide.
73
 */
74
/*! @defgroup monitor Monitor reference
Camilla Löwy's avatar
Camilla Löwy committed
75
 *  @brief Functions and types related to monitors.
Camilla Berglund's avatar
Camilla Berglund committed
76
77
 *
 *  This is the reference documentation for monitor related functions and types.
78
 *  For more task-oriented information, see the @ref monitor_guide.
79
 */
80
/*! @defgroup window Window reference
Camilla Löwy's avatar
Camilla Löwy committed
81
 *  @brief Functions and types related to windows.
82
 *
Camilla Berglund's avatar
Camilla Berglund committed
83
 *  This is the reference documentation for window related functions and types,
84
85
 *  including creation, deletion and event polling.  For more task-oriented
 *  information, see the @ref window_guide.
86
87
88
 */


Camilla Berglund's avatar
Camilla Berglund committed
89
/*************************************************************************
90
 * Compiler- and platform-specific preprocessor work
Camilla Berglund's avatar
Camilla Berglund committed
91
92
 *************************************************************************/

93
/* If we are we on Windows, we want a single define for it.
Camilla Berglund's avatar
Camilla Berglund committed
94
 */
95
#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
Camilla Berglund's avatar
Camilla Berglund committed
96
97
98
 #define _WIN32
#endif /* _WIN32 */

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* Include because most Windows GLU headers need wchar_t and
 * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
 * Include it unconditionally to avoid surprising side-effects.
 */
#include <stddef.h>

/* Include because it is needed by Vulkan and related functions.
 * Include it unconditionally to avoid surprising side-effects.
 */
#include <stdint.h>

#if defined(GLFW_INCLUDE_VULKAN)
  #include <vulkan/vulkan.h>
#endif /* Vulkan header */

/* The Vulkan header may have indirectly included windows.h (because of
 * VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it.
 */

118
119
/* It is customary to use APIENTRY for OpenGL function pointer declarations on
 * all platforms.  Additionally, the Windows OpenGL header needs APIENTRY.
Camilla Berglund's avatar
Camilla Berglund committed
120
 */
Camilla Löwy's avatar
Cleanup    
Camilla Löwy committed
121
122
#if !defined(APIENTRY)
 #if defined(_WIN32)
Camilla Berglund's avatar
Camilla Berglund committed
123
124
125
126
  #define APIENTRY __stdcall
 #else
  #define APIENTRY
 #endif
127
 #define GLFW_APIENTRY_DEFINED
Camilla Berglund's avatar
Camilla Berglund committed
128
129
#endif /* APIENTRY */

130
/* Some Windows OpenGL headers need this.
Camilla Berglund's avatar
Camilla Berglund committed
131
132
 */
#if !defined(WINGDIAPI) && defined(_WIN32)
133
 #define WINGDIAPI __declspec(dllimport)
134
 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund's avatar
Camilla Berglund committed
135
136
#endif /* WINGDIAPI */

137
138
/* Some Windows GLU headers need this.
 */
Camilla Berglund's avatar
Camilla Berglund committed
139
#if !defined(CALLBACK) && defined(_WIN32)
140
 #define CALLBACK __stdcall
141
 #define GLFW_CALLBACK_DEFINED
Camilla Berglund's avatar
Camilla Berglund committed
142
143
#endif /* CALLBACK */

144
/* Include the chosen OpenGL or OpenGL ES headers.
145
 */
146
#if defined(GLFW_INCLUDE_ES1)
147

148
149
150
151
 #include <GLES/gl.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES/glext.h>
 #endif
152

153
#elif defined(GLFW_INCLUDE_ES2)
154

155
156
157
158
 #include <GLES2/gl2.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES2/gl2ext.h>
 #endif
159

160
#elif defined(GLFW_INCLUDE_ES3)
161

162
163
164
165
 #include <GLES3/gl3.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES2/gl2ext.h>
 #endif
166

167
#elif defined(GLFW_INCLUDE_ES31)
168

169
170
171
172
 #include <GLES3/gl31.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES2/gl2ext.h>
 #endif
173

174
#elif defined(GLFW_INCLUDE_ES32)
175

176
177
178
179
 #include <GLES3/gl32.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES2/gl2ext.h>
 #endif
180
181
182
183
184

#elif defined(GLFW_INCLUDE_GLCOREARB)

 #if defined(__APPLE__)

Camilla Berglund's avatar
Camilla Berglund committed
185
186
187
  #include <OpenGL/gl3.h>
  #if defined(GLFW_INCLUDE_GLEXT)
   #include <OpenGL/gl3ext.h>
188
189
190
191
192
193
194
195
196
197
198
199
  #endif /*GLFW_INCLUDE_GLEXT*/

 #else /*__APPLE__*/

  #include <GL/glcorearb.h>

 #endif /*__APPLE__*/

#elif !defined(GLFW_INCLUDE_NONE)

 #if defined(__APPLE__)

Camilla Berglund's avatar
Camilla Berglund committed
200
201
  #if !defined(GLFW_INCLUDE_GLEXT)
   #define GL_GLEXT_LEGACY
202
  #endif
Camilla Berglund's avatar
Camilla Berglund committed
203
  #include <OpenGL/gl.h>
204
205
206
207
208
209
  #if defined(GLFW_INCLUDE_GLU)
   #include <OpenGL/glu.h>
  #endif

 #else /*__APPLE__*/

Camilla Berglund's avatar
Camilla Berglund committed
210
211
212
213
  #include <GL/gl.h>
  #if defined(GLFW_INCLUDE_GLEXT)
   #include <GL/glext.h>
  #endif
214
215
216
217
218
219
220
221
  #if defined(GLFW_INCLUDE_GLU)
   #include <GL/glu.h>
  #endif

 #endif /*__APPLE__*/

#endif /* OpenGL and OpenGL ES headers */

222
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglund's avatar
Camilla Berglund committed
223
224
225
 /* GLFW_DLL must be defined by applications that are linking against the DLL
  * version of the GLFW library.  _GLFW_BUILD_DLL is defined by the GLFW
  * configuration header when compiling the DLL version of the library.
226
  */
227
 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
228
229
#endif

Camilla Berglund's avatar
Camilla Berglund committed
230
231
232
/* GLFWAPI is used to declare public API functions for export
 * from the DLL / shared library / dynamic library.
 */
233
#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
234
 /* We are building GLFW as a Win32 DLL */
Camilla Berglund's avatar
Camilla Berglund committed
235
 #define GLFWAPI __declspec(dllexport)
Camilla Berglund's avatar
Camilla Berglund committed
236
#elif defined(_WIN32) && defined(GLFW_DLL)
237
 /* We are calling GLFW as a Win32 DLL */
Camilla Berglund's avatar
Camilla Berglund committed
238
 #define GLFWAPI __declspec(dllimport)
239
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
240
 /* We are building GLFW as a shared / dynamic library */
241
 #define GLFWAPI __attribute__((visibility("default")))
Camilla Berglund's avatar
Camilla Berglund committed
242
#else
243
 /* We are building or calling GLFW as a static library */
Camilla Berglund's avatar
Camilla Berglund committed
244
245
246
247
248
 #define GLFWAPI
#endif


/*************************************************************************
249
 * GLFW API tokens
Camilla Berglund's avatar
Camilla Berglund committed
250
251
 *************************************************************************/

252
253
254
255
256
257
258
/*! @name GLFW version macros
 *  @{ */
/*! @brief The major version number of the GLFW library.
 *
 *  This is incremented when the API is changed in non-compatible ways.
 *  @ingroup init
 */
259
#define GLFW_VERSION_MAJOR          3
260
261
262
263
264
265
/*! @brief The minor version number of the GLFW library.
 *
 *  This is incremented when features are added to the API but it remains
 *  backward-compatible.
 *  @ingroup init
 */
Camilla Berglund's avatar
Camilla Berglund committed
266
#define GLFW_VERSION_MINOR          3
267
268
269
270
271
272
/*! @brief The revision number of the GLFW library.
 *
 *  This is incremented when a bug fix release is made that does not contain any
 *  API changes.
 *  @ingroup init
 */
Camilla Löwy's avatar
Camilla Löwy committed
273
#define GLFW_VERSION_REVISION       2
274
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
275

276
277
/*! @brief One.
 *
Camilla Löwy's avatar
Camilla Löwy committed
278
 *  This is only semantic sugar for the number 1.  You can instead use `1` or
Camilla Löwy's avatar
Camilla Löwy committed
279
280
 *  `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal
 *  to one.
Camilla Löwy's avatar
Camilla Löwy committed
281
282
 *
 *  @ingroup init
283
284
285
286
 */
#define GLFW_TRUE                   1
/*! @brief Zero.
 *
Camilla Löwy's avatar
Camilla Löwy committed
287
 *  This is only semantic sugar for the number 0.  You can instead use `0` or
Camilla Löwy's avatar
Camilla Löwy committed
288
289
 *  `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is
 *  equal to zero.
Camilla Löwy's avatar
Camilla Löwy committed
290
291
 *
 *  @ingroup init
292
293
294
 */
#define GLFW_FALSE                  0

295
296
/*! @name Key and button actions
 *  @{ */
Camilla Berglund's avatar
Camilla Berglund committed
297
298
299
300
/*! @brief The key or mouse button was released.
 *
 *  The key or mouse button was released.
 *
301
302
 *  @ingroup input
 */
303
#define GLFW_RELEASE                0
Camilla Berglund's avatar
Camilla Berglund committed
304
305
306
307
/*! @brief The key or mouse button was pressed.
 *
 *  The key or mouse button was pressed.
 *
308
309
 *  @ingroup input
 */
310
#define GLFW_PRESS                  1
Camilla Berglund's avatar
Camilla Berglund committed
311
/*! @brief The key was held down until it repeated.
Camilla Berglund's avatar
Camilla Berglund committed
312
313
314
 *
 *  The key was held down until it repeated.
 *
Camilla Berglund's avatar
Camilla Berglund committed
315
316
317
 *  @ingroup input
 */
#define GLFW_REPEAT                 2
318
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
319

Camilla Löwy's avatar
Camilla Löwy committed
320
/*! @defgroup hat_state Joystick hat states
Camilla Löwy's avatar
Camilla Löwy committed
321
 *  @brief Joystick hat states.
IntellectualKitty's avatar
IntellectualKitty committed
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
 *
 *  See [joystick hat input](@ref joystick_hat) for how these are used.
 *
 *  @ingroup input
 *  @{ */
#define GLFW_HAT_CENTERED           0
#define GLFW_HAT_UP                 1
#define GLFW_HAT_RIGHT              2
#define GLFW_HAT_DOWN               4
#define GLFW_HAT_LEFT               8
#define GLFW_HAT_RIGHT_UP           (GLFW_HAT_RIGHT | GLFW_HAT_UP)
#define GLFW_HAT_RIGHT_DOWN         (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
#define GLFW_HAT_LEFT_UP            (GLFW_HAT_LEFT  | GLFW_HAT_UP)
#define GLFW_HAT_LEFT_DOWN          (GLFW_HAT_LEFT  | GLFW_HAT_DOWN)
/*! @} */

Camilla Berglund's avatar
Camilla Berglund committed
338
/*! @defgroup keys Keyboard keys
Camilla Löwy's avatar
Camilla Löwy committed
339
 *  @brief Keyboard key IDs.
Camilla Berglund's avatar
Camilla Berglund committed
340
 *
Camilla Berglund's avatar
Camilla Berglund committed
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
 *  See [key input](@ref input_key) for how these are used.
 *
 *  These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
 *  but re-arranged to map to 7-bit ASCII for printable keys (function keys are
 *  put in the 256+ range).
 *
 *  The naming of the key codes follow these rules:
 *   - The US keyboard layout is used
 *   - Names of printable alpha-numeric characters are used (e.g. "A", "R",
 *     "3", etc.)
 *   - For non-alphanumeric characters, Unicode:ish names are used (e.g.
 *     "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
 *     correspond to the Unicode standard (usually for brevity)
 *   - Keys that lack a clear US mapping are named "WORLD_x"
 *   - For non-printable keys, custom names are used (e.g. "F4",
 *     "BACKSPACE", etc.)
Camilla Berglund's avatar
Camilla Berglund committed
357
 *
358
359
360
361
 *  @ingroup input
 *  @{
 */

362
363
364
/* The unknown key */
#define GLFW_KEY_UNKNOWN            -1

365
/* Printable keys */
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
#define GLFW_KEY_SPACE              32
#define GLFW_KEY_APOSTROPHE         39  /* ' */
#define GLFW_KEY_COMMA              44  /* , */
#define GLFW_KEY_MINUS              45  /* - */
#define GLFW_KEY_PERIOD             46  /* . */
#define GLFW_KEY_SLASH              47  /* / */
#define GLFW_KEY_0                  48
#define GLFW_KEY_1                  49
#define GLFW_KEY_2                  50
#define GLFW_KEY_3                  51
#define GLFW_KEY_4                  52
#define GLFW_KEY_5                  53
#define GLFW_KEY_6                  54
#define GLFW_KEY_7                  55
#define GLFW_KEY_8                  56
#define GLFW_KEY_9                  57
#define GLFW_KEY_SEMICOLON          59  /* ; */
#define GLFW_KEY_EQUAL              61  /* = */
#define GLFW_KEY_A                  65
#define GLFW_KEY_B                  66
#define GLFW_KEY_C                  67
#define GLFW_KEY_D                  68
#define GLFW_KEY_E                  69
#define GLFW_KEY_F                  70
#define GLFW_KEY_G                  71
#define GLFW_KEY_H                  72
#define GLFW_KEY_I                  73
#define GLFW_KEY_J                  74
#define GLFW_KEY_K                  75
#define GLFW_KEY_L                  76
#define GLFW_KEY_M                  77
#define GLFW_KEY_N                  78
#define GLFW_KEY_O                  79
#define GLFW_KEY_P                  80
#define GLFW_KEY_Q                  81
#define GLFW_KEY_R                  82
#define GLFW_KEY_S                  83
#define GLFW_KEY_T                  84
#define GLFW_KEY_U                  85
#define GLFW_KEY_V                  86
#define GLFW_KEY_W                  87
#define GLFW_KEY_X                  88
#define GLFW_KEY_Y                  89
#define GLFW_KEY_Z                  90
#define GLFW_KEY_LEFT_BRACKET       91  /* [ */
#define GLFW_KEY_BACKSLASH          92  /* \ */
#define GLFW_KEY_RIGHT_BRACKET      93  /* ] */
#define GLFW_KEY_GRAVE_ACCENT       96  /* ` */
#define GLFW_KEY_WORLD_1            161 /* non-US #1 */
#define GLFW_KEY_WORLD_2            162 /* non-US #2 */
416
417

/* Function keys */
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
#define GLFW_KEY_ESCAPE             256
#define GLFW_KEY_ENTER              257
#define GLFW_KEY_TAB                258
#define GLFW_KEY_BACKSPACE          259
#define GLFW_KEY_INSERT             260
#define GLFW_KEY_DELETE             261
#define GLFW_KEY_RIGHT              262
#define GLFW_KEY_LEFT               263
#define GLFW_KEY_DOWN               264
#define GLFW_KEY_UP                 265
#define GLFW_KEY_PAGE_UP            266
#define GLFW_KEY_PAGE_DOWN          267
#define GLFW_KEY_HOME               268
#define GLFW_KEY_END                269
#define GLFW_KEY_CAPS_LOCK          280
#define GLFW_KEY_SCROLL_LOCK        281
#define GLFW_KEY_NUM_LOCK           282
#define GLFW_KEY_PRINT_SCREEN       283
#define GLFW_KEY_PAUSE              284
#define GLFW_KEY_F1                 290
#define GLFW_KEY_F2                 291
#define GLFW_KEY_F3                 292
#define GLFW_KEY_F4                 293
#define GLFW_KEY_F5                 294
#define GLFW_KEY_F6                 295
#define GLFW_KEY_F7                 296
#define GLFW_KEY_F8                 297
#define GLFW_KEY_F9                 298
#define GLFW_KEY_F10                299
#define GLFW_KEY_F11                300
#define GLFW_KEY_F12                301
#define GLFW_KEY_F13                302
#define GLFW_KEY_F14                303
#define GLFW_KEY_F15                304
#define GLFW_KEY_F16                305
#define GLFW_KEY_F17                306
#define GLFW_KEY_F18                307
#define GLFW_KEY_F19                308
#define GLFW_KEY_F20                309
#define GLFW_KEY_F21                310
#define GLFW_KEY_F22                311
#define GLFW_KEY_F23                312
#define GLFW_KEY_F24                313
#define GLFW_KEY_F25                314
#define GLFW_KEY_KP_0               320
#define GLFW_KEY_KP_1               321
#define GLFW_KEY_KP_2               322
#define GLFW_KEY_KP_3               323
#define GLFW_KEY_KP_4               324
#define GLFW_KEY_KP_5               325
#define GLFW_KEY_KP_6               326
#define GLFW_KEY_KP_7               327
#define GLFW_KEY_KP_8               328
#define GLFW_KEY_KP_9               329
#define GLFW_KEY_KP_DECIMAL         330
#define GLFW_KEY_KP_DIVIDE          331
#define GLFW_KEY_KP_MULTIPLY        332
#define GLFW_KEY_KP_SUBTRACT        333
#define GLFW_KEY_KP_ADD             334
#define GLFW_KEY_KP_ENTER           335
#define GLFW_KEY_KP_EQUAL           336
#define GLFW_KEY_LEFT_SHIFT         340
#define GLFW_KEY_LEFT_CONTROL       341
#define GLFW_KEY_LEFT_ALT           342
#define GLFW_KEY_LEFT_SUPER         343
#define GLFW_KEY_RIGHT_SHIFT        344
#define GLFW_KEY_RIGHT_CONTROL      345
#define GLFW_KEY_RIGHT_ALT          346
#define GLFW_KEY_RIGHT_SUPER        347
#define GLFW_KEY_MENU               348
Camilla Berglund's avatar
Camilla Berglund committed
488

489
#define GLFW_KEY_LAST               GLFW_KEY_MENU
490

491
492
/*! @} */

493
/*! @defgroup mods Modifier key flags
Camilla Löwy's avatar
Camilla Löwy committed
494
 *  @brief Modifier key flags.
Camilla Berglund's avatar
Camilla Berglund committed
495
496
497
 *
 *  See [key input](@ref input_key) for how these are used.
 *
498
 *  @ingroup input
499
500
 *  @{ */

501
/*! @brief If this bit is set one or more Shift keys were held down.
502
503
 *
 *  If this bit is set one or more Shift keys were held down.
504
505
 */
#define GLFW_MOD_SHIFT           0x0001
506
/*! @brief If this bit is set one or more Control keys were held down.
507
508
 *
 *  If this bit is set one or more Control keys were held down.
509
 */
510
#define GLFW_MOD_CONTROL         0x0002
511
/*! @brief If this bit is set one or more Alt keys were held down.
512
513
 *
 *  If this bit is set one or more Alt keys were held down.
514
515
 */
#define GLFW_MOD_ALT             0x0004
516
/*! @brief If this bit is set one or more Super keys were held down.
517
518
 *
 *  If this bit is set one or more Super keys were held down.
Noel Cower's avatar
Noel Cower committed
519
520
 */
#define GLFW_MOD_SUPER           0x0008
521
522
523
524
525
526
527
528
529
530
531
532
/*! @brief If this bit is set the Caps Lock key is enabled.
 *
 *  If this bit is set the Caps Lock key is enabled and the @ref
 *  GLFW_LOCK_KEY_MODS input mode is set.
 */
#define GLFW_MOD_CAPS_LOCK       0x0010
/*! @brief If this bit is set the Num Lock key is enabled.
 *
 *  If this bit is set the Num Lock key is enabled and the @ref
 *  GLFW_LOCK_KEY_MODS input mode is set.
 */
#define GLFW_MOD_NUM_LOCK        0x0020
533
534
535

/*! @} */

536
/*! @defgroup buttons Mouse buttons
Camilla Löwy's avatar
Camilla Löwy committed
537
 *  @brief Mouse button IDs.
Camilla Berglund's avatar
Camilla Berglund committed
538
539
540
 *
 *  See [mouse button input](@ref input_mouse_button) for how these are used.
 *
541
542
 *  @ingroup input
 *  @{ */
543
544
545
546
547
548
549
550
551
552
553
554
#define GLFW_MOUSE_BUTTON_1         0
#define GLFW_MOUSE_BUTTON_2         1
#define GLFW_MOUSE_BUTTON_3         2
#define GLFW_MOUSE_BUTTON_4         3
#define GLFW_MOUSE_BUTTON_5         4
#define GLFW_MOUSE_BUTTON_6         5
#define GLFW_MOUSE_BUTTON_7         6
#define GLFW_MOUSE_BUTTON_8         7
#define GLFW_MOUSE_BUTTON_LAST      GLFW_MOUSE_BUTTON_8
#define GLFW_MOUSE_BUTTON_LEFT      GLFW_MOUSE_BUTTON_1
#define GLFW_MOUSE_BUTTON_RIGHT     GLFW_MOUSE_BUTTON_2
#define GLFW_MOUSE_BUTTON_MIDDLE    GLFW_MOUSE_BUTTON_3
555
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
556

557
/*! @defgroup joysticks Joysticks
Camilla Löwy's avatar
Camilla Löwy committed
558
 *  @brief Joystick IDs.
Camilla Berglund's avatar
Camilla Berglund committed
559
560
561
 *
 *  See [joystick input](@ref joystick) for how these are used.
 *
562
563
 *  @ingroup input
 *  @{ */
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
#define GLFW_JOYSTICK_1             0
#define GLFW_JOYSTICK_2             1
#define GLFW_JOYSTICK_3             2
#define GLFW_JOYSTICK_4             3
#define GLFW_JOYSTICK_5             4
#define GLFW_JOYSTICK_6             5
#define GLFW_JOYSTICK_7             6
#define GLFW_JOYSTICK_8             7
#define GLFW_JOYSTICK_9             8
#define GLFW_JOYSTICK_10            9
#define GLFW_JOYSTICK_11            10
#define GLFW_JOYSTICK_12            11
#define GLFW_JOYSTICK_13            12
#define GLFW_JOYSTICK_14            13
#define GLFW_JOYSTICK_15            14
#define GLFW_JOYSTICK_16            15
#define GLFW_JOYSTICK_LAST          GLFW_JOYSTICK_16
581
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
582

583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
/*! @defgroup gamepad_buttons Gamepad buttons
 *  @brief Gamepad buttons.
 *
 *  See @ref gamepad for how these are used.
 *
 *  @ingroup input
 *  @{ */
#define GLFW_GAMEPAD_BUTTON_A               0
#define GLFW_GAMEPAD_BUTTON_B               1
#define GLFW_GAMEPAD_BUTTON_X               2
#define GLFW_GAMEPAD_BUTTON_Y               3
#define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER     4
#define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER    5
#define GLFW_GAMEPAD_BUTTON_BACK            6
#define GLFW_GAMEPAD_BUTTON_START           7
#define GLFW_GAMEPAD_BUTTON_GUIDE           8
#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB      9
#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB     10
#define GLFW_GAMEPAD_BUTTON_DPAD_UP         11
#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT      12
#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN       13
#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT       14
#define GLFW_GAMEPAD_BUTTON_LAST            GLFW_GAMEPAD_BUTTON_DPAD_LEFT

#define GLFW_GAMEPAD_BUTTON_CROSS       GLFW_GAMEPAD_BUTTON_A
#define GLFW_GAMEPAD_BUTTON_CIRCLE      GLFW_GAMEPAD_BUTTON_B
#define GLFW_GAMEPAD_BUTTON_SQUARE      GLFW_GAMEPAD_BUTTON_X
#define GLFW_GAMEPAD_BUTTON_TRIANGLE    GLFW_GAMEPAD_BUTTON_Y
/*! @} */

/*! @defgroup gamepad_axes Gamepad axes
 *  @brief Gamepad axes.
 *
 *  See @ref gamepad for how these are used.
 *
 *  @ingroup input
 *  @{ */
#define GLFW_GAMEPAD_AXIS_LEFT_X        0
#define GLFW_GAMEPAD_AXIS_LEFT_Y        1
#define GLFW_GAMEPAD_AXIS_RIGHT_X       2
#define GLFW_GAMEPAD_AXIS_RIGHT_Y       3
#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER  4
#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5
#define GLFW_GAMEPAD_AXIS_LAST          GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
/*! @} */

629
/*! @defgroup errors Error codes
Camilla Löwy's avatar
Camilla Löwy committed
630
 *  @brief Error codes.
Camilla Berglund's avatar
Camilla Berglund committed
631
632
633
 *
 *  See [error handling](@ref error_handling) for how these are used.
 *
Camilla Berglund's avatar
Camilla Berglund committed
634
 *  @ingroup init
635
 *  @{ */
Camilla Löwy's avatar
Camilla Löwy committed
636
637
638
639
640
641
642
/*! @brief No error has occurred.
 *
 *  No error has occurred.
 *
 *  @analysis Yay.
 */
#define GLFW_NO_ERROR               0
643
/*! @brief GLFW has not been initialized.
Camilla Berglund's avatar
Camilla Berglund committed
644
 *
645
 *  This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund's avatar
Camilla Berglund committed
646
647
 *  library is [initialized](@ref intro_init).
 *
648
649
 *  @analysis Application programmer error.  Initialize GLFW before calling any
 *  function that requires initialization.
650
 */
Camilla Berglund's avatar
Camilla Berglund committed
651
#define GLFW_NOT_INITIALIZED        0x00010001
652
/*! @brief No context is current for this thread.
Camilla Berglund's avatar
Camilla Berglund committed
653
654
655
656
657
 *
 *  This occurs if a GLFW function was called that needs and operates on the
 *  current OpenGL or OpenGL ES context but no context is current on the calling
 *  thread.  One such function is @ref glfwSwapInterval.
 *
658
659
 *  @analysis Application programmer error.  Ensure a context is current before
 *  calling functions that require a current context.
660
 */
Camilla Berglund's avatar
Camilla Berglund committed
661
#define GLFW_NO_CURRENT_CONTEXT     0x00010002
Camilla Berglund's avatar
Camilla Berglund committed
662
663
664
/*! @brief One of the arguments to the function was an invalid enum value.
 *
 *  One of the arguments to the function was an invalid enum value, for example
Camilla Löwy's avatar
Camilla Löwy committed
665
 *  requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
Camilla Berglund's avatar
Camilla Berglund committed
666
 *
667
 *  @analysis Application programmer error.  Fix the offending call.
668
 */
Camilla Berglund's avatar
Camilla Berglund committed
669
#define GLFW_INVALID_ENUM           0x00010003
Camilla Berglund's avatar
Camilla Berglund committed
670
671
672
673
674
675
676
677
/*! @brief One of the arguments to the function was an invalid value.
 *
 *  One of the arguments to the function was an invalid value, for example
 *  requesting a non-existent OpenGL or OpenGL ES version like 2.7.
 *
 *  Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
 *  result in a @ref GLFW_VERSION_UNAVAILABLE error.
 *
678
 *  @analysis Application programmer error.  Fix the offending call.
679
 */
Camilla Berglund's avatar
Camilla Berglund committed
680
#define GLFW_INVALID_VALUE          0x00010004
681
/*! @brief A memory allocation failed.
Camilla Berglund's avatar
Camilla Berglund committed
682
683
684
 *
 *  A memory allocation failed.
 *
685
686
 *  @analysis A bug in GLFW or the underlying operating system.  Report the bug
 *  to our [issue tracker](https://github.com/glfw/glfw/issues).
687
 */
Camilla Berglund's avatar
Camilla Berglund committed
688
#define GLFW_OUT_OF_MEMORY          0x00010005
Camilla Berglund's avatar
Camilla Berglund committed
689
/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund's avatar
Camilla Berglund committed
690
 *
Camilla Berglund's avatar
Camilla Berglund committed
691
 *  GLFW could not find support for the requested API on the system.
Camilla Berglund's avatar
Camilla Berglund committed
692
 *
693
 *  @analysis The installed graphics driver does not support the requested
Camilla Berglund's avatar
Camilla Berglund committed
694
 *  API, or does not support it via the chosen context creation backend.
695
 *  Below are a few examples.
Camilla Berglund's avatar
Camilla Berglund committed
696
697
698
 *
 *  @par
 *  Some pre-installed Windows graphics drivers do not support OpenGL.  AMD only
Camilla Berglund's avatar
Camilla Berglund committed
699
 *  supports OpenGL ES via EGL, while Nvidia and Intel only support it via
700
 *  a WGL or GLX extension.  macOS does not provide OpenGL ES at all.  The Mesa
Camilla Berglund's avatar
Camilla Berglund committed
701
 *  EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund's avatar
Camilla Berglund committed
702
 *  driver.  Older graphics drivers do not support Vulkan.
703
 */
Camilla Berglund's avatar
Camilla Berglund committed
704
#define GLFW_API_UNAVAILABLE        0x00010006
Camilla Berglund's avatar
Camilla Berglund committed
705
706
/*! @brief The requested OpenGL or OpenGL ES version is not available.
 *
Camilla Berglund's avatar
Camilla Berglund committed
707
708
 *  The requested OpenGL or OpenGL ES version (including any requested context
 *  or framebuffer hints) is not available on this machine.
Camilla Berglund's avatar
Camilla Berglund committed
709
 *
710
711
712
 *  @analysis The machine does not support your requirements.  If your
 *  application is sufficiently flexible, downgrade your requirements and try
 *  again.  Otherwise, inform the user that their machine does not match your
Camilla Berglund's avatar
Camilla Berglund committed
713
714
 *  requirements.
 *
Camilla Berglund's avatar
Camilla Berglund committed
715
716
717
718
719
 *  @par
 *  Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
 *  comes out before the 4.x series gets that far, also fail with this error and
 *  not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
 *  will exist.
720
 */
Camilla Berglund's avatar
Camilla Berglund committed
721
#define GLFW_VERSION_UNAVAILABLE    0x00010007
722
723
/*! @brief A platform-specific error occurred that does not match any of the
 *  more specific categories.
Camilla Berglund's avatar
Camilla Berglund committed
724
725
726
727
 *
 *  A platform-specific error occurred that does not match any of the more
 *  specific categories.
 *
728
729
730
 *  @analysis A bug or configuration error in GLFW, the underlying operating
 *  system or its drivers, or a lack of required resources.  Report the issue to
 *  our [issue tracker](https://github.com/glfw/glfw/issues).
731
 */
Camilla Berglund's avatar
Camilla Berglund committed
732
#define GLFW_PLATFORM_ERROR         0x00010008
Camilla Berglund's avatar
Camilla Berglund committed
733
734
735
736
737
738
739
740
/*! @brief The requested format is not supported or available.
 *
 *  If emitted during window creation, the requested pixel format is not
 *  supported.
 *
 *  If emitted when querying the clipboard, the contents of the clipboard could
 *  not be converted to the requested format.
 *
741
 *  @analysis If emitted during window creation, one or more
Camilla Berglund's avatar
Camilla Berglund committed
742
743
744
745
746
747
748
749
 *  [hard constraints](@ref window_hints_hard) did not match any of the
 *  available pixel formats.  If your application is sufficiently flexible,
 *  downgrade your requirements and try again.  Otherwise, inform the user that
 *  their machine does not match your requirements.
 *
 *  @par
 *  If emitted when querying the clipboard, ignore the error or report it to
 *  the user, as appropriate.
750
 */
Camilla Berglund's avatar
Camilla Berglund committed
751
#define GLFW_FORMAT_UNAVAILABLE     0x00010009
752
753
754
755
756
/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
 *
 *  A window that does not have an OpenGL or OpenGL ES context was passed to
 *  a function that requires it to have one.
 *
757
 *  @analysis Application programmer error.  Fix the offending call.
758
759
 */
#define GLFW_NO_WINDOW_CONTEXT      0x0001000A
760
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
761

Camilla Löwy's avatar
Camilla Löwy committed
762
763
764
765
766
767
768
/*! @addtogroup window
 *  @{ */
/*! @brief Input focus window hint and attribute
 *
 *  Input focus [window hint](@ref GLFW_FOCUSED_hint) or
 *  [window attribute](@ref GLFW_FOCUSED_attrib).
 */
769
#define GLFW_FOCUSED                0x00020001
Camilla Löwy's avatar
Camilla Löwy committed
770
771
772
773
/*! @brief Window iconification window attribute
 *
 *  Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
 */
774
#define GLFW_ICONIFIED              0x00020002
Camilla Löwy's avatar
Camilla Löwy committed
775
776
/*! @brief Window resize-ability window hint and attribute
 *
Camilla Löwy's avatar
Camilla Löwy committed
777
 *  Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
Camilla Löwy's avatar
Camilla Löwy committed
778
779
 *  [window attribute](@ref GLFW_RESIZABLE_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
780
#define GLFW_RESIZABLE              0x00020003
Camilla Löwy's avatar
Camilla Löwy committed
781
782
/*! @brief Window visibility window hint and attribute
 *
Camilla Löwy's avatar
Camilla Löwy committed
783
 *  Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
Camilla Löwy's avatar
Camilla Löwy committed
784
785
 *  [window attribute](@ref GLFW_VISIBLE_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
786
#define GLFW_VISIBLE                0x00020004
Camilla Löwy's avatar
Camilla Löwy committed
787
788
/*! @brief Window decoration window hint and attribute
 *
Camilla Löwy's avatar
Camilla Löwy committed
789
 *  Window decoration [window hint](@ref GLFW_DECORATED_hint) and
Camilla Löwy's avatar
Camilla Löwy committed
790
791
 *  [window attribute](@ref GLFW_DECORATED_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
792
#define GLFW_DECORATED              0x00020005
Camilla Löwy's avatar
Camilla Löwy committed
793
/*! @brief Window auto-iconification window hint and attribute
Camilla Löwy's avatar
Camilla Löwy committed
794
 *
Camilla Löwy's avatar
Camilla Löwy committed
795
 *  Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
Camilla Löwy's avatar
Camilla Löwy committed
796
 *  [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
797
 */
Camilla Berglund's avatar
Camilla Berglund committed
798
#define GLFW_AUTO_ICONIFY           0x00020006
Camilla Löwy's avatar
Camilla Löwy committed
799
800
/*! @brief Window decoration window hint and attribute
 *
Camilla Löwy's avatar
Camilla Löwy committed
801
 *  Window decoration [window hint](@ref GLFW_FLOATING_hint) and
Camilla Löwy's avatar
Camilla Löwy committed
802
803
 *  [window attribute](@ref GLFW_FLOATING_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
804
#define GLFW_FLOATING               0x00020007
Camilla Löwy's avatar
Camilla Löwy committed
805
806
/*! @brief Window maximization window hint and attribute
 *
Camilla Löwy's avatar
Camilla Löwy committed
807
 *  Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
Camilla Löwy's avatar
Camilla Löwy committed
808
809
 *  [window attribute](@ref GLFW_MAXIMIZED_attrib).
 */
810
#define GLFW_MAXIMIZED              0x00020008
Camilla Löwy's avatar
Cleanup    
Camilla Löwy committed
811
812
813
814
/*! @brief Cursor centering window hint
 *
 *  Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
 */
Liam Middlebrook's avatar
Liam Middlebrook committed
815
#define GLFW_CENTER_CURSOR          0x00020009
816
817
/*! @brief Window framebuffer transparency hint and attribute
 *
818
819
820
 *  Window framebuffer transparency
 *  [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and
 *  [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib).
821
 */
822
#define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A
Camilla Löwy's avatar
Camilla Löwy committed
823
824
825
826
/*! @brief Mouse cursor hover window attribute.
 *
 *  Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib).
 */
827
#define GLFW_HOVERED                0x0002000B
828
829
830
831
832
833
/*! @brief Input focus on calling show window hint and attribute
 *
 *  Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or
 *  [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib).
 */
#define GLFW_FOCUS_ON_SHOW          0x0002000C
Camilla Berglund's avatar
Camilla Berglund committed
834

Camilla Löwy's avatar
Camilla Löwy committed
835
836
837
838
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
839
#define GLFW_RED_BITS               0x00021001
Camilla Löwy's avatar
Camilla Löwy committed
840
841
842
843
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
844
#define GLFW_GREEN_BITS             0x00021002
Camilla Löwy's avatar
Camilla Löwy committed
845
846
847
848
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
849
#define GLFW_BLUE_BITS              0x00021003
Camilla Löwy's avatar
Camilla Löwy committed
850
851
852
853
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
854
#define GLFW_ALPHA_BITS             0x00021004
Camilla Löwy's avatar
Camilla Löwy committed
855
856
857
858
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
859
#define GLFW_DEPTH_BITS             0x00021005
Camilla Löwy's avatar
Camilla Löwy committed
860
861
862
863
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
864
#define GLFW_STENCIL_BITS           0x00021006
Camilla Löwy's avatar
Camilla Löwy committed
865
866
867
868
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
869
#define GLFW_ACCUM_RED_BITS         0x00021007
Camilla Löwy's avatar
Camilla Löwy committed
870
871
872
873
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
874
#define GLFW_ACCUM_GREEN_BITS       0x00021008
Camilla Löwy's avatar
Camilla Löwy committed
875
876
877
878
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
879
#define GLFW_ACCUM_BLUE_BITS        0x00021009
Camilla Löwy's avatar
Camilla Löwy committed
880
881
882
883
/*! @brief Framebuffer bit depth hint.
 *
 *  Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
884
#define GLFW_ACCUM_ALPHA_BITS       0x0002100A
Camilla Löwy's avatar
Camilla Löwy committed
885
886
887
888
/*! @brief Framebuffer auxiliary buffer hint.
 *
 *  Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
 */
Camilla Berglund's avatar
Camilla Berglund committed
889
#define GLFW_AUX_BUFFERS            0x0002100B
Camilla Löwy's avatar
Camilla Löwy committed
890
891
892
893
/*! @brief OpenGL stereoscopic rendering hint.
 *
 *  OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
 */
Camilla Berglund's avatar
Camilla Berglund committed
894
#define GLFW_STEREO                 0x0002100C
Camilla Löwy's avatar
Camilla Löwy committed
895
896
897
898
/*! @brief Framebuffer MSAA samples hint.
 *
 *  Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
 */
Camilla Berglund's avatar
Camilla Berglund committed
899
#define GLFW_SAMPLES                0x0002100D
Camilla Löwy's avatar
Camilla Löwy committed
900
901
902
903
/*! @brief Framebuffer sRGB hint.
 *
 *  Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
 */
Camilla Berglund's avatar
Camilla Berglund committed
904
#define GLFW_SRGB_CAPABLE           0x0002100E
Camilla Löwy's avatar
Camilla Löwy committed
905
906
907
908
/*! @brief Monitor refresh rate hint.
 *
 *  Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
 */
909
#define GLFW_REFRESH_RATE           0x0002100F
Camilla Löwy's avatar
Camilla Löwy committed
910
911
912
913
/*! @brief Framebuffer double buffering hint.
 *
 *  Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
 */
Camilla Berglund's avatar
Camilla Berglund committed
914
#define GLFW_DOUBLEBUFFER           0x00021010
Bailey Cosier's avatar
Cleanup    
Bailey Cosier committed
915

Camilla Löwy's avatar
Camilla Löwy committed
916
917
918
919
920
/*! @brief Context client API hint and attribute.
 *
 *  Context client API [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
921
#define GLFW_CLIENT_API             0x00022001
Camilla Löwy's avatar
Camilla Löwy committed
922
923
/*! @brief Context client API major version hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
924
925
 *  Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint)
 *  and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
926
 */
Camilla Berglund's avatar
Camilla Berglund committed
927
#define GLFW_CONTEXT_VERSION_MAJOR  0x00022002
Camilla Löwy's avatar
Camilla Löwy committed
928
929
/*! @brief Context client API minor version hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
930
931
 *  Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint)
 *  and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
932
 */
Camilla Berglund's avatar
Camilla Berglund committed
933
#define GLFW_CONTEXT_VERSION_MINOR  0x00022003
Camilla Löwy's avatar
Camilla Löwy committed
934
935
/*! @brief Context client API revision number hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
936
937
 *  Context client API revision number
 *  [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
938
 */
Camilla Berglund's avatar
Camilla Berglund committed
939
#define GLFW_CONTEXT_REVISION       0x00022004
Camilla Löwy's avatar
Camilla Löwy committed
940
941
/*! @brief Context robustness hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
942
943
 *  Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint)
 *  and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
944
 */
Camilla Berglund's avatar
Camilla Berglund committed
945
#define GLFW_CONTEXT_ROBUSTNESS     0x00022005
Camilla Löwy's avatar
Camilla Löwy committed
946
947
/*! @brief OpenGL forward-compatibility hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
948
949
 *  OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint)
 *  and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
950
 */
Camilla Berglund's avatar
Camilla Berglund committed
951
#define GLFW_OPENGL_FORWARD_COMPAT  0x00022006
Camilla Löwy's avatar
Camilla Löwy committed
952
953
/*! @brief OpenGL debug context hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
954
955
 *  OpenGL debug context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and
 *  [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
956
 */
Camilla Berglund's avatar
Camilla Berglund committed
957
#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007
Camilla Löwy's avatar
Camilla Löwy committed
958
959
/*! @brief OpenGL profile hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
960
961
 *  OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and
 *  [attribute](@ref GLFW_OPENGL_PROFILE_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
962
 */
Camilla Berglund's avatar
Camilla Berglund committed
963
#define GLFW_OPENGL_PROFILE         0x00022008
Camilla Löwy's avatar
Camilla Löwy committed
964
965
/*! @brief Context flush-on-release hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
966
967
 *  Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and
 *  [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
968
 */
969
#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Löwy's avatar
Camilla Löwy committed
970
971
/*! @brief Context error suppression hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
972
973
 *  Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and
 *  [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
974
 */
975
#define GLFW_CONTEXT_NO_ERROR       0x0002200A
Camilla Löwy's avatar
Camilla Löwy committed
976
977
/*! @brief Context creation API hint and attribute.
 *
Camilla Löwy's avatar
Camilla Löwy committed
978
979
 *  Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and
 *  [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib).
Camilla Löwy's avatar
Camilla Löwy committed
980
 */
981
#define GLFW_CONTEXT_CREATION_API   0x0002200B
Camilla Löwy's avatar
Camilla Löwy committed
982
983
984
985
/*! @brief Window content area scaling window
 *  [window hint](@ref GLFW_SCALE_TO_MONITOR).
 */
#define GLFW_SCALE_TO_MONITOR       0x0002200C
Camilla Löwy's avatar
Camilla Löwy committed
986
987
988
/*! @brief macOS specific
 *  [window hint](@ref GLFW_COCOA_RETINA_FRAMEBUFFER_hint).
 */
989
#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
Camilla Löwy's avatar
Camilla Löwy committed
990
991
992
/*! @brief macOS specific
 *  [window hint](@ref GLFW_COCOA_FRAME_NAME_hint).
 */
993
#define GLFW_COCOA_FRAME_NAME         0x00023002
Camilla Löwy's avatar
Camilla Löwy committed
994
995
996
/*! @brief macOS specific
 *  [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint).
 */
997
#define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
Camilla Löwy's avatar
Camilla Löwy committed
998
999
1000
/*! @brief X11 specific
 *  [window hint](@ref GLFW_X11_CLASS_NAME_hint).
 */
1001
#define GLFW_X11_CLASS_NAME         0x00024001
Camilla Löwy's avatar
Camilla Löwy committed
1002
1003
1004
/*! @brief X11 specific
 *  [window hint](@ref GLFW_X11_CLASS_NAME_hint).
 */
1005
#define GLFW_X11_INSTANCE_NAME      0x00024002
Camilla Löwy's avatar
Camilla Löwy committed
1006
/*! @} */
1007

1008
#define GLFW_NO_API                          0
Camilla Berglund's avatar
Camilla Berglund committed
1009
1010
#define GLFW_OPENGL_API             0x00030001
#define GLFW_OPENGL_ES_API          0x00030002
1011

Camilla Berglund's avatar
Camilla Berglund committed
1012
1013
1014
#define GLFW_NO_ROBUSTNESS                   0
#define GLFW_NO_RESET_NOTIFICATION  0x00031001
#define GLFW_LOSE_CONTEXT_ON_RESET  0x00031002
1015

1016
#define GLFW_OPENGL_ANY_PROFILE              0
Camilla Berglund's avatar
Camilla Berglund committed
1017
1018
#define GLFW_OPENGL_CORE_PROFILE    0x00032001
#define GLFW_OPENGL_COMPAT_PROFILE  0x00032002
1019

Camilla Berglund's avatar
Camilla Berglund committed
1020
1021
1022
#define GLFW_CURSOR                 0x00033001
#define GLFW_STICKY_KEYS            0x00033002
#define GLFW_STICKY_MOUSE_BUTTONS   0x00033003
1023
#define GLFW_LOCK_KEY_MODS          0x00033004
1024
#define GLFW_RAW_MOUSE_MOTION       0x00033005
1025

Camilla Berglund's avatar
Camilla Berglund committed
1026
1027
1028
#define GLFW_CURSOR_NORMAL          0x00034001
#define GLFW_CURSOR_HIDDEN          0x00034002
#define GLFW_CURSOR_DISABLED        0x00034003
1029

1030
1031
1032
1033
#define GLFW_ANY_RELEASE_BEHAVIOR            0
#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
#define GLFW_RELEASE_BEHAVIOR_NONE  0x00035002

1034
1035
#define GLFW_NATIVE_CONTEXT_API     0x00036001
#define GLFW_EGL_CONTEXT_API        0x00036002
Camilla Löwy's avatar
Camilla Löwy committed
1036
#define GLFW_OSMESA_CONTEXT_API     0x00036003
1037

1038
/*! @defgroup shapes Standard cursor shapes
Camilla Löwy's avatar
Camilla Löwy committed
1039
 *  @brief Standard system cursor shapes.
Camilla Berglund's avatar
Camilla Berglund committed
1040
1041
1042
 *
 *  See [standard cursor creation](@ref cursor_standard) for how these are used.
 *
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
 *  @ingroup input
 *  @{ */

/*! @brief The regular arrow cursor shape.
 *
 *  The regular arrow cursor.
 */
#define GLFW_ARROW_CURSOR           0x00036001
/*! @brief The text input I-beam cursor shape.
 *
 *  The text input I-beam cursor shape.
 */
#define GLFW_IBEAM_CURSOR           0x00036002
/*! @brief The crosshair shape.
 *
 *  The crosshair shape.
 */
#define GLFW_CROSSHAIR_CURSOR       0x00036003
/*! @brief The hand shape.
 *
 *  The hand shape.
 */
#define GLFW_HAND_CURSOR            0x00036004
/*! @brief The horizontal resize arrow shape.
 *
 *  The horizontal resize arrow shape.
 */
#define GLFW_HRESIZE_CURSOR         0x00036005
/*! @brief The vertical resize arrow shape.
 *
 *  The vertical resize arrow shape.
 */
#define GLFW_VRESIZE_CURSOR         0x00036006
/*! @} */

Camilla Berglund's avatar
Camilla Berglund committed
1078
1079
#define GLFW_CONNECTED              0x00040001
#define GLFW_DISCONNECTED           0x00040002
1080

Camilla Löwy's avatar
Camilla Löwy committed
1081
1082
/*! @addtogroup init
 *  @{ */
Camilla Löwy's avatar
Camilla Löwy committed
1083
1084
/*! @brief Joystick hat buttons init hint.
 *
Camilla Löwy's avatar
Camilla Löwy committed
1085
 *  Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS).
Camilla Löwy's avatar
Camilla Löwy committed
1086
 */
Camilla Löwy's avatar
Camilla Löwy committed
1087
#define GLFW_JOYSTICK_HAT_BUTTONS   0x00050001
Camilla Löwy's avatar
Camilla Löwy committed
1088
1089
/*! @brief macOS specific init hint.
 *
Camilla Löwy's avatar
Camilla Löwy committed
1090
 *  macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
Camilla Löwy's avatar
Camilla Löwy committed
1091
 */
Camilla Löwy's avatar
Camilla Löwy committed
1092
#define GLFW_COCOA_CHDIR_RESOURCES  0x00051001
Camilla Löwy's avatar
Camilla Löwy committed
1093
1094
/*! @brief macOS specific init hint.
 *
Camilla Löwy's avatar
Camilla Löwy committed
1095
 *  macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
Camilla Löwy's avatar
Camilla Löwy committed
1096
 */
Camilla Löwy's avatar
Camilla Löwy committed
1097
1098
1099
#define GLFW_COCOA_MENUBAR          0x00051002
/*! @} */

Camilla Berglund's avatar
Camilla Berglund committed
1100
1101
#define GLFW_DONT_CARE              -1

1102

Camilla Berglund's avatar
Camilla Berglund committed
1103
/*************************************************************************
1104
 * GLFW API types
Camilla Berglund's avatar
Camilla Berglund committed
1105
1106
 *************************************************************************/

1107
/*! @brief Client API function pointer type.
Camilla Berglund's avatar
Camilla Berglund committed
1108
1109
1110
1111
 *
 *  Generic function pointer used for returning client API function pointers
 *  without forcing a cast from a regular pointer.
 *
1112
 *  @sa @ref context_glext
1113
 *  @sa @ref glfwGetProcAddress
1114
 *
Camilla Berglund's avatar
Camilla Berglund committed
1115
 *  @since Added in version 3.0.
1116
 *
1117
 *  @ingroup context
1118
 */
1119
1120
typedef void (*GLFWglproc)(void);

Camilla Berglund's avatar
Camilla Berglund committed
1121
1122
1123
1124
1125
1126
/*! @brief Vulkan API function pointer type.
 *
 *  Generic function pointer used for returning Vulkan API function pointers
 *  without forcing a cast from a regular pointer.
 *
 *  @sa @ref vulkan_proc
1127
 *  @sa @ref glfwGetInstanceProcAddress
Camilla Berglund's avatar
Camilla Berglund committed
1128
1129
1130
1131
1132
1133
1134
 *
 *  @since Added in version 3.2.
 *
 *  @ingroup vulkan
 */
typedef void (*GLFWvkproc)(void);

Camilla Berglund's avatar
Camilla Berglund committed
1135
/*! @brief Opaque monitor object.
Camilla Berglund's avatar
Camilla Berglund committed
1136
1137
1138
 *
 *  Opaque monitor object.
 *
1139
1140
 *  @see @ref monitor_object
 *
Camilla Berglund's avatar
Camilla Berglund committed
1141
 *  @since Added in version 3.0.
Camilla Berglund's avatar
Camilla Berglund committed
1142
 *
1143
1144
 *  @ingroup monitor
 */
1145
typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglund's avatar
Camilla Berglund committed
1146

Camilla Berglund's avatar
Camilla Berglund committed
1147
/*! @brief Opaque window object.
Camilla Berglund's avatar
Camilla Berglund committed
1148
1149
1150
 *
 *  Opaque window object.
 *
1151
1152
 *  @see @ref window_object
 *
Camilla Berglund's avatar
Camilla Berglund committed
1153
 *  @since Added in version 3.0.
Camilla Berglund's avatar
Camilla Berglund committed
1154
 *
1155
1156
 *  @ingroup window
 */
1157
typedef struct GLFWwindow GLFWwindow;
1158

1159
1160
1161
1162
/*! @brief Opaque cursor object.
 *
 *  Opaque cursor object.
 *
1163
1164
 *  @see @ref cursor_object
 *
Camilla Berglund's avatar
Camilla Berglund committed
1165
 *  @since Added in version 3.1.
Camilla Berglund's avatar
Camilla Berglund committed
1166
 *
Camilla Löwy's avatar
Camilla Löwy committed
1167
 *  @ingroup input
1168
1169
1170
 */
typedef struct GLFWcursor GLFWcursor;

1171
/*! @brief The function pointer type for error callbacks.
Camilla Berglund's avatar
Camilla Berglund committed
1172
 *
1173
1174
1175
1176
1177
 *  This is the function pointer type for error callbacks.  An error callback
 *  function has the following signature:
 *  @code
 *  void callback_name(int error_code, const char* description)
 *  @endcode
Camilla Berglund's avatar
Camilla Berglund committed
1178
 *
1179