-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNeslib.Glfw3.pas
3648 lines (2638 loc) · 124 KB
/
Neslib.Glfw3.pas
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
unit Neslib.Glfw3;
{ GLFW3 language bindings for Delphi }
{ Copyright (c) 2016 by Erik van Bilsen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. }
{$MINENUMSIZE 4}
{$MODE DELPHI}
interface
uses
{$IFNDEF FPC}
{$IF Defined(MSWINDOWS)}
Winapi.Windows,
{$ELSEIF Defined(MACOS) and not Defined(IOS)}
Macapi.CocoaTypes,
{$ELSEIF Defined(DARWIN)}
{$ELSE}
{$MESSAGE Error 'Unsupported platform'}
{$ENDIF}
System.SysUtils;
{$ELSE}
{$IF Defined(MSWINDOWS)}
Windows,
{$ELSEIF Defined(MACOS) and not Defined(IOS)}
Macapi.CocoaTypes,
{$ELSEIF Defined(DARWIN)}
{$ELSE}
{$MESSAGE Error 'Unsupported platform'}
{$ENDIF}
SysUtils;
{$ENDIF}
const
{$IF Defined(WIN32)}
{ @exclude }
GLFW3_LIB = 'glfw3_32.dll';
{ @exclude }
_PU = '';
{$ELSEIF Defined(WIN64)}
{ @exclude }
GLFW3_LIB = 'glfw3_64.dll';
{ @exclude }
_PU = '';
{$ELSEIF Defined(MACOS) and not Defined(IOS)}
{ @exclude }
GLFW3_LIB = 'libglfw.3.2.dylib';
{ @exclude }
_PU = '_';
{$ELSEIF Defined(DARWIN)}
{ @exclude }
GLFW3_LIB = 'libglfw.3.2.dylib';
{ @exclude }
_PU = '';
{$IFDEF FPC}
{$LINKLIB libglfw.3.2.dylib }
{$ENDIF}
{$ELSE}
{$MESSAGE Error 'Unsupported platform'}
{$ENDIF}
{$REGION 'glfw3.h'}
{*************************************************************************
* GLFW 3.2 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2016 Camilla Berglund <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.
*
*************************************************************************}
{*************************************************************************
* GLFW API tokens
*************************************************************************}
const
{ The major version number of the GLFW library.
This is incremented when the API is changed in non-compatible ways. }
GLFW_VERSION_MAJOR = 3;
const
{ The minor version number of the GLFW library.
This is incremented when features are added to the API but it remains
backward-compatible. }
GLFW_VERSION_MINOR = 2;
const
{ The revision number of the GLFW library.
This is incremented when a bug fix release is made that does not contain any
API changes. }
GLFW_VERSION_REVISION = 1;
const
{ One.
One. Seriously. You don't <i>need</i> to use this symbol in your code. It's
just semantic sugar for the number 1. You can use <tt>1</tt> or
<tt>GL_TRUE</tt> or whatever you want. }
GLFW_TRUE = 1;
const
{ Zero.
Zero. Seriously. You don't <i>need</i> to use this symbol in your code. It's
just just semantic sugar for the number 0. You can use <tt>0</tt> or
<tt>GL_FALSE</tt> or whatever you want. }
GLFW_FALSE = 0;
const
{ The key or mouse button was released. }
GLFW_RELEASE = 0;
const
{ The key or mouse button was pressed. }
GLFW_PRESS = 1;
const
{ The key was held down until it repeated. }
GLFW_REPEAT = 2;
const
{ The unknown key }
GLFW_KEY_UNKNOWN = -1;
const
{ Printable keys }
GLFW_KEY_SPACE = 32;
GLFW_KEY_APOSTROPHE = 39;
GLFW_KEY_COMMA = 44;
GLFW_KEY_MINUS = 45;
GLFW_KEY_PERIOD = 46;
GLFW_KEY_SLASH = 47;
GLFW_KEY_0 = 48;
GLFW_KEY_1 = 49;
GLFW_KEY_2 = 50;
GLFW_KEY_3 = 51;
GLFW_KEY_4 = 52;
GLFW_KEY_5 = 53;
GLFW_KEY_6 = 54;
GLFW_KEY_7 = 55;
GLFW_KEY_8 = 56;
GLFW_KEY_9 = 57;
GLFW_KEY_SEMICOLON = 59;
GLFW_KEY_EQUAL = 61;
GLFW_KEY_A = 65;
GLFW_KEY_B = 66;
GLFW_KEY_C = 67;
GLFW_KEY_D = 68;
GLFW_KEY_E = 69;
GLFW_KEY_F = 70;
GLFW_KEY_G = 71;
GLFW_KEY_H = 72;
GLFW_KEY_I = 73;
GLFW_KEY_J = 74;
GLFW_KEY_K = 75;
GLFW_KEY_L = 76;
GLFW_KEY_M = 77;
GLFW_KEY_N = 78;
GLFW_KEY_O = 79;
GLFW_KEY_P = 80;
GLFW_KEY_Q = 81;
GLFW_KEY_R = 82;
GLFW_KEY_S = 83;
GLFW_KEY_T = 84;
GLFW_KEY_U = 85;
GLFW_KEY_V = 86;
GLFW_KEY_W = 87;
GLFW_KEY_X = 88;
GLFW_KEY_Y = 89;
GLFW_KEY_Z = 90;
GLFW_KEY_LEFT_BRACKET = 91;
GLFW_KEY_BACKSLASH = 92;
GLFW_KEY_RIGHT_BRACKET = 93;
GLFW_KEY_GRAVE_ACCENT = 96;
GLFW_KEY_WORLD_1 = 161;
GLFW_KEY_WORLD_2 = 162;
const
{ Function keys }
GLFW_KEY_ESCAPE = 256;
GLFW_KEY_ENTER = 257;
GLFW_KEY_TAB = 258;
GLFW_KEY_BACKSPACE = 259;
GLFW_KEY_INSERT = 260;
GLFW_KEY_DELETE = 261;
GLFW_KEY_RIGHT = 262;
GLFW_KEY_LEFT = 263;
GLFW_KEY_DOWN = 264;
GLFW_KEY_UP = 265;
GLFW_KEY_PAGE_UP = 266;
GLFW_KEY_PAGE_DOWN = 267;
GLFW_KEY_HOME = 268;
GLFW_KEY_END = 269;
GLFW_KEY_CAPS_LOCK = 280;
GLFW_KEY_SCROLL_LOCK = 281;
GLFW_KEY_NUM_LOCK = 282;
GLFW_KEY_PRINT_SCREEN = 283;
GLFW_KEY_PAUSE = 284;
GLFW_KEY_F1 = 290;
GLFW_KEY_F2 = 291;
GLFW_KEY_F3 = 292;
GLFW_KEY_F4 = 293;
GLFW_KEY_F5 = 294;
GLFW_KEY_F6 = 295;
GLFW_KEY_F7 = 296;
GLFW_KEY_F8 = 297;
GLFW_KEY_F9 = 298;
GLFW_KEY_F10 = 299;
GLFW_KEY_F11 = 300;
GLFW_KEY_F12 = 301;
GLFW_KEY_F13 = 302;
GLFW_KEY_F14 = 303;
GLFW_KEY_F15 = 304;
GLFW_KEY_F16 = 305;
GLFW_KEY_F17 = 306;
GLFW_KEY_F18 = 307;
GLFW_KEY_F19 = 308;
GLFW_KEY_F20 = 309;
GLFW_KEY_F21 = 310;
GLFW_KEY_F22 = 311;
GLFW_KEY_F23 = 312;
GLFW_KEY_F24 = 313;
GLFW_KEY_F25 = 314;
GLFW_KEY_KP_0 = 320;
GLFW_KEY_KP_1 = 321;
GLFW_KEY_KP_2 = 322;
GLFW_KEY_KP_3 = 323;
GLFW_KEY_KP_4 = 324;
GLFW_KEY_KP_5 = 325;
GLFW_KEY_KP_6 = 326;
GLFW_KEY_KP_7 = 327;
GLFW_KEY_KP_8 = 328;
GLFW_KEY_KP_9 = 329;
GLFW_KEY_KP_DECIMAL = 330;
GLFW_KEY_KP_DIVIDE = 331;
GLFW_KEY_KP_MULTIPLY = 332;
GLFW_KEY_KP_SUBTRACT = 333;
GLFW_KEY_KP_ADD = 334;
GLFW_KEY_KP_ENTER = 335;
GLFW_KEY_KP_EQUAL = 336;
GLFW_KEY_LEFT_SHIFT = 340;
GLFW_KEY_LEFT_CONTROL = 341;
GLFW_KEY_LEFT_ALT = 342;
GLFW_KEY_LEFT_SUPER = 343;
GLFW_KEY_RIGHT_SHIFT = 344;
GLFW_KEY_RIGHT_CONTROL = 345;
GLFW_KEY_RIGHT_ALT = 346;
GLFW_KEY_RIGHT_SUPER = 347;
GLFW_KEY_MENU = 348;
GLFW_KEY_LAST = GLFW_KEY_MENU;
const
{ If this bit is set one or more Shift keys were held down. }
GLFW_MOD_SHIFT = $0001;
const
{ If this bit is set one or more Control keys were held down. }
GLFW_MOD_CONTROL = $0002;
const
{ If this bit is set one or more Alt keys were held down. }
GLFW_MOD_ALT = $0004;
const
{ If this bit is set one or more Super keys were held down. }
GLFW_MOD_SUPER = $0008;
const
{ Mouse buttons }
GLFW_MOUSE_BUTTON_1 = 0;
GLFW_MOUSE_BUTTON_2 = 1;
GLFW_MOUSE_BUTTON_3 = 2;
GLFW_MOUSE_BUTTON_4 = 3;
GLFW_MOUSE_BUTTON_5 = 4;
GLFW_MOUSE_BUTTON_6 = 5;
GLFW_MOUSE_BUTTON_7 = 6;
GLFW_MOUSE_BUTTON_8 = 7;
GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8;
GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1;
GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2;
GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3;
const
{ Joysticks }
GLFW_JOYSTICK_1 = 0;
GLFW_JOYSTICK_2 = 1;
GLFW_JOYSTICK_3 = 2;
GLFW_JOYSTICK_4 = 3;
GLFW_JOYSTICK_5 = 4;
GLFW_JOYSTICK_6 = 5;
GLFW_JOYSTICK_7 = 6;
GLFW_JOYSTICK_8 = 7;
GLFW_JOYSTICK_9 = 8;
GLFW_JOYSTICK_10 = 9;
GLFW_JOYSTICK_11 = 10;
GLFW_JOYSTICK_12 = 11;
GLFW_JOYSTICK_13 = 12;
GLFW_JOYSTICK_14 = 13;
GLFW_JOYSTICK_15 = 14;
GLFW_JOYSTICK_16 = 15;
GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16;
{ Error codes }
const
{ GLFW has not been initialized.
This occurs if a GLFW function was called that must not be called unless the
library is initialized.
Application programmer error. Initialize GLFW before calling any
function that requires initialization. }
GLFW_NOT_INITIALIZED = $00010001;
const
{ 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 glfwSwapInterval.
Application programmer error. Ensure a context is current before
calling functions that require a current context. }
GLFW_NO_CURRENT_CONTEXT = $00010002;
const
{ 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 GLFW_RED_BITS with glfwGetWindowAttrib.
Application programmer error. Fix the offending call. }
GLFW_INVALID_ENUM = $00010003;
const
{ 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 GLFW_VERSION_UNAVAILABLE error.
Application programmer error. Fix the offending call. }
GLFW_INVALID_VALUE = $00010004;
const
{ A memory allocation failed.
A bug in GLFW or the underlying operating system. Report the bug to our
issue tracker (https://github.com/glfw/glfw/issues). }
GLFW_OUT_OF_MEMORY = $00010005;
const
{ GLFW could not find support for the requested API on the system.
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.
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. OS X 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. }
GLFW_API_UNAVAILABLE = $00010006;
const
{ 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.
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.
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 GLFW_INVALID_VALUE, because GLFW cannot know what future versions
will exist. }
GLFW_VERSION_UNAVAILABLE = $00010007;
const
{ A platform-specific error occurred that does not match any of the
more specific categories.
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). }
GLFW_PLATFORM_ERROR = $00010008;
const
{ 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.
If emitted during window creation, one or more hard constraints 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.
If emitted when querying the clipboard, ignore the error or report it to
the user, as appropriate. }
GLFW_FORMAT_UNAVAILABLE = $00010009;
const
{ 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.
Application programmer error. Fix the offending call. }
GLFW_NO_WINDOW_CONTEXT = $0001000A;
const
GLFW_FOCUSED = $00020001;
GLFW_ICONIFIED = $00020002;
GLFW_RESIZABLE = $00020003;
GLFW_VISIBLE = $00020004;
GLFW_DECORATED = $00020005;
GLFW_AUTO_ICONIFY = $00020006;
GLFW_FLOATING = $00020007;
GLFW_MAXIMIZED = $00020008;
GLFW_RED_BITS = $00021001;
GLFW_GREEN_BITS = $00021002;
GLFW_BLUE_BITS = $00021003;
GLFW_ALPHA_BITS = $00021004;
GLFW_DEPTH_BITS = $00021005;
GLFW_STENCIL_BITS = $00021006;
GLFW_ACCUM_RED_BITS = $00021007;
GLFW_ACCUM_GREEN_BITS = $00021008;
GLFW_ACCUM_BLUE_BITS = $00021009;
GLFW_ACCUM_ALPHA_BITS = $0002100A;
GLFW_AUX_BUFFERS = $0002100B;
GLFW_STEREO = $0002100C;
GLFW_SAMPLES = $0002100D;
GLFW_SRGB_CAPABLE = $0002100E;
GLFW_REFRESH_RATE = $0002100F;
GLFW_DOUBLEBUFFER = $00021010;
GLFW_CLIENT_API = $00022001;
GLFW_CONTEXT_VERSION_MAJOR = $00022002;
GLFW_CONTEXT_VERSION_MINOR = $00022003;
GLFW_CONTEXT_REVISION = $00022004;
GLFW_CONTEXT_ROBUSTNESS = $00022005;
GLFW_OPENGL_FORWARD_COMPAT = $00022006;
GLFW_OPENGL_DEBUG_CONTEXT = $00022007;
GLFW_OPENGL_PROFILE = $00022008;
GLFW_CONTEXT_RELEASE_BEHAVIOR = $00022009;
GLFW_CONTEXT_NO_ERROR = $0002200A;
GLFW_CONTEXT_CREATION_API = $0002200B;
GLFW_NO_API = 0;
GLFW_OPENGL_API = $00030001;
GLFW_OPENGL_ES_API = $00030002;
GLFW_NO_ROBUSTNESS = 0;
GLFW_NO_RESET_NOTIFICATION = $00031001;
GLFW_LOSE_CONTEXT_ON_RESET = $00031002;
GLFW_OPENGL_ANY_PROFILE = 0;
GLFW_OPENGL_CORE_PROFILE = $00032001;
GLFW_OPENGL_COMPAT_PROFILE = $00032002;
GLFW_CURSOR = $00033001;
GLFW_STICKY_KEYS = $00033002;
GLFW_STICKY_MOUSE_BUTTONS = $00033003;
GLFW_CURSOR_NORMAL = $00034001;
GLFW_CURSOR_HIDDEN = $00034002;
GLFW_CURSOR_DISABLED = $00034003;
GLFW_ANY_RELEASE_BEHAVIOR = 0;
GLFW_RELEASE_BEHAVIOR_FLUSH = $00035001;
GLFW_RELEASE_BEHAVIOR_NONE = $00035002;
GLFW_NATIVE_CONTEXT_API = $00036001;
GLFW_EGL_CONTEXT_API = $00036002;
{ Standard cursor shapes }
const
{ The regular arrow cursor shape. }
GLFW_ARROW_CURSOR = $00036001;
const
{ The text input I-beam cursor shape. }
GLFW_IBEAM_CURSOR = $00036002;
const
{ The crosshair shape. }
GLFW_CROSSHAIR_CURSOR = $00036003;
const
{ The hand shape. }
GLFW_HAND_CURSOR = $00036004;
const
{ The horizontal resize arrow shape. }
GLFW_HRESIZE_CURSOR = $00036005;
const
{ The vertical resize arrow shape. }
GLFW_VRESIZE_CURSOR = $00036006;
const
GLFW_CONNECTED = $00040001;
GLFW_DISCONNECTED = $00040002;
GLFW_DONT_CARE = -1;
{************************************************************************
* GLFW API types
************************************************************************}
type
{ Client API function pointer type.
Generic function pointer used for returning client API function pointers
without forcing a cast from a regular pointer.
SeeAlso:
glfwGetProcAddress
Added in version 3.0. }
TGLFWglproc = procedure(); cdecl;
type
{ Opaque monitor object.
Added in version 3.0. }
PGLFWmonitor = Pointer;
PPGLFWmonitor = ^PGLFWmonitor;
type
{ Opaque window object.
Added in version 3.0. }
PGLFWwindow = Pointer;
PPGLFWwindow = ^PGLFWwindow;
type
{ Opaque cursor object.
Added in version 3.1. }
PGLFWcursor = Pointer;
PPGLFWcursor = ^PGLFWcursor;
type
{ The function signature for error callbacks.
Parameters:
error: An error code.
description: A UTF-8 encoded string describing the error.
SeeAlso:
glfwSetErrorCallback
Added in version 3.0. }
TGLFWerrorfun = procedure(error: Integer; const description: PAnsiChar); cdecl;
type
{ The function signature for window position callbacks.
Parameters:
window: The window that was moved.
xpos: The new x-coordinate, in screen coordinates, of the upper-left
corner of the client area of the window.
ypos: The new y-coordinate, in screen coordinates, of the upper-left
corner of the client area of the window.
SeeAlso:
glfwSetWindowPosCallback
Added in version 3.0. }
TGLFWwindowposfun = procedure(window: PGLFWwindow; xpos, ypos: Integer); cdecl;
type
{ The function signature for window resize callbacks.
Parameters:
window: The window that was resized.
width: The new width, in screen coordinates, of the window.
height: The new height, in screen coordinates, of the window.
SeeAlso:
glfwSetWindowSizeCallback
Added in version 1.0. GLFW3 added window handle parameter. }
TGLFWwindowsizefun = procedure(window: PGLFWwindow; width, height: Integer); cdecl;
type
{ The function signature for window close callbacks.
Parameters:
window: The window that the user attempted to close.
SeeAlso:
glfwSetWindowCloseCallback
Added in version 2.5. GLFW3 added window handle parameter. }
TGLFWwindowclosefun = procedure(window: PGLFWwindow); cdecl;
type
{ The function signature for window content refresh callbacks.
Parameters:
window: The window whose content needs to be refreshed.
SeeAlso:
glfwSetWindowRefreshCallback
Added in version 2.5. GLFW3 added window handle parameter. }
TGLFWwindowrefreshfun = procedure(window: PGLFWwindow); cdecl;
type
{ The function signature for window focus/defocus callbacks.
Parameters:
window: The window that gained or lost input focus.
focused: <tt>GLFW_TRUE</tt> if the window was given input focus, or
<tt>GLFW_FALSE</tt> if it lost it.
SeeAlso:
glfwSetWindowFocusCallback
Added in version 3.0. }
TGLFWwindowfocusfun = procedure(window: PGLFWwindow; focused: Integer); cdecl;
type
{ The function signature for window iconify/restore callbacks.
Parameters:
window: The window that was iconified or restored.
iconified: <tt>GLFW_TRUE</tt> if the window was iconified, or
<tt>GLFW_FALSE</tt> if it was restored.
SeeAlso:
glfwSetWindowIconifyCallback
Added in version 3.0. }
TGLFWwindowiconifyfun = procedure(window: PGLFWwindow; iconified: Integer); cdecl;
type
{ The function signature for framebuffer resize callbacks.
Parameters:
window: The window whose framebuffer was resized.
width: The new width, in pixels, of the framebuffer.
height: The new height, in pixels, of the framebuffer.
SeeAlso:
glfwSetFramebufferSizeCallback
Added in version 3.0. }
TGLFWframebuffersizefun = procedure(window: PGLFWwindow; width, height: Integer); cdecl;
type
{ The function signature for mouse button callbacks.
Parameters:
window: The window that received the event.
button: The mouse button that was pressed or released.
action: One of <tt>GLFW_PRESS</tt> or <tt>GLFW_RELEASE</tt>.
mods: Bit field describing which modifier keys were held down.
SeeAlso:
glfwSetMouseButtonCallback
Added in version 1.0. GLFW3 added window handle and modifier mask
parameters. }
TGLFWmousebuttonfun = procedure(window: PGLFWwindow; button, action, mods: Integer); cdecl;
type
{ The function signature for cursor position callbacks.
Parameters:
window: The window that received the event.
xpos: The new cursor x-coordinate, relative to the left edge of the
client area.
ypos: The new cursor y-coordinate, relative to the top edge of the
client area.
SeeAlso:
glfwSetCursorPosCallback
Added in version 3.0. Replaces <tt>TGLFWmouseposfun</tt>. }
TGLFWcursorposfun = procedure(window: PGLFWwindow; xpos, ypos: Double); cdecl;
type
{ The function signature for cursor enter/leave callbacks.
Parameters:
window: The window that received the event.
entered: <tt>GLFW_TRUE</tt> if the cursor entered the window's client
area, or <tt>GLFW_FALSE</tt> if it left it.
SeeAlso:
glfwSetCursorEnterCallback
Added in version 3.0. }
TGLFWcursorenterfun = procedure(window: PGLFWwindow; entered: Integer); cdecl;
type
{ The function signature for scroll callbacks.
Parameters:
window: The window that received the event.
xoffset: The scroll offset along the x-axis.
yoffset: The scroll offset along the y-axis.
SeeAlso:
glfwSetScrollCallback
Added in version 3.0. Replaces <tt>TGLFWmousewheelfun</tt>. }
TGLFWscrollfun = procedure(window: PGLFWwindow; xoffset, yoffset: Double); cdecl;
type
{ The function signature for keyboard key callbacks.
Parameters:
window: The window that received the event.
key: The keyboard key that was pressed or released.
scancode: The system-specific scancode of the key.
action: <tt>GLFW_PRESS</tt>, <tt>GLFW_RELEASE</tt> or <tt>GLFW_REPEAT</tt>.
mods: Bit field describing which modifier keys were held down.
SeeAlso:
glfwSetKeyCallback
Added in version 1.0. GLFW3 added window handle, scancode and modifier mask
parameters. }
TGLFWkeyfun = procedure(window: PGLFWwindow; key, scancode, action, mods: Integer); cdecl;
type
{ The function signature for Unicode character callbacks.
Parameters:
window: The window that received the event.
codepoint: The Unicode code point of the character.
SeeAlso:
glfwSetCharCallback
Added in version 2.4. GLFW3 added window handle parameter. }
TGLFWcharfun = procedure(window: PGLFWwindow; codepoint: Cardinal); cdecl;
type
{ The function signature for Unicode character with modifiers
callbacks. It is called for each input character, regardless of what
modifier keys are held down.
Parameters:
window: The window that received the event.
codepoint: The Unicode code point of the character.
mods: Bit field describing which modifier keys were held down.
SeeAlso:
glfwSetCharModsCallback
Added in version 3.1. }
TGLFWcharmodsfun = procedure(window: PGLFWwindow; codepoint: Cardinal; mods: Integer); cdecl;
type
{ The function signature for file drop callbacks.
Parameters:
window: The window that received the event.
count: The number of dropped files.
paths: The UTF-8 encoded file and/or directory path names.
SeeAlso:
glfwSetDropCallback
Added in version 3.1. }
TGLFWdropfun = procedure(window: PGLFWwindow; count: Integer; const paths: PPAnsiChar); cdecl;
type
{ The function signature for monitor configuration callbacks.
Parameters:
monitor: The monitor that was connected or disconnected.
event: One of <tt>GLFW_CONNECTED</tt> or <tt>GLFW_DISCONNECTED</tt>.
SeeAlso:
glfwSetMonitorCallback
Added in version 3.0. }
TGLFWmonitorfun = procedure(monitor: PGLFWmonitor; event: Integer); cdecl;
type
{ The function signature for joystick configuration callbacks.
Parameters:
joy: The joystick that was connected or disconnected.
event: One of <tt>GLFW_CONNECTED</tt> or <tt>GLFW_DISCONNECTED</tt>.
SeeAlso:
glfwSetJoystickCallback
Added in version 3.2. }
TGLFWjoystickfun = procedure(joy, event: Integer); cdecl;
type
{ Video mode type.
SeeAlso:
glfwGetVideoMode, glfwGetVideoModes
Added in version 1.0. GLFW3 added refresh rate member. }
TGLFWvidmode = record
width: Integer;
height: Integer;
redBits: Integer;
greenBits: Integer;
blueBits: Integer;
refreshRate: Integer;
end;
PGLFWvidmode = ^TGLFWvidmode;
PPGLFWvidmode = ^PGLFWvidmode;
type
{ Describes the gamma ramp for a monitor.
SeeAlso:
glfwGetGammaRamp, glfwSetGammaRamp
Added in version 3.0. }
TGLFWgammaramp = record
red: PWord;
green: PWord;
blue: PWord;
size: Cardinal;
end;
PGLFWgammaramp = ^TGLFWgammaramp;
PPGLFWgammaramp = ^PGLFWgammaramp;
type
{ Image data.
Added in version 2.1. GLFW3 removed format and bytes-per-pixel members. }
TGLFWimage = record
width: Integer;
height: Integer;
pixels: PByte;
end;
PGLFWimage = ^TGLFWimage;
PPGLFWimage = ^PGLFWimage;
{************************************************************************
* GLFW API functions
************************************************************************}
{ Initializes the GLFW library.
This function initializes the GLFW library. Before most GLFW functions can
be used, GLFW must be initialized, and before an application terminates GLFW
should be terminated in order to free any resources allocated during or
after initialization.
If this function fails, it calls glfwTerminate before returning. If it
succeeds, you should call glfwTerminate before the application exits.
Additional calls to this function after successful initialization but before
termination will return <tt>GLFW_TRUE</tt> immediately.
Returns:
<tt>GLFW_TRUE</tt> if successful, or <tt>GLFW_FALSE</tt> if an error
occurred.
Possible errors include GLFW_PLATFORM_ERROR.
On macOS, this function will change the current directory of the application
to the <tt>Contents/Resources</tt> subdirectory of the application's bundle,
if present.
This function must only be called from the main thread.
SeeAlso:
glfwTerminate
Added in version 1.0. }
function glfwInit(): Integer;
cdecl external GLFW3_LIB name _PU + 'glfwInit';
{ Terminates the GLFW library.
This function destroys all remaining windows and cursors, restores any
modified gamma ramps and frees any other allocated resources. Once this
function is called, you must again call glfwInit successfully before
you will be able to use most GLFW functions.
If GLFW has been successfully initialized, this function should be called
before the application exits. If initialization fails, there is no need to
call this function, as it is called by glfwInit before it returns failure.
Possible errors include GLFW_PLATFORM_ERROR.
This function may be called before glfwInit.
The contexts of any remaining windows must not be current on any other thread
when this function is called.
This function must not be called from a callback.
This function must only be called from the main thread.
SeeAlso:
glfwInit
Added in version 1.0. }
procedure glfwTerminate();
cdecl external GLFW3_LIB name _PU + 'glfwTerminate';
{ Retrieves the version of the GLFW library.
This function retrieves the major, minor and revision numbers of the GLFW
library. It is intended for when you are using GLFW as a shared library and
want to ensure that you are using the minimum required version.
Any or all of the version arguments may be <tt>nil</tt>.
Parameters:
major: Where to store the major version number, or <tt>nil</tt>.
minor: Where to store the minor version number, or <tt>nil</tt>.
rev: Where to store the revision number, or <tt>nil</tt>.
This function may be called before glfwInit.
This function may be called from any thread.
SeeAlso:
glfwGetVersionString
Added in version 1.0. }
procedure glfwGetVersion(major, minor, rev: PInteger);
cdecl external GLFW3_LIB name _PU + 'glfwGetVersion';
{ Returns a string describing the compile-time configuration.
This function returns the compile-time generated version string of the GLFW
library binary. It describes the version, platform, compiler and any
platform-specific compile-time options. It should not be confused with the
OpenGL or OpenGL ES version string, queried with <tt>glGetString</tt>.
<b>Do not use the version string</b> to parse the GLFW library version. The
glfwGetVersion function provides the version of the running library binary in
numerical format.