glfw3.h 196 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-2016 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
/* 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
101
102
103
104
105
106
107
 */
#ifndef APIENTRY
 #ifdef _WIN32
  #define APIENTRY __stdcall
 #else
  #define APIENTRY
 #endif
108
 #define GLFW_APIENTRY_DEFINED
Camilla Berglund's avatar
Camilla Berglund committed
109
110
#endif /* APIENTRY */

111
/* Some Windows OpenGL headers need this.
Camilla Berglund's avatar
Camilla Berglund committed
112
113
 */
#if !defined(WINGDIAPI) && defined(_WIN32)
114
 #define WINGDIAPI __declspec(dllimport)
115
 #define GLFW_WINGDIAPI_DEFINED
Camilla Berglund's avatar
Camilla Berglund committed
116
117
#endif /* WINGDIAPI */

118
119
/* Some Windows GLU headers need this.
 */
Camilla Berglund's avatar
Camilla Berglund committed
120
#if !defined(CALLBACK) && defined(_WIN32)
121
 #define CALLBACK __stdcall
122
 #define GLFW_CALLBACK_DEFINED
Camilla Berglund's avatar
Camilla Berglund committed
123
124
#endif /* CALLBACK */

Camilla Berglund's avatar
Camilla Berglund committed
125
/* Include because most Windows GLU headers need wchar_t and
126
 * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
127
 * Include it unconditionally to avoid surprising side-effects.
128
 */
129
#include <stddef.h>
Camilla Berglund's avatar
Camilla Berglund committed
130
131

/* Include because it is needed by Vulkan and related functions.
132
 * Include it unconditionally to avoid surprising side-effects.
Camilla Berglund's avatar
Camilla Berglund committed
133
 */
134
#include <stdint.h>
Camilla Berglund's avatar
Camilla Berglund committed
135

136
/* Include the chosen OpenGL or OpenGL ES headers.
137
 */
138
#if defined(GLFW_INCLUDE_ES1)
139

140
141
142
143
 #include <GLES/gl.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES/glext.h>
 #endif
144

145
#elif defined(GLFW_INCLUDE_ES2)
146

147
148
149
150
 #include <GLES2/gl2.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES2/gl2ext.h>
 #endif
151

152
#elif defined(GLFW_INCLUDE_ES3)
153

154
155
156
157
 #include <GLES3/gl3.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES2/gl2ext.h>
 #endif
158

159
#elif defined(GLFW_INCLUDE_ES31)
160

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

166
#elif defined(GLFW_INCLUDE_ES32)
167

168
169
170
171
 #include <GLES3/gl32.h>
 #if defined(GLFW_INCLUDE_GLEXT)
  #include <GLES2/gl2ext.h>
 #endif
172
173
174
175
176

#elif defined(GLFW_INCLUDE_GLCOREARB)

 #if defined(__APPLE__)

Camilla Berglund's avatar
Camilla Berglund committed
177
178
179
  #include <OpenGL/gl3.h>
  #if defined(GLFW_INCLUDE_GLEXT)
   #include <OpenGL/gl3ext.h>
180
181
182
183
184
185
186
187
188
189
190
191
  #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
192
193
  #if !defined(GLFW_INCLUDE_GLEXT)
   #define GL_GLEXT_LEGACY
194
  #endif
Camilla Berglund's avatar
Camilla Berglund committed
195
  #include <OpenGL/gl.h>
196
197
198
199
200
201
  #if defined(GLFW_INCLUDE_GLU)
   #include <OpenGL/glu.h>
  #endif

 #else /*__APPLE__*/

Camilla Berglund's avatar
Camilla Berglund committed
202
203
204
205
  #include <GL/gl.h>
  #if defined(GLFW_INCLUDE_GLEXT)
   #include <GL/glext.h>
  #endif
206
207
208
209
210
211
212
213
  #if defined(GLFW_INCLUDE_GLU)
   #include <GL/glu.h>
  #endif

 #endif /*__APPLE__*/

#endif /* OpenGL and OpenGL ES headers */

214
#if defined(GLFW_INCLUDE_VULKAN)
215
  #include <vulkan/vulkan.h>
216
#endif /* Vulkan header */
Camilla Berglund's avatar
Camilla Berglund committed
217

218
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
Camilla Berglund's avatar
Camilla Berglund committed
219
220
221
 /* 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.
222
  */
223
 #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
224
225
#endif

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


/*************************************************************************
245
 * GLFW API tokens
Camilla Berglund's avatar
Camilla Berglund committed
246
247
 *************************************************************************/

248
249
250
251
252
253
254
/*! @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
 */
255
#define GLFW_VERSION_MAJOR          3
256
257
258
259
260
261
/*! @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
262
#define GLFW_VERSION_MINOR          3
263
264
265
266
267
268
/*! @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 Berglund's avatar
Camilla Berglund committed
269
#define GLFW_VERSION_REVISION       0
270
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
271

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

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

Camilla Löwy's avatar
Camilla Löwy committed
314
/*! @defgroup hat_state Joystick hat states
Camilla Löwy's avatar
Camilla Löwy committed
315
 *  @brief Joystick hat states.
IntellectualKitty's avatar
IntellectualKitty committed
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
 *
 *  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
332
/*! @defgroup keys Keyboard keys
Camilla Löwy's avatar
Camilla Löwy committed
333
 *  @brief Keyboard key IDs.
Camilla Berglund's avatar
Camilla Berglund committed
334
 *
Camilla Berglund's avatar
Camilla Berglund committed
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
 *  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
351
 *
352
353
354
355
 *  @ingroup input
 *  @{
 */

356
357
358
/* The unknown key */
#define GLFW_KEY_UNKNOWN            -1

359
/* Printable keys */
360
361
362
363
364
365
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
#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 */
410
411

/* Function keys */
412
413
414
415
416
417
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
#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
482

483
#define GLFW_KEY_LAST               GLFW_KEY_MENU
484

485
486
/*! @} */

487
/*! @defgroup mods Modifier key flags
Camilla Löwy's avatar
Camilla Löwy committed
488
 *  @brief Modifier key flags.
Camilla Berglund's avatar
Camilla Berglund committed
489
490
491
 *
 *  See [key input](@ref input_key) for how these are used.
 *
492
 *  @ingroup input
493
494
 *  @{ */

495
/*! @brief If this bit is set one or more Shift keys were held down.
496
497
 *
 *  If this bit is set one or more Shift keys were held down.
498
499
 */
#define GLFW_MOD_SHIFT           0x0001
500
/*! @brief If this bit is set one or more Control keys were held down.
501
502
 *
 *  If this bit is set one or more Control keys were held down.
503
 */
504
#define GLFW_MOD_CONTROL         0x0002
505
/*! @brief If this bit is set one or more Alt keys were held down.
506
507
 *
 *  If this bit is set one or more Alt keys were held down.
508
509
 */
#define GLFW_MOD_ALT             0x0004
510
/*! @brief If this bit is set one or more Super keys were held down.
511
512
 *
 *  If this bit is set one or more Super keys were held down.
Noel Cower's avatar
Noel Cower committed
513
514
 */
#define GLFW_MOD_SUPER           0x0008
515
516
517
518
519
520
521
522
523
524
525
526
/*! @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
527
528
529

/*! @} */

530
/*! @defgroup buttons Mouse buttons
Camilla Löwy's avatar
Camilla Löwy committed
531
 *  @brief Mouse button IDs.
Camilla Berglund's avatar
Camilla Berglund committed
532
533
534
 *
 *  See [mouse button input](@ref input_mouse_button) for how these are used.
 *
535
536
 *  @ingroup input
 *  @{ */
537
538
539
540
541
542
543
544
545
546
547
548
#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
549
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
550

551
/*! @defgroup joysticks Joysticks
Camilla Löwy's avatar
Camilla Löwy committed
552
 *  @brief Joystick IDs.
Camilla Berglund's avatar
Camilla Berglund committed
553
554
555
 *
 *  See [joystick input](@ref joystick) for how these are used.
 *
556
557
 *  @ingroup input
 *  @{ */
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
#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
575
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
576

577
578
579
580
581
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
/*! @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
/*! @} */

623
/*! @defgroup errors Error codes
Camilla Löwy's avatar
Camilla Löwy committed
624
 *  @brief Error codes.
Camilla Berglund's avatar
Camilla Berglund committed
625
626
627
 *
 *  See [error handling](@ref error_handling) for how these are used.
 *
Camilla Berglund's avatar
Camilla Berglund committed
628
 *  @ingroup init
629
 *  @{ */
Camilla Löwy's avatar
Camilla Löwy committed
630
631
632
633
634
635
636
/*! @brief No error has occurred.
 *
 *  No error has occurred.
 *
 *  @analysis Yay.
 */
#define GLFW_NO_ERROR               0
637
/*! @brief GLFW has not been initialized.
Camilla Berglund's avatar
Camilla Berglund committed
638
 *
639
 *  This occurs if a GLFW function was called that must not be called unless the
Camilla Berglund's avatar
Camilla Berglund committed
640
641
 *  library is [initialized](@ref intro_init).
 *
642
643
 *  @analysis Application programmer error.  Initialize GLFW before calling any
 *  function that requires initialization.
644
 */
Camilla Berglund's avatar
Camilla Berglund committed
645
#define GLFW_NOT_INITIALIZED        0x00010001
646
/*! @brief No context is current for this thread.
Camilla Berglund's avatar
Camilla Berglund committed
647
648
649
650
651
 *
 *  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.
 *
652
653
 *  @analysis Application programmer error.  Ensure a context is current before
 *  calling functions that require a current context.
654
 */
Camilla Berglund's avatar
Camilla Berglund committed
655
#define GLFW_NO_CURRENT_CONTEXT     0x00010002
Camilla Berglund's avatar
Camilla Berglund committed
656
657
658
/*! @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
659
 *  requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
Camilla Berglund's avatar
Camilla Berglund committed
660
 *
661
 *  @analysis Application programmer error.  Fix the offending call.
662
 */
Camilla Berglund's avatar
Camilla Berglund committed
663
#define GLFW_INVALID_ENUM           0x00010003
Camilla Berglund's avatar
Camilla Berglund committed
664
665
666
667
668
669
670
671
/*! @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.
 *
672
 *  @analysis Application programmer error.  Fix the offending call.
673
 */
Camilla Berglund's avatar
Camilla Berglund committed
674
#define GLFW_INVALID_VALUE          0x00010004
675
/*! @brief A memory allocation failed.
Camilla Berglund's avatar
Camilla Berglund committed
676
677
678
 *
 *  A memory allocation failed.
 *
679
680
 *  @analysis A bug in GLFW or the underlying operating system.  Report the bug
 *  to our [issue tracker](https://github.com/glfw/glfw/issues).
681
 */
Camilla Berglund's avatar
Camilla Berglund committed
682
#define GLFW_OUT_OF_MEMORY          0x00010005
Camilla Berglund's avatar
Camilla Berglund committed
683
/*! @brief GLFW could not find support for the requested API on the system.
Camilla Berglund's avatar
Camilla Berglund committed
684
 *
Camilla Berglund's avatar
Camilla Berglund committed
685
 *  GLFW could not find support for the requested API on the system.
Camilla Berglund's avatar
Camilla Berglund committed
686
 *
687
 *  @analysis The installed graphics driver does not support the requested
Camilla Berglund's avatar
Camilla Berglund committed
688
 *  API, or does not support it via the chosen context creation backend.
689
 *  Below are a few examples.
Camilla Berglund's avatar
Camilla Berglund committed
690
691
692
 *
 *  @par
 *  Some pre-installed Windows graphics drivers do not support OpenGL.  AMD only
Camilla Berglund's avatar
Camilla Berglund committed
693
 *  supports OpenGL ES via EGL, while Nvidia and Intel only support it via
694
 *  a WGL or GLX extension.  macOS does not provide OpenGL ES at all.  The Mesa
Camilla Berglund's avatar
Camilla Berglund committed
695
 *  EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
Camilla Berglund's avatar
Camilla Berglund committed
696
 *  driver.  Older graphics drivers do not support Vulkan.
697
 */
Camilla Berglund's avatar
Camilla Berglund committed
698
#define GLFW_API_UNAVAILABLE        0x00010006
Camilla Berglund's avatar
Camilla Berglund committed
699
700
/*! @brief The requested OpenGL or OpenGL ES version is not available.
 *
Camilla Berglund's avatar
Camilla Berglund committed
701
702
 *  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
703
 *
704
705
706
 *  @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
707
708
 *  requirements.
 *
Camilla Berglund's avatar
Camilla Berglund committed
709
710
711
712
713
 *  @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.
714
 */
Camilla Berglund's avatar
Camilla Berglund committed
715
#define GLFW_VERSION_UNAVAILABLE    0x00010007
716
717
/*! @brief A platform-specific error occurred that does not match any of the
 *  more specific categories.
Camilla Berglund's avatar
Camilla Berglund committed
718
719
720
721
 *
 *  A platform-specific error occurred that does not match any of the more
 *  specific categories.
 *
722
723
724
 *  @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).
725
 */
Camilla Berglund's avatar
Camilla Berglund committed
726
#define GLFW_PLATFORM_ERROR         0x00010008
Camilla Berglund's avatar
Camilla Berglund committed
727
728
729
730
731
732
733
734
/*! @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.
 *
735
 *  @analysis If emitted during window creation, one or more
Camilla Berglund's avatar
Camilla Berglund committed
736
737
738
739
740
741
742
743
 *  [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.
744
 */
Camilla Berglund's avatar
Camilla Berglund committed
745
#define GLFW_FORMAT_UNAVAILABLE     0x00010009
746
747
748
749
750
/*! @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.
 *
751
 *  @analysis Application programmer error.  Fix the offending call.
752
753
 */
#define GLFW_NO_WINDOW_CONTEXT      0x0001000A
754
/*! @} */
Camilla Berglund's avatar
Camilla Berglund committed
755

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

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

Camilla Löwy's avatar
Camilla Löwy committed
910
911
912
913
914
/*! @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
915
#define GLFW_CLIENT_API             0x00022001
Camilla Löwy's avatar
Camilla Löwy committed
916
917
918
919
920
/*! @brief Context client API major version hint and attribute.
 *
 *  Context client API major version [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
921
#define GLFW_CONTEXT_VERSION_MAJOR  0x00022002
Camilla Löwy's avatar
Camilla Löwy committed
922
923
924
925
926
/*! @brief Context client API minor version hint and attribute.
 *
 *  Context client API minor version [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
927
#define GLFW_CONTEXT_VERSION_MINOR  0x00022003
Camilla Löwy's avatar
Camilla Löwy committed
928
929
930
931
932
/*! @brief Context client API revision number hint and attribute.
 *
 *  Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
933
#define GLFW_CONTEXT_REVISION       0x00022004
Camilla Löwy's avatar
Camilla Löwy committed
934
935
936
937
938
/*! @brief Context robustness hint and attribute.
 *
 *  Context client API revision number [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
939
#define GLFW_CONTEXT_ROBUSTNESS     0x00022005
Camilla Löwy's avatar
Camilla Löwy committed
940
941
942
943
944
/*! @brief OpenGL forward-compatibility hint and attribute.
 *
 *  OpenGL forward-compatibility [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
945
#define GLFW_OPENGL_FORWARD_COMPAT  0x00022006
Camilla Löwy's avatar
Camilla Löwy committed
946
947
948
949
950
/*! @brief OpenGL debug context hint and attribute.
 *
 *  OpenGL debug context [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
951
#define GLFW_OPENGL_DEBUG_CONTEXT   0x00022007
Camilla Löwy's avatar
Camilla Löwy committed
952
953
954
955
956
/*! @brief OpenGL profile hint and attribute.
 *
 *  OpenGL profile [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
Camilla Berglund's avatar
Camilla Berglund committed
957
#define GLFW_OPENGL_PROFILE         0x00022008
Camilla Löwy's avatar
Camilla Löwy committed
958
959
960
961
962
/*! @brief Context flush-on-release hint and attribute.
 *
 *  Context flush-on-release [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
963
#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
Camilla Löwy's avatar
Camilla Löwy committed
964
965
966
967
968
/*! @brief Context error suppression hint and attribute.
 *
 *  Context error suppression [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
969
#define GLFW_CONTEXT_NO_ERROR       0x0002200A
Camilla Löwy's avatar
Camilla Löwy committed
970
971
972
973
974
/*! @brief Context creation API hint and attribute.
 *
 *  Context creation API [hint](@ref GLFW_CLIENT_API_hint) and
 *  [attribute](@ref GLFW_CLIENT_API_attrib).
 */
975
#define GLFW_CONTEXT_CREATION_API   0x0002200B
Camilla Löwy's avatar
Camilla Löwy committed
976
977
978
979
/*! @brief Window content area scaling window
 *  [window hint](@ref GLFW_SCALE_TO_MONITOR).
 */
#define GLFW_SCALE_TO_MONITOR       0x0002200C
980

981
#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
982
#define GLFW_COCOA_FRAME_NAME         0x00023002
983
#define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
984
985
986

#define GLFW_X11_CLASS_NAME         0x00024001
#define GLFW_X11_INSTANCE_NAME      0x00024002
Camilla Löwy's avatar
Camilla Löwy committed
987
/*! @} */
988

989
#define GLFW_NO_API                          0
Camilla Berglund's avatar
Camilla Berglund committed
990
991
#define GLFW_OPENGL_API             0x00030001
#define GLFW_OPENGL_ES_API          0x00030002
992

Camilla Berglund's avatar
Camilla Berglund committed
993
994
995
#define GLFW_NO_ROBUSTNESS                   0
#define GLFW_NO_RESET_NOTIFICATION  0x00031001
#define GLFW_LOSE_CONTEXT_ON_RESET  0x00031002
996

997
#define GLFW_OPENGL_ANY_PROFILE              0
Camilla Berglund's avatar
Camilla Berglund committed
998
999
#define GLFW_OPENGL_CORE_PROFILE    0x00032001
#define GLFW_OPENGL_COMPAT_PROFILE  0x00032002
1000

Camilla Berglund's avatar
Camilla Berglund committed
1001
1002
1003
#define GLFW_CURSOR                 0x00033001
#define GLFW_STICKY_KEYS            0x00033002
#define GLFW_STICKY_MOUSE_BUTTONS   0x00033003
1004
#define GLFW_LOCK_KEY_MODS          0x00033004
1005

Camilla Berglund's avatar
Camilla Berglund committed
1006
1007
1008
#define GLFW_CURSOR_NORMAL          0x00034001
#define GLFW_CURSOR_HIDDEN          0x00034002
#define GLFW_CURSOR_DISABLED        0x00034003
1009

1010
1011
1012
1013
#define GLFW_ANY_RELEASE_BEHAVIOR            0
#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
#define GLFW_RELEASE_BEHAVIOR_NONE  0x00035002

1014
1015
#define GLFW_NATIVE_CONTEXT_API     0x00036001
#define GLFW_EGL_CONTEXT_API        0x00036002
Camilla Löwy's avatar
Camilla Löwy committed
1016
#define GLFW_OSMESA_CONTEXT_API     0x00036003
1017

1018
/*! @defgroup shapes Standard cursor shapes
Camilla Löwy's avatar
Camilla Löwy committed
1019
 *  @brief Standard system cursor shapes.
Camilla Berglund's avatar
Camilla Berglund committed
1020
1021
1022
 *
 *  See [standard cursor creation](@ref cursor_standard) for how these are used.
 *
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
 *  @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
1058
1059
#define GLFW_CONNECTED              0x00040001
#define GLFW_DISCONNECTED           0x00040002
1060

Camilla Löwy's avatar
Camilla Löwy committed
1061
1062
/*! @addtogroup init
 *  @{ */
Camilla Löwy's avatar
Camilla Löwy committed
1063
1064
1065
1066
/*! @brief Joystick hat buttons init hint.
 *
 *  Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS)
 */
Camilla Löwy's avatar
Camilla Löwy committed
1067
#define GLFW_JOYSTICK_HAT_BUTTONS   0x00050001
Camilla Löwy's avatar
Camilla Löwy committed
1068
1069
1070
1071
/*! @brief macOS specific init hint.
 *
 *  macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES)
 */
Camilla Löwy's avatar
Camilla Löwy committed
1072
#define GLFW_COCOA_CHDIR_RESOURCES  0x00051001
Camilla Löwy's avatar
Camilla Löwy committed
1073
1074
1075
1076
/*! @brief macOS specific init hint.
 *
 *  macOS specific [init hint](@ref GLFW_COCOA_MENUBAR)
 */
Camilla Löwy's avatar
Camilla Löwy committed
1077
1078
1079
#define GLFW_COCOA_MENUBAR          0x00051002
/*! @} */

Camilla Berglund's avatar
Camilla Berglund committed
1080
1081
#define GLFW_DONT_CARE              -1

1082

Camilla Berglund's avatar
Camilla Berglund committed
1083
/*************************************************************************
1084
 * GLFW API types
Camilla Berglund's avatar
Camilla Berglund committed
1085
1086
 *************************************************************************/

1087
/*! @brief Client API function pointer type.
Camilla Berglund's avatar
Camilla Berglund committed
1088
1089
1090
1091
 *
 *  Generic function pointer used for returning client API function pointers
 *  without forcing a cast from a regular pointer.
 *
1092
 *  @sa @ref context_glext
1093
 *  @sa @ref glfwGetProcAddress
1094
 *
Camilla Berglund's avatar
Camilla Berglund committed
1095
 *  @since Added in version 3.0.
1096
 *
1097
 *  @ingroup context
1098
 */
1099
1100
typedef void (*GLFWglproc)(void);

Camilla Berglund's avatar
Camilla Berglund committed
1101
1102
1103
1104
1105
1106
/*! @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
1107
 *  @sa @ref glfwGetInstanceProcAddress
Camilla Berglund's avatar
Camilla Berglund committed
1108
1109
1110
1111
1112
1113
1114
 *
 *  @since Added in version 3.2.
 *
 *  @ingroup vulkan
 */
typedef void (*GLFWvkproc)(void);

Camilla Berglund's avatar
Camilla Berglund committed
1115
/*! @brief Opaque monitor object.
Camilla Berglund's avatar
Camilla Berglund committed
1116
1117
1118
 *
 *  Opaque monitor object.
 *
1119
1120
 *  @see @ref monitor_object
 *
Camilla Berglund's avatar
Camilla Berglund committed
1121
 *  @since Added in version 3.0.
Camilla Berglund's avatar
Camilla Berglund committed
1122
 *
1123
1124
 *  @ingroup monitor
 */
1125
typedef struct GLFWmonitor GLFWmonitor;
Camilla Berglund's avatar
Camilla Berglund committed
1126

Camilla Berglund's avatar
Camilla Berglund committed
1127
/*! @brief Opaque window object.
Camilla Berglund's avatar
Camilla Berglund committed
1128
1129
1130
 *
 *  Opaque window object.
 *
1131
1132
 *  @see @ref window_object
 *
Camilla Berglund's avatar
Camilla Berglund committed
1133
 *  @since Added in version 3.0.
Camilla Berglund's avatar
Camilla Berglund committed
1134
 *
1135
1136
 *  @ingroup window
 */
1137
typedef struct GLFWwindow GLFWwindow;
1138

1139
1140
1141
1142
/*! @brief Opaque cursor object.
 *
 *  Opaque cursor object.
 *
1143
1144
 *  @see @ref cursor_object
 *
Camilla Berglund's avatar
Camilla Berglund committed
1145
 *  @since Added in version 3.1.
Camilla Berglund's avatar
Camilla Berglund committed
1146
 *
Camilla Löwy's avatar
Camilla Löwy committed
1147
 *  @ingroup input
1148
1149
1150
 */
typedef struct GLFWcursor GLFWcursor;

1151
/*! @brief The function signature for error callbacks.
Camilla Berglund's avatar
Camilla Berglund committed
1152
1153
1154
 *
 *  This is the function signature for error callback functions.
 *
1155
 *  @param[in] error An [error code](@ref errors).
1156
 *  @param[in] description A UTF-8 encoded string describing the error.
Camilla Berglund's avatar
Camilla Berglund committed
1157
 *
1158
 *  @sa @ref error_handling
1159
 *  @sa @ref glfwSetErrorCallback
Camilla Berglund's avatar
Camilla Berglund committed
1160
 *
Camilla Berglund's avatar
Camilla Berglund committed
1161
 *  @since Added in version 3.0.
Camilla Berglund's avatar
Camilla Berglund committed
1162
 *
Camilla Berglund's avatar
Camilla Berglund committed
1163
 *  @ingroup init
1164
 */
Camilla Berglund's avatar
Camilla Berglund committed
1165
typedef void (* GLFWerrorfun)(int,const char*);
1166

1167
/*! @brief The function signature for window position callbacks.
Camilla Berglund's avatar
Camilla Berglund committed
1168
1169
1170
 *
 *  This is the function signature for window position callback functions.
 *
Camilla Berglund's avatar
Camilla Berglund committed
1171
 *  @param[in] window The window that was moved.
Camilla Berglund's avatar
Camilla Berglund committed
1172
1173
1174
1175
 *  @param[in] xpos The new x-coordinate, in screen coordinates, of the
 *  upper-left corner of the client area of the window.
 *  @param[in] ypos The new y-coordinate, in screen coordinates, of the
 *  upper-left corner of the client area of the window.
Camilla Berglund's avatar
Camilla Berglund committed
1176
 *
1177
 *  @sa @ref window_pos
1178
 *  @sa @ref glfwSetWindowPosCallback
Camilla Berglund's avatar
Camilla Berglund committed
1179
 *
Camilla Berglund's avatar
Camilla Berglund committed
1180
 *  @since Added in version 3.0.
Camilla Berglund's avatar
Camilla Berglund committed
1181
 *
Camilla Berglund's avatar
Camilla Berglund committed
1182
 *  @ingroup window
1183
 */