-
Notifications
You must be signed in to change notification settings - Fork 0
/
glfw3.h
5912 lines (5665 loc) · 211 KB
/
glfw3.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
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
410
411
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
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
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
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*************************************************************************
* GLFW 3.3 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
*
* 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.
*
*************************************************************************/
#ifndef _glfw3_h_
#define _glfw3_h_
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************
* Doxygen documentation
*************************************************************************/
/*! @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.
*/
/*! @defgroup context Context reference
* @brief Functions and types related to OpenGL and OpenGL ES contexts.
*
* This is the reference documentation for OpenGL and OpenGL ES context related
* functions. For more task-oriented information, see the @ref context_guide.
*/
/*! @defgroup vulkan Vulkan support reference
* @brief Functions and types related to Vulkan.
*
* This is the reference documentation for Vulkan related functions and types.
* For more task-oriented information, see the @ref vulkan_guide.
*/
/*! @defgroup init Initialization, version and error reference
* @brief Functions and types related to initialization and error handling.
*
* This is the reference documentation for initialization and termination of
* the library, version management and error handling. For more task-oriented
* information, see the @ref intro_guide.
*/
/*! @defgroup input Input reference
* @brief Functions and types related to input handling.
*
* This is the reference documentation for input related functions and types.
* For more task-oriented information, see the @ref input_guide.
*/
/*! @defgroup monitor Monitor reference
* @brief Functions and types related to monitors.
*
* This is the reference documentation for monitor related functions and types.
* For more task-oriented information, see the @ref monitor_guide.
*/
/*! @defgroup window Window reference
* @brief Functions and types related to windows.
*
* This is the reference documentation for window related functions and types,
* including creation, deletion and event polling. For more task-oriented
* information, see the @ref window_guide.
*/
/*************************************************************************
* Compiler- and platform-specific preprocessor work
*************************************************************************/
/* If we are we on Windows, we want a single define for it.
*/
#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
#define _WIN32
#endif /* _WIN32 */
/* 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.
*/
/* It is customary to use APIENTRY for OpenGL function pointer declarations on
* all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
*/
#if !defined(APIENTRY)
#if defined(_WIN32)
#define APIENTRY __stdcall
#else
#define APIENTRY
#endif
#define GLFW_APIENTRY_DEFINED
#endif /* APIENTRY */
/* Some Windows OpenGL headers need this.
*/
#if !defined(WINGDIAPI) && defined(_WIN32)
#define WINGDIAPI __declspec(dllimport)
#define GLFW_WINGDIAPI_DEFINED
#endif /* WINGDIAPI */
/* Some Windows GLU headers need this.
*/
#if !defined(CALLBACK) && defined(_WIN32)
#define CALLBACK __stdcall
#define GLFW_CALLBACK_DEFINED
#endif /* CALLBACK */
/* Include the chosen OpenGL or OpenGL ES headers.
*/
#if defined(GLFW_INCLUDE_ES1)
#include <GLES/gl.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GLES/glext.h>
#endif
#elif defined(GLFW_INCLUDE_ES2)
#include <GLES2/gl2.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GLES2/gl2ext.h>
#endif
#elif defined(GLFW_INCLUDE_ES3)
#include <GLES3/gl3.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GLES2/gl2ext.h>
#endif
#elif defined(GLFW_INCLUDE_ES31)
#include <GLES3/gl31.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GLES2/gl2ext.h>
#endif
#elif defined(GLFW_INCLUDE_ES32)
#include <GLES3/gl32.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GLES2/gl2ext.h>
#endif
#elif defined(GLFW_INCLUDE_GLCOREARB)
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <OpenGL/gl3ext.h>
#endif /*GLFW_INCLUDE_GLEXT*/
#else /*__APPLE__*/
#include <GL/glcorearb.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GL/glext.h>
#endif
#endif /*__APPLE__*/
#elif defined(GLFW_INCLUDE_GLU)
#if defined(__APPLE__)
#if defined(GLFW_INCLUDE_GLU)
#include <OpenGL/glu.h>
#endif
#else /*__APPLE__*/
#if defined(GLFW_INCLUDE_GLU)
#include <GL/glu.h>
#endif
#endif /*__APPLE__*/
#elif !defined(GLFW_INCLUDE_NONE) && \
!defined(__gl_h_) && \
!defined(__gles1_gl_h_) && \
!defined(__gles2_gl2_h_) && \
!defined(__gles2_gl3_h_) && \
!defined(__gles2_gl31_h_) && \
!defined(__gles2_gl32_h_) && \
!defined(__gl_glcorearb_h_) && \
!defined(__gl2_h_) /*legacy*/ && \
!defined(__gl3_h_) /*legacy*/ && \
!defined(__gl31_h_) /*legacy*/ && \
!defined(__gl32_h_) /*legacy*/ && \
!defined(__glcorearb_h_) /*legacy*/ && \
!defined(__GL_H__) /*non-standard*/ && \
!defined(__gltypes_h_) /*non-standard*/ && \
!defined(__glee_h_) /*non-standard*/
#if defined(__APPLE__)
#if !defined(GLFW_INCLUDE_GLEXT)
#define GL_GLEXT_LEGACY
#endif
#include <OpenGL/gl.h>
#else /*__APPLE__*/
#include <GL/gl.h>
#if defined(GLFW_INCLUDE_GLEXT)
#include <GL/glext.h>
#endif
#endif /*__APPLE__*/
#endif /* OpenGL and OpenGL ES headers */
#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
/* 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.
*/
#error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
#endif
/* GLFWAPI is used to declare public API functions for export
* from the DLL / shared library / dynamic library.
*/
#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
/* We are building GLFW as a Win32 DLL */
#define GLFWAPI __declspec(dllexport)
#elif defined(_WIN32) && defined(GLFW_DLL)
/* We are calling a GLFW Win32 DLL */
#define GLFWAPI __declspec(dllimport)
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
/* We are building GLFW as a Unix shared library */
#define GLFWAPI __attribute__((visibility("default")))
#else
#define GLFWAPI
#endif
/*************************************************************************
* GLFW API tokens
*************************************************************************/
/*! @name GLFW version macros
* @{ */
/*! @brief The major version number of the GLFW header.
*
* The major version number of the GLFW header. This is incremented when the
* API is changed in non-compatible ways.
* @ingroup init
*/
#define GLFW_VERSION_MAJOR 3
/*! @brief The minor version number of the GLFW header.
*
* The minor version number of the GLFW header. This is incremented when
* features are added to the API but it remains backward-compatible.
* @ingroup init
*/
#define GLFW_VERSION_MINOR 3
/*! @brief The revision number of the GLFW header.
*
* The revision number of the GLFW header. This is incremented when a bug fix
* release is made that does not contain any API changes.
* @ingroup init
*/
#define GLFW_VERSION_REVISION 8
/*! @} */
/*! @brief One.
*
* This is only semantic sugar for the number 1. You can instead use `1` or
* `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal
* to one.
*
* @ingroup init
*/
#define GLFW_TRUE 1
/*! @brief Zero.
*
* This is only semantic sugar for the number 0. You can instead use `0` or
* `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is
* equal to zero.
*
* @ingroup init
*/
#define GLFW_FALSE 0
/*! @name Key and button actions
* @{ */
/*! @brief The key or mouse button was released.
*
* The key or mouse button was released.
*
* @ingroup input
*/
#define GLFW_RELEASE 0
/*! @brief The key or mouse button was pressed.
*
* The key or mouse button was pressed.
*
* @ingroup input
*/
#define GLFW_PRESS 1
/*! @brief The key was held down until it repeated.
*
* The key was held down until it repeated.
*
* @ingroup input
*/
#define GLFW_REPEAT 2
/*! @} */
/*! @defgroup hat_state Joystick hat states
* @brief Joystick hat states.
*
* 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)
/*! @} */
/*! @defgroup keys Keyboard keys
* @brief Keyboard key IDs.
*
* 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.)
*
* @ingroup input
* @{
*/
/* The unknown key */
#define GLFW_KEY_UNKNOWN -1
/* Printable keys */
#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 */
/* Function keys */
#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
#define GLFW_KEY_LAST GLFW_KEY_MENU
/*! @} */
/*! @defgroup mods Modifier key flags
* @brief Modifier key flags.
*
* See [key input](@ref input_key) for how these are used.
*
* @ingroup input
* @{ */
/*! @brief If this bit is set one or more Shift keys were held down.
*
* If this bit is set one or more Shift keys were held down.
*/
#define GLFW_MOD_SHIFT 0x0001
/*! @brief If this bit is set one or more Control keys were held down.
*
* If this bit is set one or more Control keys were held down.
*/
#define GLFW_MOD_CONTROL 0x0002
/*! @brief If this bit is set one or more Alt keys were held down.
*
* If this bit is set one or more Alt keys were held down.
*/
#define GLFW_MOD_ALT 0x0004
/*! @brief If this bit is set one or more Super keys were held down.
*
* If this bit is set one or more Super keys were held down.
*/
#define GLFW_MOD_SUPER 0x0008
/*! @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
/*! @} */
/*! @defgroup buttons Mouse buttons
* @brief Mouse button IDs.
*
* See [mouse button input](@ref input_mouse_button) for how these are used.
*
* @ingroup input
* @{ */
#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
/*! @} */
/*! @defgroup joysticks Joysticks
* @brief Joystick IDs.
*
* See [joystick input](@ref joystick) for how these are used.
*
* @ingroup input
* @{ */
#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
/*! @} */
/*! @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
/*! @} */
/*! @defgroup errors Error codes
* @brief Error codes.
*
* See [error handling](@ref error_handling) for how these are used.
*
* @ingroup init
* @{ */
/*! @brief No error has occurred.
*
* No error has occurred.
*
* @analysis Yay.
*/
#define GLFW_NO_ERROR 0
/*! @brief GLFW has not been initialized.
*
* This occurs if a GLFW function was called that must not be called unless the
* library is [initialized](@ref intro_init).
*
* @analysis Application programmer error. Initialize GLFW before calling any
* function that requires initialization.
*/
#define GLFW_NOT_INITIALIZED 0x00010001
/*! @brief No context is current for this thread.
*
* 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.
*
* @analysis Application programmer error. Ensure a context is current before
* calling functions that require a current context.
*/
#define GLFW_NO_CURRENT_CONTEXT 0x00010002
/*! @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
* requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
*
* @analysis Application programmer error. Fix the offending call.
*/
#define GLFW_INVALID_ENUM 0x00010003
/*! @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.
*
* @analysis Application programmer error. Fix the offending call.
*/
#define GLFW_INVALID_VALUE 0x00010004
/*! @brief A memory allocation failed.
*
* A memory allocation failed.
*
* @analysis A bug in GLFW or the underlying operating system. Report the bug
* to our [issue tracker](https://github.com/glfw/glfw/issues).
*/
#define GLFW_OUT_OF_MEMORY 0x00010005
/*! @brief GLFW could not find support for the requested API on the system.
*
* GLFW could not find support for the requested API on the system.
*
* @analysis The installed graphics driver does not support the requested
* API, or does not support it via the chosen context creation backend.
* Below are a few examples.
*
* @par
* Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
* supports OpenGL ES via EGL, while Nvidia and Intel only support it via
* a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa
* EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
* driver. Older graphics drivers do not support Vulkan.
*/
#define GLFW_API_UNAVAILABLE 0x00010006
/*! @brief The requested OpenGL or OpenGL ES version is not available.
*
* The requested OpenGL or OpenGL ES version (including any requested context
* or framebuffer hints) is not available on this machine.
*
* @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
* requirements.
*
* @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.
*/
#define GLFW_VERSION_UNAVAILABLE 0x00010007
/*! @brief A platform-specific error occurred that does not match any of the
* more specific categories.
*
* A platform-specific error occurred that does not match any of the more
* specific categories.
*
* @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).
*/
#define GLFW_PLATFORM_ERROR 0x00010008
/*! @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.
*
* @analysis If emitted during window creation, one or more
* [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.
*/
#define GLFW_FORMAT_UNAVAILABLE 0x00010009
/*! @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.
*
* @analysis Application programmer error. Fix the offending call.
*/
#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
/*! @} */
/*! @addtogroup window
* @{ */
/*! @brief Input focus window hint and attribute
*
* Input focus [window hint](@ref GLFW_FOCUSED_hint) or
* [window attribute](@ref GLFW_FOCUSED_attrib).
*/
#define GLFW_FOCUSED 0x00020001
/*! @brief Window iconification window attribute
*
* Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
*/
#define GLFW_ICONIFIED 0x00020002
/*! @brief Window resize-ability window hint and attribute
*
* Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
* [window attribute](@ref GLFW_RESIZABLE_attrib).
*/
#define GLFW_RESIZABLE 0x00020003
/*! @brief Window visibility window hint and attribute
*
* Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
* [window attribute](@ref GLFW_VISIBLE_attrib).
*/
#define GLFW_VISIBLE 0x00020004
/*! @brief Window decoration window hint and attribute
*
* Window decoration [window hint](@ref GLFW_DECORATED_hint) and
* [window attribute](@ref GLFW_DECORATED_attrib).
*/
#define GLFW_DECORATED 0x00020005
/*! @brief Window auto-iconification window hint and attribute
*
* Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
* [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
*/
#define GLFW_AUTO_ICONIFY 0x00020006
/*! @brief Window decoration window hint and attribute
*
* Window decoration [window hint](@ref GLFW_FLOATING_hint) and
* [window attribute](@ref GLFW_FLOATING_attrib).
*/
#define GLFW_FLOATING 0x00020007
/*! @brief Window maximization window hint and attribute
*
* Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
* [window attribute](@ref GLFW_MAXIMIZED_attrib).
*/
#define GLFW_MAXIMIZED 0x00020008
/*! @brief Cursor centering window hint
*
* Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
*/
#define GLFW_CENTER_CURSOR 0x00020009
/*! @brief Window framebuffer transparency hint and attribute
*
* Window framebuffer transparency
* [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and
* [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib).
*/
#define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A
/*! @brief Mouse cursor hover window attribute.
*
* Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib).
*/
#define GLFW_HOVERED 0x0002000B
/*! @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
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
*/
#define GLFW_RED_BITS 0x00021001
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
*/
#define GLFW_GREEN_BITS 0x00021002
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
*/
#define GLFW_BLUE_BITS 0x00021003
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
*/
#define GLFW_ALPHA_BITS 0x00021004
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
*/
#define GLFW_DEPTH_BITS 0x00021005
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
*/
#define GLFW_STENCIL_BITS 0x00021006
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
*/
#define GLFW_ACCUM_RED_BITS 0x00021007
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
*/
#define GLFW_ACCUM_GREEN_BITS 0x00021008
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
*/
#define GLFW_ACCUM_BLUE_BITS 0x00021009
/*! @brief Framebuffer bit depth hint.
*
* Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
*/
#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
/*! @brief Framebuffer auxiliary buffer hint.
*
* Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
*/
#define GLFW_AUX_BUFFERS 0x0002100B
/*! @brief OpenGL stereoscopic rendering hint.
*
* OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
*/
#define GLFW_STEREO 0x0002100C
/*! @brief Framebuffer MSAA samples hint.
*
* Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
*/
#define GLFW_SAMPLES 0x0002100D
/*! @brief Framebuffer sRGB hint.
*
* Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
*/
#define GLFW_SRGB_CAPABLE 0x0002100E
/*! @brief Monitor refresh rate hint.
*
* Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
*/
#define GLFW_REFRESH_RATE 0x0002100F
/*! @brief Framebuffer double buffering hint.
*
* Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER).
*/
#define GLFW_DOUBLEBUFFER 0x00021010
/*! @brief Context client API hint and attribute.
*
* Context client API [hint](@ref GLFW_CLIENT_API_hint) and
* [attribute](@ref GLFW_CLIENT_API_attrib).
*/
#define GLFW_CLIENT_API 0x00022001
/*! @brief Context client API major version hint and attribute.
*
* Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint)
* and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib).
*/
#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
/*! @brief Context client API minor version hint and attribute.
*
* Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint)
* and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
*/
#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
/*! @brief Context client API revision number attribute.
*
* Context client API revision number
* [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
*/
#define GLFW_CONTEXT_REVISION 0x00022004
/*! @brief Context robustness hint and attribute.
*
* Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint)
* and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib).
*/
#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
/*! @brief OpenGL forward-compatibility hint and attribute.
*
* OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint)
* and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
*/
#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
/*! @brief Debug mode context hint and attribute.
*
* Debug mode context [hint](@ref GLFW_OPENGL_DEBUG_CONTEXT_hint) and
* [attribute](@ref GLFW_OPENGL_DEBUG_CONTEXT_attrib).
*/
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
/*! @brief OpenGL profile hint and attribute.
*
* OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and
* [attribute](@ref GLFW_OPENGL_PROFILE_attrib).
*/
#define GLFW_OPENGL_PROFILE 0x00022008
/*! @brief Context flush-on-release hint and attribute.
*
* Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and
* [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib).
*/
#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
/*! @brief Context error suppression hint and attribute.
*
* Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and