-
Notifications
You must be signed in to change notification settings - Fork 4
/
raylib.nelua
1877 lines (1686 loc) · 129 KB
/
raylib.nelua
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
require 'math'
require 'string'
##[[
cinclude "raylib.h"
local compiler = require 'nelua.ccompiler'
if compiler.get_cc_info().is_emscripten then
PLATFORM_WEB = true
primtypes.integer = primtypes.int32
primtypes.uinteger = primtypes.uint32
primtypes.number = primtypes.float32
else
-- NOTE: raylib should always be linked first
linklib "raylib"
if ccinfo.is_windows then
linklib "opengl32"
linklib "gdi32"
linklib "winmm"
linklib "pthread"
end
if ccinfo.is_linux or ccinfo.is_gnu_linux then
linklib "GL"
linklib "m"
linklib "dl"
linklib "rt"
linklib "X11"
linklib "pthread"
end
if ccinfo.is_macos then
cflags "-framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo"
end
if ccinfo.is_freebsd or ccinfo.is_netbsd or ccinfo.is_openbsd or ccinfo.is_bsd then
linklib "GL"
linklib "pthread"
linklib "m"
end
end
]]
-- Raylib binding
global rl = @record{}
-- Emscripten main loop function.
## if PLATFORM_WEB then
function rl.wasmSetMainLoop(func: function(), fps: cint, simulate_infinite_loop: cint) <cimport'emscripten_set_main_loop',cinclude'<emscripten.h>',nodecl> end
## end
------------------------------------------------------------------------------------
-- Structures Definition
------------------------------------------------------------------------------------
-- vector2, 2 components
global rl.vector2: type <cimport'Vector2', cinclude'<raylib.h>',nodecl> = @record{
x: float32, -- Vector x component
y: float32 -- Vector y component
}
## rl.value.metafields.vector2.value.is_vector2 = true
local rl.vector2_or_scalar_concept = #[concept(function(attr)
-- match in case of scalar or Vec2
return attr.type.is_scalar or attr.type.is_vector2
end)]#
-- vector3, 3 components
global rl.vector3: type <cimport'Vector3', cinclude'<raylib.h>',nodecl> = @record{
x: float32, -- Vector x component
y: float32, -- Vector y component
z: float32 -- Vector z component
}
## rl.value.metafields.vector3.value.is_vector3 = true
local rl.vector3_or_scalar_concept = #[concept(function(attr)
-- match in case of scalar or Vec3
return attr.type.is_scalar or attr.type.is_vector3
end)]#
-- vector4, 4 components
global rl.vector4: type <cimport'Vector4', cinclude'<raylib.h>',nodecl> = @record{
x: float32, -- Vector x component
y: float32, -- Vector y component
z: float32, -- Vector z component
w: float32 -- Vector w component
}
-- Quaternion, 4 components (vector4 alias)
global rl.quaternion: type = @rl.vector4
## rl.value.metafields.quaternion.value.quaternion = true
-- matrix, 4x4 components, column major, OpenGL style, right handed
global rl.matrix: type <cimport'Matrix', cinclude'<raylib.h>',nodecl> = @record{
m0: float32, m4: float32, m8: float32, m12: float32, -- Matrix first row (4 components)
m1: float32, m5: float32, m9: float32, m13: float32, -- Matrix second row (4 components)
m2: float32, m6: float32, m10: float32, m14: float32, -- Matrix third row (4 components)
m3: float32, m7: float32, m11: float32, m15: float32 -- Matrix fourth row (4 components)
}
-- Color, 4 components, R8G8B8A8 (32bit)
global rl.color: type <cimport'Color', cinclude'<raylib.h>', nodecl> = @record{
r: cuchar, -- Color red value
g: cuchar, -- Color green value
b: cuchar, -- Color blue value
a: cuchar -- Color alpha value
}
## rl.value.metafields.color.value.color = true
-- Rectangle, 4 components
global rl.rectangle: type <cimport'Rectangle', cinclude'<raylib.h>',nodecl> = @record{
x: float32, -- Rectangle top-left corner position x
y: float32, -- Rectangle top-left corner position y
width: float32, -- Rectangle width
height: float32 -- Rectangle height
}
-- Image, pixel data stored in CPU memory (RAM)
global rl.image: type <cimport'Image', cinclude'<raylib.h>',nodecl> = @record{
data: pointer, -- Image raw data
width: cint, -- Image base width
height: cint, -- Image base height
mipmaps: cint, -- Mipmap levels, 1 by default
format: cint -- Data format (pixelFormat type)
}
-- Texture, tex data stored in GPU memory (VRAM)
global rl.texture: type <cimport'Texture', cinclude'<raylib.h>',nodecl> = @record{
id: cuint, -- OpenGL Texture id
width: cint, -- Texture base width
height: cint, -- Texture base height
mipmaps: cint, -- Mipmap levels, 1 by default
format: cuint -- Data format (pixelFormat type)
}
-- Texture2D, same as texture
global rl.texture2D: type = @rl.texture
-- TextureCubemap, same as texture
global rl.textureCubemap: type = @rl.texture
-- RenderTexture, fbo for texture rendering
global rl.renderTexture: type <cimport'RenderTexture', cinclude'<raylib.h>',nodecl> = @record{
id: cuint, -- OpenGL framebuffer object id
texture: rl.texture, -- color buffer attachment texture
depth: rl.texture -- Depth buffer attachment texture
}
-- RenderTexture2D, same as renderTexture
global rl.renderTexture2D: type = @rl.renderTexture
-- BPatchInfo, n-patch layout info
global rl.nPatchInfo: type <cimport'NPatchInfo', cinclude'<raylib.h>',nodecl> = @record{
source: rl.rectangle,
left: cint,
top: cint,
right: cint,
bottom: cint,
layout: cint
}
-- GlyphInfo, font characters glyphs info
global rl.glyphInfo : type <cimport'GlyphInfo', cinclude'<raylib.h>',nodecl> = @record{
value: cint,
offsetX: cint,
offsetY: cint,
advanceX: cint,
image: rl.image
}
-- Font, font texture and glyphInfo array data
global rl.font: type <cimport'Font', cinclude'<raylib.h>',nodecl> = @record{
baseSize: cint,
glyphCount: cint,
glyphPadding: cint,
texture: rl.texture2D,
recs: *rl.rectangle,
glyphs: *rl.glyphInfo
}
-- Camera, defines position/orientation in 3d space
global rl.camera3D: type <cimport'Camera3D', cinclude'<raylib.h>',nodecl> = @record{
position: rl.vector3,
target: rl.vector3,
up: rl.vector3,
fovy: float32,
projection: cint
}
global rl.camera: type = @rl.camera3D -- Camera type fallback, defaults to camera3D
-- Camera2D, defines position/orientation in 2d space
global rl.camera2D: type <cimport'Camera2D', cinclude'<raylib.h>',nodecl> = @record{
offset: rl.vector2,
target: rl.vector2,
rotation: float32,
zoom: float32
}
-- Mesh, vertex data and vao/vbo
global rl.mesh: type <cimport'Mesh', cinclude'<raylib.h>',nodecl> = @record{
vertexCount: cint,
triangleCount: cint,
vertices: *float32,
texcoords: *float32,
texcoords2: *float32,
normals: *float32,
tangents: *float32,
colors: *cuchar,
indices: *cushort,
animVertices: *float32,
animNormals: *float32,
boneIds: *cint,
boneWeights: *float32,
vaoId: cuint,
vboId: *cuint
}
-- Shader
global rl.shader: type <cimport'Shader', cinclude'<raylib.h>',nodecl> = @record{
id: cuint,
locs: *cint
}
-- MaterialMap
global rl.materialMap: type <cimport'MaterialMap', cinclude'<raylib.h>',nodecl> = @record{
texture: rl.texture2D,
color: rl.color,
value: float32
}
-- Material, includes shader and maps
global rl.material: type <cimport'Material', cinclude'<raylib.h>',nodecl> = @record{
shader: rl.shader,
maps: *rl.materialMap,
params: [4]float32
}
-- Transform, vectex transformation data
global rl.transform: type <cimport'Transform', cinclude'<raylib.h>',nodecl> = @record{
translation: rl.vector3,
rotation: rl.quaternion,
scale: rl.vector3
}
-- Bone, skeletal animation bone
global rl.boneInfo: type <cimport'BoneInfo', cinclude'<raylib.h>',nodecl> = @record{
name: [32]cchar,
parent: cint
}
-- Model, meshes, materials and animation data
global rl.model: type <cimport'Model', cinclude'<raylib.h>',nodecl> = @record{
transform: rl.matrix,
meshCount: cint,
materialCount: cint,
meshes: *rl.mesh,
materials: *rl.material,
meshmaterial: *cint,
boneCount: cint,
bones: *rl.boneInfo,
bindPose: *rl.transform
}
-- ModelAnimation
global rl.modelAnimation: type <cimport'ModelAnimation', cinclude'<raylib.h>',nodecl> = @record{
boneCount: cint,
frameCount: cint,
bones: *rl.boneInfo,
framePoses: **rl.transform,
name: [32]cchar
}
-- Ray, ray for raycasting
global rl.ray: type <cimport'Ray', cinclude'<raylib.h>',nodecl> = @record{
position: rl.vector3,
direction: rl.vector3
}
-- RayCollision, ray hit information
global rl.rayCollision: type <cimport'RayCollision', cinclude'<raylib.h>',nodecl> = @record{
hit: boolean,
distance: float32,
position: rl.vector3,
normal: rl.vector3
}
-- BoundingBox
global rl.boundingBox: type <cimport'BoundingBox', cinclude'<raylib.h>',nodecl> = @record{
min: rl.vector3,
max: rl.vector3
}
-- Wave, audio wave data
global rl.wave: type <cimport'Wave', cinclude'<raylib.h>',nodecl> = @record{
frameCount: cuint,
sampleRate: cuint,
sampleSize: cuint,
channels: cuint,
data: pointer
}
global rl.rAudioBuffer: type <cimport'rAudioBuffer', cinclude'<raylib.h>',nodecl,forwarddecl> = @record{}
global rl.rAudioProcessor: type <cimport'rAudioProcessor', cinclude'<raylib.h>',nodecl,forwarddecl> = @record{}
-- AudioStream, custom audio stream
global rl.audioStream: type <cimport'AudioStream', cinclude'<raylib.h>',nodecl> = @record{
buffer: *rl.rAudioBuffer,
processor: *rl.rAudioProcessor,
sampleRate: cuint,
sampleSize: cuint,
channels: cuint
}
-- Sound
global rl.sound: type <cimport'Sound', cinclude'<raylib.h>',nodecl> = @record{
stream: rl.audioStream,
ampleCount: cuint
}
-- Music, audio stream, anything longer than ~10 seconds should be streamed
global rl.music: type <cimport'Music', cinclude'<raylib.h>',nodecl> = @record{
stream: rl.audioStream,
sampleCount: cuint,
looping: boolean,
ctxType: cint,
ctxData: pointer
}
-- VrDeviceInfo, Head-Mounted-Display device parameters
global rl.vrDeviceInfo: type <cimport'VrDeviceInfo', cinclude'<raylib.h>',nodecl> = @record{
hResolution: cint,
vResolution: cint,
hScreenSize: float32,
vScreenSize: float32,
vScreenCenter: float32,
eyeToScreenDistance: float32,
lensSeparationDistance: float32,
interpupillaryDistance: float32,
lensDistortionValues: [4]float32,
chromaAbCorrection: [4]float32
}
-- VrStereoConfig, VR stereo rendering configuration for simulator
global rl.vrStereoConfig: type <cimport'VrStereoConfig', cinclude'<raylib.h>',nodecl> = @record{
projection: [2]rl.matrix,
viewOffset: [2]rl.matrix,
leftLensCenter: [2]float32,
rightLensCenter: [2]float32,
leftScreenCenter: [2]float32,
rightScreenCenter: [2]float32,
scale: [2]float32,
scaleIn: [2]float32
}
global rl.filePathList: type <cimport'FilePathList', cinclude'<raylib.h>',nodecl> = @record{
capacity: cuint,
count: cuint,
paths: *[0]cstring
}
global rl.automationEvent: type <cimport'AutomationEvent', cinclude'<raylib.h>',nodecl> = @record{
frame: cuint,
type: cuint,
params: [4]cint
}
global rl.automationEventList: type <cimport'AutomationEventList', cinclude'<raylib.h>',nodecl> = @record{
capacity: cuint,
count: cuint,
events: *[0]rl.automationEvent
}
------------------------------------------------------------------------------------
-- Enumerators Definition
------------------------------------------------------------------------------------
-- System/Window config flags
-- NOTE: Every bit registers one state (use it with bit masks)
-- By default all flags are set to 0
global rl.configFlags: type <cimport'ConfigFlags', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
VSYNC_HINT = 64,
FULLSCREEN_MODE = 2,
WINDOW_RESIZABLE = 4,
WINDOW_UNDECORATED = 8,
WINDOW_HIDDEN = 128,
WINDOW_MINIMIZED = 512,
WINDOW_MAXIMIZED = 1024,
WINDOW_UNFOCUSED = 2048,
WINDOW_TOPMOST = 4096,
WINDOW_ALWAYS_RUN = 256,
WINDOW_TRANSPARENT = 16,
WINDOW_HIGHDPI = 8192,
WINDOW_MOUSE_PASSTHROUGH = 16384,
BORDERLESS_WINDOWED_MODE = 32768,
MSAA_4X_HINT = 32,
INTERLACED_HINT = 65536
}
-- Trace log level
-- NOTE: Organized by priority level
global rl.traceLogLevel: type <cimport'TraceLogLevel', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
ALL = 0,
TRACE = 1,
DEBUG = 2,
INFO = 3,
WARNING = 4,
ERROR = 5,
FATAL = 6,
NONE = 7
}
-- Keyboard keys (US keyboard layout)
global rl.keyboardKey: type <cimport'KeyboardKey', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
NULL = 0,
KEY_APOSTROPHE = 39,
COMMA = 44,
MINUS = 45,
PERIOD = 46,
SLASH = 47,
ZERO = 48,
ONE = 49,
TWO = 50,
THREE = 51,
FOUR = 52,
FIVE = 53,
SIX = 54,
SEVEN = 55,
EIGHT = 56,
NINE = 57,
SEMICOLON = 59,
EQUAL = 61,
A = 65,
B = 66,
C = 67,
D = 68,
E = 69,
F = 70,
G = 71,
H = 72,
I = 73,
J = 74,
K = 75,
L = 76,
M = 77,
N = 78,
O = 79,
P = 80,
Q = 81,
R = 82,
S = 83,
T = 84,
U = 85,
V = 86,
W = 87,
X = 88,
Y = 89,
Z = 90,
SPACE = 32,
ESCAPE = 256,
ENTER = 257,
TAB = 258,
BACKSPACE = 259,
INSERT = 260,
DELETE = 261,
RIGHT = 262,
LEFT = 263,
DOWN = 264,
UP = 265,
PAGE_UP = 266,
PAGE_DOWN = 267,
HOME = 268,
END = 269,
CAPS_LOCK = 280,
SCROLL_LOCK = 281,
NUM_LOCK = 282,
PRINT_SCREEN = 283,
PAUSE = 284,
F1 = 290,
F2 = 291,
F3 = 292,
F4 = 293,
F5 = 294,
F6 = 295,
F7 = 296,
F8 = 297,
F9 = 298,
F10 = 299,
F11 = 300,
F12 = 301,
LEFT_SHIFT = 340,
LEFT_CONTROL = 341,
LEFT_ALT = 342,
LEFT_SUPER = 343,
RIGHT_SHIFT = 344,
RIGHT_CONTROL = 345,
RIGHT_ALT = 346,
RIGHT_SUPER = 347,
KB_MENU = 348,
LEFT_BRACKET = 91,
BACKSLASH = 92,
RIGHT_BRACKET = 93,
GRAVE = 96,
KP_0 = 320,
KP_1 = 321,
KP_2 = 322,
KP_3 = 323,
KP_4 = 324,
KP_5 = 325,
KP_6 = 326,
KP_7 = 327,
KP_8 = 328,
KP_9 = 329,
KP_DECIMAL = 330,
KP_DIVIDE = 331,
KP_MULTIPLY = 332,
KP_SUBTRACT = 333,
KP_ADD = 334,
KP_ENTER = 335,
KP_EQUAL = 336,
BACK = 4,
MENU = 82,
VOLUME_UP = 24,
VOLUME_DOWN = 25
}
-- Mouse buttons
global rl.mouseButton: type <cimport'MouseButton', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
LEFT_BUTTON = 0,
RIGHT_BUTTON = 1,
MIDDLE_BUTTON = 2
}
-- Mouse cursor
global rl.mouseCursor: type <cimport'MouseCursor', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
CURSOR_DEFAULT = 0,
CURSOR_ARROW = 1,
CURSOR_IBEAM = 2,
CURSOR_CROSSHAIR = 3,
CURSOR_POINTING_HAND = 4,
CURSOR_RESIZE_EW = 5,
CURSOR_RESIZE_NS = 6,
CURSOR_RESIZE_NWSE = 7,
CURSOR_RESIZE_NESW = 8,
CURSOR_RESIZE_ALL = 9,
CURSOR_NOT_ALLOWED = 10
}
-- Gamepad buttons
global rl.gamepadButton: type <cimport'GamepadButton', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
UNKNOWN = 0,
LEFT_FACE_UP = 1,
LEFT_FACE_RIGHT = 2,
LEFT_FACE_DOWN = 3,
LEFT_FACE_LEFT = 4,
RIGHT_FACE_UP = 5,
RIGHT_FACE_RIGHT = 6,
RIGHT_FACE_DOWN = 7,
RIGHT_FACE_LEFT = 8,
LEFT_TRIGGER_1 = 9,
LEFT_TRIGGER_2 = 10,
RIGHT_TRIGGER_1 = 11,
RIGHT_TRIGGER_2 = 12,
MIDDLE_LEFT = 13,
MIDDLE = 14,
MIDDLE_RIGHT = 15,
LEFT_THUMB = 16,
RIGHT_THUMB = 17
}
-- Gamepad axis
global rl.gamepadAxis: type <cimport'GamepadAxis', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
LEFT_X = 0,
LEFT_Y = 1,
RIGHT_X = 2,
RIGHT_Y = 3,
LEFT_TRIGGER = 4,
RIGHT_TRIGGER = 5
}
-- Material map index
global rl.materialMapIndex: type <cimport'MaterialMapIndex', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
ALBEDO = 0,
METALNESS = 1,
NORMAL = 2,
ROUGHNESS = 3,
OCCLUSION = 4,
EMISSION = 5,
HEIGHT = 6,
BRDG = 7,
CUBEMAP = 8,
IRRADIANCE = 9,
PREFILTER = 10
}
-- Shader location index
global rl.shaderLocationIndex: type <cimport'ShaderLocationIndex', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
VERTEX_POSITION = 0,
VERTEX_TEXCOORD01 = 1,
VERTEX_TEXCOORD02 = 2,
VERTEX_NORMAL = 3,
VERTEX_TANGENT = 4,
VERTEX_color = 5,
MATRIX_MVP = 6,
MATRIX_VIEW = 7,
MATRIX_PROJECTION = 8,
MATRIX_model = 9,
MATRIX_NORMAL = 10,
VECTOR_VIEW = 11,
COLOR_DIFFUSE = 12,
COLOR_SPECULAR = 13,
COLOR_AMBIENT = 14,
MAP_ALBEDO = 15,
MAP_METALNESS = 16,
MAP_NORMAL = 17,
MAP_ROUGHNESS = 18,
MAP_OCCLUSION = 19,
MAP_EMISSION = 20,
MAP_HEIGHT = 21,
MAP_CUBEMAP = 22,
MAP_IRRADIANCE = 23,
MAP_PREFILTER = 24,
MAP_BRDF = 25
}
-- Shader uniform data type
global rl.shaderUniformDataType: type <cimport'ShaderUniformDataType', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
UNIFORM_FLOAT = 0,
UNIFORM_VEC2 = 1,
UNIFORM_VEC3 = 2,
UNIFORM_VEC4 = 3,
UNIFORM_INT = 4,
UNIFORM_IVEC2 = 5,
UNIFORM_IVEC3 = 6,
UNIFORM_IVEC4 = 7,
UNIFORM_SAMPLER2D = 8
}
global rl.shaderAttributeDataType: type <cimport'ShaderAttributeDataType', cinclude'<raylib.h>',nodecl, using> = @enum(cint){
ATTRIB_FLOAT = 0,
ATTRIB_VEC2 = 1,
ATTRIB_VEC3 = 2,
ATTRIB_VEC4 = 3
}
-- Pixel formats
global rl.pixelFormat: type <cimport'PixelFormat', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
UNCOMPRESSED_GRAYSCALE = 1,
UNCOMPRESSED_GRAY_ALPHA = 2,
UNCOMPRESSED_R5G6B5 = 3,
UNCOMPRESSED_R8G8B8 = 4,
UNCOMPRESSED_R5G5B5A1 = 5,
UNCOMPRESSED_R4G4B4A4 = 6,
UNCOMPRESSED_R8G8B8A8 = 7,
UNCOMPRESSED_R32 = 8,
UNCOMPRESSED_R32G32B32 = 9,
UNCOMPRESSED_R32G32B32A32 = 10,
UNCOMPRESSED_R16 = 11,
UNCOMPRESSED_R16G16B16 = 12,
UNCOMPRESSED_R16G16B16A16 = 13,
COMPRESSED_DXT1_RGB = 14,
COMPRESSED_DXT1_RGBA = 15,
COMPRESSED_DXT3_RGBA = 16,
COMPRESSED_DXT5_RGBA = 17,
COMPRESSED_ETC1_RGB = 18,
COMPRESSED_ETC2_RGB = 19,
COMPRESSED_ETC2_EAC_RGBA = 20,
COMPRESSED_PVRT_RGB = 21,
COMPRESSED_PVRT_RGBA = 22,
COMPRESSED_ASTC_4x4_RGBA = 23,
COMPRESSED_ASTC_8x8_RGBA = 24
}
-- texture parameters: filter mode
global rl.textureFilter: type <cimport'TextureFilter', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
FILTER_POINT = 0,
FILTER_BILINEAR = 1,
FILTER_TRILINEAR = 2,
FILTER_ANISOTROPIC_4X = 3,
FILTER_ANISOTROPIC_8X = 4,
FILTER_ANISOTROPIC_16X = 5
}
-- texture parameters: wrap mode
global rl.textureWrap: type <cimport'TextureWrap', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
WRAP_REPEAT = 0,
WRAP_CLAMP = 1,
WRAP_MIRROR_REPEAT = 2,
WRAP_MIRROR_CLAMP = 3
}
-- Cubemap layouts
global rl.cubeMapLayout: type <cimport'CubeMapLayout', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
AUTO_DETECT = 0,
LINE_VERTICAL = 1,
LINE_HORIZONTAL = 2,
CROSS_THREE_BY_FOUR = 3,
CROSS_FOUR_BY_THREE = 4,
PANORAMA = 5
}
-- font type, defines generation method
global rl.fontType: type <cimport'FontType', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
DEFAULT = 0,
BITMAP = 1,
SDF = 2
}
-- color blending modes (pre-defined)
global rl.blendMode: type <cimport'BlendMode', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
ALPHA = 0,
ADDITIVE = 1,
MULTIPLIED = 2,
ADD_colorS = 3,
SUBTRACT_colorS = 4,
CUSTOM = 5
}
-- Gesture
global rl.gestures: type <cimport'Gestures', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
NONE = 0,
TAP = 1,
DOUBLETAP = 2,
HOLD = 4,
DRAG = 8,
SWIPE_RIGHT = 16,
SWIPE_LEFT = 32,
SWIPE_UP = 64,
SWIPE_DOWN = 128,
PINCH_IN = 256,
PINCH_OUT = 512
}
-- camera system modes
global rl.cameraMode: type <cimport'CamerMode', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
CUSTOM = 0,
FREE = 1,
ORBITAL = 2,
FIRST_PERSON = 3,
THIRD_PERSON = 4
}
-- camera projection
global rl.cameraProjection: type <cimport'CameraProjection', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
PERSPECTIVE = 0,
ORTHOGRAPHIC = 1
}
-- N-patch layout
global nPatchLayout: type <cimport'NPatchLayout', cinclude'<raylib.h>',nodecl,using> = @enum(cint){
NINE_PATCH = 0,
THREE_PATCH_VERTICAL = 1,
THREE_PATCH_HORIZONTAL = 2
}
-- Callbacks to hook some internal functions
-- WARNING: This callbacks are intended for advance users
global rl.traceLogCallback: type <cimport'TraceLogCallback', cinclude'<raylib.h>',nodecl> = @function(cint, cstring, cvalist): void
global rl.loadFileDataCallback: type <cimport'LoadFileDataCallback', cinclude'<raylib.h>',nodecl> = @function(cstring, *cint): *cuchar
global rl.saveFileDataCallback: type <cimport'SaveFileDataCallback', cinclude'<raylib.h>',nodecl> = @function(cstring, pointer, cint): boolean
global rl.loadFileTextCallback: type <cimport'LoadFileTextCallback', cinclude'<raylib.h>',nodecl> = @function(cstring): cstring
global rl.saveFileTextCallback: type <cimport'SaveFileTextCallback', cinclude'<raylib.h>',nodecl> = @function(cstring, cstring): boolean
global rl.audioCallback: type <cimport'AudioCallback', cinclude'<raylib.h>',nodecl> = @function(pointer, cuint): void
-- Window-related functions
function rl.initWindow(width: cint, height: cint, title: cstring): void <cimport'InitWindow', cinclude'<raylib.h>', nodecl> end -- Initialize window and OpenGL context
function rl.closeWindow(): void <cimport'CloseWindow', cinclude'<raylib.h>', nodecl> end -- Close window and unload OpenGL context
function rl.windowShouldClose(): boolean <cimport'WindowShouldClose', cinclude'<raylib.h>', nodecl> end -- Check if KEY_ESCAPE pressed or Close icon pressed
function rl.isWindowReady(): boolean <cimport'IsWindowReady', cinclude'<raylib.h>', nodecl> end -- Check if window has been initialized successfully
function rl.isWindowMinimized(): boolean <cimport'IsWindowMinimized', cinclude'<raylib.h>', nodecl> end -- Check if window is currently minimized (only PLATFORM_DESKTOP)
function rl.isWindowMaximized(): boolean <cimport'IsWindowMaximized', cinclude'<raylib.h>', nodecl> end -- Check if window is currently maximized (only PLATFORM_DESKTOP)
function rl.isWindowFocused(): boolean <cimport'IsWindowFocused', cinclude'<raylib.h>', nodecl> end -- Check if window is currently focused (only PLATFORM_DESKTOP)
function rl.isWindowResized(): boolean <cimport'IsWindowResized', cinclude'<raylib.h>', nodecl> end -- Check if window has been resized
function rl.isWindowState(flag: cuint): boolean <cimport'IsWindowState', cinclude'<raylib.h>', nodecl> end -- Check if one specific window flag is enabled
function rl.setWindowState(flags: cuint): void <cimport'SetWindowState', cinclude'<raylib.h>', nodecl> end -- Set window configuration state using flags (only PLATFORM_DESKTOP)
function rl.clearWindowState(): void <cimport'SetWindowState', cinclude'<raylib.h>', nodecl> end -- Clear window configuration state flags
function rl.isWindowHidden(): boolean <cimport'IsWindowHidden', cinclude'<raylib.h>', nodecl> end -- Check if window is currently hidden
function rl.isWindowFullscreen(): boolean <cimport'IsWindowFullscreen', cinclude'<raylib.h>', nodecl> end -- Check if window is currently fullscreen
function rl.toggleFullscreen(): void <cimport'ToggleFullscreen', cinclude'<raylib.h>', nodecl> end -- Toggle fullscreen mode (only PLATFORM_DESKTOP)
function rl.toggleBorderlessWindowed(): void <cimport'ToggleBorderlessWindowed', cinclude'<raylib.h>', nodecl> end -- Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
function rl.maximizeWindow(): void <cimport'MaximizeWindow', cinclude'<raylib.h>', nodecl> end -- Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
function rl.minimizeWindow(): void <cimport'MinimizeWindow', cinclude'<raylib.h>', nodecl> end -- Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
function rl.restoreWindow(): void <cimport'RestoreWindow', cinclude'<raylib.h>', nodecl> end -- Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
function rl.setWindowIcon(image: rl.image): void <cimport'SetWindowIcon', cinclude'<raylib.h>', nodecl> end -- Set icon for window (only PLATFORM_DESKTOP)
function rl.setWindowIcons(image: *rl.image, count: cint): void <cimport'SetWindowIcons', cinclude'<raylib.h>', nodecl> end -- Set icon for window (only PLATFORM_DESKTOP)
function rl.setWindowTitle(title: cstring): void <cimport'SetWindowTitle', cinclude'<raylib.h>', nodecl> end -- Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)
function rl.setWindowPosition(x: cint, y: cint): void <cimport'SetWindowPosition', cinclude'<raylib.h>', nodecl> end -- Set window position on screen (only PLATFORM_DESKTOP)
function rl.setWindowMonitor(monitor: cint): void <cimport'SetWindowMonitor', cinclude'<raylib.h>', nodecl> end -- Set monitor for the current window
function rl.setWindowMinSize(width: cint, height: cint): void <cimport'SetWindowMinSize', cinclude'<raylib.h>', nodecl> end -- Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
function rl.setWindowMaxSize(width: cint, height: cint): void <cimport'SetWindowMaxSize', cinclude'<raylib.h>', nodecl> end -- Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
function rl.setWindowSize(width: cint, height: cint): void <cimport'SetWindowSize', cinclude'<raylib.h>', nodecl> end -- Set window dimensions
function rl.setWindowOpacity(opacity: float32): void <cimport'SetWindowOpacity', cinclude'raylib.h', nodecl> end -- Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
function rl.setWindowFocused(): void <cimport'SetWindowFocused', cinclude'raylib.h', nodecl> end -- Set window focused (only PLATFORM_DESKTOP)
function rl.getWindowHandle(): pointer <cimport'GetWindowHandle', cinclude'<raylib.h>', nodecl> end -- Get native window handle
function rl.getScreenWidth(): cint <cimport'GetScreenWidth', cinclude'<raylib.h>', nodecl> end -- Get current screen width
function rl.getScreenHeight(): cint <cimport'GetScreenHeight', cinclude'<raylib.h>', nodecl> end -- Get current screen height
function rl.getRenderWidth(): void <cimport'GetRenderWidth', cinclude'raylib.h', nodecl> end-- Get current render width (it considers HiDPI)
function rl.getRenderHeight(): void <cimport'GetRenderHeight', cinclude'raylib.h', nodecl> end-- Get current render height (it considers HiDPI)
function rl.getMonitorCount(): cint <cimport'GetMonitorCount', cinclude'<raylib.h>', nodecl> end -- Get number of connected monitors
function rl.getCurrentMonitor(): cint <cimport'GetCurrentMonitor', cinclude'<raylib.h>', nodecl> end -- Get number of connected monitors
function rl.getMonitorPosition(monitor: cint): rl.vector2 <cimport'GetMonitorPosition', cinclude'<raylib.h>', nodecl> end -- Get specified monitor position
function rl.getMonitorWidth(monitor: cint): cint <cimport'GetMonitorWidth', cinclude'<raylib.h>', nodecl> end -- Get primary monitor width
function rl.getMonitorHeight(monitor: cint): cint <cimport'GetMonitorHeight', cinclude'<raylib.h>', nodecl> end -- Get primary monitor height
function rl.getMonitorPhysicalWidth(monitor: cint): cint <cimport'GetMonitorPhysicalWidth', cinclude'<raylib.h>', nodecl> end -- Get primary monitor physical width in millimetres
function rl.getMonitorPhysicalHeight(monitor: cint): cint <cimport'GetMonitorPhysicalHeight', cinclude'<raylib.h>', nodecl> end -- Get primary monitor physical height in millimetres
function rl.getMonitorRefreshRate(monitor: cint): cint <cimport'GetMonitorRefreshRate', cinclude'<raylib.h>', nodecl> end -- Get specified monitor refresh rate
function rl.getWindowPosition(): rl.vector2 <cimport'GetWindowPosition', cinclude'<raylib.h>', nodecl> end -- Get window position XY on monitor
function rl.getWindowScaleDPI(): rl.vector2 <cimport'GetWindowScaleDPI', cinclude'<raylib.h>', nodecl> end -- Get window scale DPI factor
function rl.getMonitorName(monitor: cint): cstring <cimport'GetMonitorName', cinclude'<raylib.h>', nodecl> end -- Get the human-readable, UTF-8 encoded name of the specified monitor
function rl.getClipboardText(): cstring <cimport'GetClipboardText', cinclude'<raylib.h>', nodecl> end -- Get clipboard text content
function rl.setClipboardText(text: cstring): void <cimport'SetClipboardText', cinclude'<raylib.h>', nodecl> end -- Set clipboard text content
function rl.enableEventWaiting(): void <cimport'EnableEventWaiting', cinclude'<raylib.h>', nodecl> end -- Enable waiting for events on EndDrawing(), no automatic event polling
function rl.disableEventWaiting(): void <cimport'DisableEventWaiting', cinclude'<raylib.h>', nodecl> end -- Disable waiting for events on EndDrawing(), automatic events polling
-- Cursor-related functions
function rl.showCursor(): void <cimport'ShowCursor', cinclude'<raylib.h>',nodecl> end -- Shows cursor
function rl.hideCursor(): void <cimport'HideCursor', cinclude'<raylib.h>',nodecl> end -- Hides cursor
function rl.isCursorHidden(): boolean <cimport'IsCursorHidden', cinclude'<raylib.h>',nodecl> end -- Check if cursor is not visible
function rl.enableCursor(): void <cimport'EnableCursor', cinclude'<raylib.h>',nodecl> end -- Enables cursor (unlock cursor)
function rl.disableCursor(): void <cimport'DisableCursor', cinclude'<raylib.h>',nodecl> end -- Disables cursor (lock cursor)
function rl.isCursorOnScreen(): boolean <cimport'IsCursorOnScreen', cinclude'<raylib.h>',nodecl> end -- Check if cursor is on the screen
-- Drawing-related functions
function rl.clearBackground(color: rl.color): void <cimport'ClearBackground', cinclude'<raylib.h>',nodecl> end -- Set background color (framebuffer clear color)
function rl.beginDrawing(): void <cimport'BeginDrawing', cinclude'<raylib.h>',nodecl> end -- Setup canvas (framebuffer) to start drawing
function rl.endDrawing(): void <cimport'EndDrawing', cinclude'<raylib.h>',nodecl> end -- End canvas drawing and swap buffers (double buffering)
function rl.beginMode2D(camera: rl.camera2D): void <cimport'BeginMode2D', cinclude'<raylib.h>',nodecl> end -- Begin 2D mode with custom camera (2D)
function rl.endMode2D(): void <cimport'EndMode2D', cinclude'<raylib.h>',nodecl> end -- Ends 3D mode and returns to default 2D orthographic mode
function rl.beginMode3D(camera: rl.camera3D): void <cimport'BeginMode3D', cinclude'<raylib.h>',nodecl> end -- Begin 3D mode with custom camera (3D)
function rl.endMode3D(): void <cimport'EndMode3D', cinclude'<raylib.h>',nodecl> end
function rl.beginTextureMode(target: rl.renderTexture2D): void <cimport'BeginTextureMode', cinclude'<raylib.h>',nodecl> end
function rl.endTextureMode(): void <cimport'EndTextureMode', cinclude'<raylib.h>',nodecl> end
function rl.beginShaderMode(shader: rl.shader): void <cimport'BeginShaderMode', cinclude'<raylib.h>',nodecl> end
function rl.endShaderMode(): void <cimport'EndShaderMode', cinclude'<raylib.h>',nodecl> end
function rl.beginBlendMode(mode: cint): void <cimport'BeginBlendMode', cinclude'<raylib.h>',nodecl> end
function rl.endBlendMode(): void <cimport'EndBlendMode', cinclude'<raylib.h>',nodecl> end
function rl.beginScissorMode(x: cint, y: cint, width: cint, height: cint): void <cimport'BeginScissorMode', cinclude'<raylib.h>',nodecl> end
function rl.endScissorMode(): void <cimport'EndScissorMode', cinclude'<raylib.h>',nodecl> end
function rl.beginVrStereoMode(config: rl.vrStereoConfig): void <cimport'BeginVrStereoMode', cinclude'<raylib.h>',nodecl> end
function rl.endVrStereoMode(): void <cimport'EndVrStereoMode', cinclude'<raylib.h>',nodecl> end
-- VR stereo config functions for VR simulator
function rl.loadvrStereoConfig(device: rl.vrDeviceInfo): rl.vrStereoConfig <cimport'LoadvrStereoConfig', cinclude'<raylib.h>',nodecl> end
function rl.unloadvrStereoConfig(config: rl.vrStereoConfig): void <cimport'UnloadvrStereoConfig', cinclude'<raylib.h>',nodecl> end
-- shader management functions
-- NOTE: shader functionality is not available on OpenGL 1.1
function rl.loadShader(vsFileName: cstring, fsFileName: cstring): rl.shader <cimport'LoadShader', cinclude'<raylib.h>',nodecl> end
function rl.loadShaderFromMemory(vsCode: cstring, fsCode: cstring): rl.shader <cimport'LoadShaderFromMemory', cinclude'<raylib.h>',nodecl> end
function rl.isShaderReady(shader: rl.shader): boolean <cimport'IsShaderReady', cinclude'<raylib.h>',nodecl> end
function rl.getShaderLocation(shader: rl.shader, uniformName: cstring): cint <cimport'GetShaderLocation', cinclude'<raylib.h>',nodecl> end
function rl.getShaderLocationAttrib(shader: rl.shader, attribName: cstring): cint <cimport'GetShaderLocationAttrib', cinclude'<raylib.h>',nodecl> end
function rl.setShaderValue(shader: rl.shader, locIndex: cint, value: pointer, uniformType: cint): void <cimport'SetShaderValue', cinclude'<raylib.h>',nodecl> end
function rl.setShaderValueV(shader: rl.shader, locIndex: cint, value: pointer, uniformType: cint, count: cint): void <cimport'SetShaderValueV', cinclude'<raylib.h>',nodecl> end
function rl.setShaderValueMatrix(shader: rl.shader, locIndex: cint, mat: rl.matrix): void <cimport'SetShaderValueMatrix', cinclude'<raylib.h>',nodecl> end
function rl.setShaderValueTexture(shader: rl.shader, locIndex: cint, texture: rl.texture2D): void <cimport'SetShaderValueTexture', cinclude'<raylib.h>',nodecl> end
function rl.unloadShader(shader: rl.shader): void <cimport'UnloadShader', cinclude'<raylib.h>',nodecl> end
-- Screen-space-related functions
function rl.getMouseRay(mousePosition: rl.vector2, camera: rl.camera): rl.ray <cimport'GetMouseRay', cinclude'<raylib.h>',nodecl> end
function rl.getcameraMatrix(camera: rl.camera): rl.matrix <cimport'GetcameraMatrix', cinclude'<raylib.h>',nodecl> end
function rl.getcameraMatrix2D(camera: rl.camera2D): rl.matrix <cimport'GetcameraMatrix2D', cinclude'<raylib.h>',nodecl> end
function rl.getWorldToScreen(position: rl.vector3, camera: rl.camera): rl.vector2 <cimport'GetWorldToScreen', cinclude'<raylib.h>',nodecl> end
function rl.getWorldToScreenEx(position: rl.vector3, camera: rl.camera, width: cint, height: cint): rl.vector2 <cimport'GetWorldToScreenEx', cinclude'<raylib.h>',nodecl> end
function rl.getWorldToScreen2D(position: rl.vector2, camera: rl.camera2D): rl.vector2 <cimport'GetWorldToScreen2D', cinclude'<raylib.h>',nodecl> end
function rl.getScreenToWorld2D(position: rl.vector2, camera: rl.camera2D): rl.vector2 <cimport'GetScreenToWorld2D', cinclude'<raylib.h>',nodecl> end
-- Timing-related functions
function rl.setTargetFPS(fps: cint): void <cimport'SetTargetFPS', cinclude'<raylib.h>',nodecl> end
function rl.getFrameTime(): float32 <cimport'GetFrameTime', cinclude'<raylib.h>',nodecl> end
function rl.getTime(): float64 <cimport'GetTime', cinclude'<raylib.h>',nodecl> end
function rl.getFPS(): cint <cimport'GetFPS', cinclude'<raylib.h>',nodecl> end
-- Custom frame control functions
-- NOTE: Those functions are intended for advance users that want full control over the frame processing
-- By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
function rl.swapScreenBuffer(): void <cimport'SwapScreenBuffer', cinclude'<raylib.h>', nodecl> end
function rl.pollInputEvents(): void <cimport'PollInputEvents', cinclude'<raylib.h>', nodecl> end
function rl.waitTime(ms: float32): void <cimport'WaitTime', cinclude'<raylib.h>', nodecl> end
-- Random values generation functions
function rl.setRandomSeed(seed: cuint): void <cimport'SetRandomSeed', cinclude'<raylib.h>', nodecl> end -- Set the seed for the random number generator
function rl.getRandomValue(min: cint, max: cint): cint <cimport'GetRandomValue', cinclude'<raylib.h>',nodecl> end -- Get a random value between min and max (both included)
function rl.loadRandomSequence(count: cuint, min: cint, max: cint): *[0]cint <cimport'LoadRandomSequence', cinclude'<raylib.h>',nodecl> end -- Load random values sequence, no values repeated
function rl.unloadRandomSequence(sequence: *[0]cint): void <cimport'UnloadRandomSequence', cinclude'<raylib.h>',nodecl> end -- Unload random values sequence
-- Misc. functions
function rl.takeScreenshot(fileName: cstring): void <cimport'TakeScreenshot', cinclude'<raylib.h>',nodecl> end
function rl.setConfigFlags(flags: cuint): void <cimport'SetConfigFlags', cinclude'<raylib.h>',nodecl> end
function rl.openURL(url: cstring): void <cimport'OpenURL', cinclude'<raylib.h>',nodecl> end
function rl.traceLog(logLevel: cint, text: cstring, ...: cvarargs): void <cimport'TraceLog', cinclude'<raylib.h>',nodecl> end
function rl.setTraceLogLevel(logLevel: cint): void <cimport'SetTraceLogLevel', cinclude'<raylib.h>',nodecl> end
function rl.memAlloc(size: cint): pointer <cimport'MemAlloc', cinclude'<raylib.h>',nodecl> end
function rl.memRealloc(ptr: pointer, size: cint): pointer <cimport'MemRealloc', cinclude'<raylib.h>',nodecl> end
function rl.memFree(ptr: pointer): void <cimport'MemFree', cinclude'<raylib.h>',nodecl> end
-- Set custom callbacks
-- WARNING: Callbacks setup is intended for advance users
function rl.setTraceLogCallback(callback: rl.traceLogCallback): void <cimport'SetTraceLogCallback', cinclude'<raylib.h>',nodecl> end
function rl.setLoadFileDataCallback(callback: rl.loadFileDataCallback): void <cimport'SetLoadFileDataCallback', cinclude'<raylib.h>',nodecl> end
function rl.setSaveFileDataCallback(callback: rl.saveFileDataCallback): void <cimport'SetSaveFileDataCallback', cinclude'<raylib.h>',nodecl> end
function rl.setLoadFileTextCallback(callback: rl.loadFileTextCallback): void <cimport'SetLoadFileTextCallback', cinclude'<raylib.h>',nodecl> end
function rl.setSaveFileTextCallback(callback: rl.saveFileTextCallback): void <cimport'SetSaveFileTextCallback', cinclude'<raylib.h>',nodecl> end
-- Files management functions
function rl.loadFileData(fileName: cstring, dataSize: *cint): *cuchar <cimport'LoadFileData', cinclude'<raylib.h>',nodecl> end
function rl.unloadFileData(data: *cuchar): void <cimport'UnloadFileData', cinclude'<raylib.h>',nodecl> end
function rl.saveFileData(fileName: cstring, data: pointer, dataSize: cint): boolean <cimport'SaveFileData', cinclude'<raylib.h>',nodecl> end
function rl.exportDataAsCode(data: cstring, dataSize: cint, fileName: cstring): boolean <cimport'ExportDataAsCode', cinclude'<raylib.h>',nodecl> end
function rl.loadFileText(fileName: cstring): cstring <cimport'LoadFileText', cinclude'<raylib.h>',nodecl> end
function rl.unloadFileText(text: *cuchar): void <cimport'UnloadFileText', cinclude'<raylib.h>',nodecl> end
function rl.saveFileText(fileName: cstring, text: cstring): boolean <cimport'SaveFileText', cinclude'<raylib.h>',nodecl> end
-- File system functions
function rl.fileExists(fileName: cstring): boolean <cimport'FileExists', cinclude'<raylib.h>',nodecl> end
function rl.directoryExists(dirPath: cstring): boolean <cimport'DirectoryExists', cinclude'<raylib.h>',nodecl> end
function rl.isFileExtension(fileName: cstring, ext: cstring): boolean <cimport'IsFileExtension', cinclude'<raylib.h>',nodecl> end
function rl.getFileLength(fileName: cstring): cint <cimport'GetFileLength', cinclude'<raylib.h>',nodecl> end
function rl.getFileExtension(fileName: cstring): cstring <cimport'GetFileExtension', cinclude'<raylib.h>',nodecl> end
function rl.getFileName(filePath: cstring): cstring <cimport'GetFileName', cinclude'<raylib.h>',nodecl> end
function rl.getFileNameWithoutExt(filePath: cstring): cstring <cimport'GetFileNameWithoutExt', cinclude'<raylib.h>',nodecl> end
function rl.getDirectoryPath(filePath: cstring): cstring <cimport'GetDirectoryPath', cinclude'<raylib.h>',nodecl> end
function rl.getPrevDirectoryPath(dirPath: cstring): cstring <cimport'GetPrevDirectoryPath', cinclude'<raylib.h>',nodecl> end
function rl.getWorkingDirectory(): cstring <cimport'GetWorkingDirectory', cinclude'<raylib.h>',nodecl> end
function rl.getApplicationDirectory(): cstring <cimport'GetApplicationDirectory', cinclude'<raylib.h>',nodecl> end
function rl.loadDirectoryFiles(dir: cstring): rl.filePathList <cimport'LoadDirectoryFiles', cinclude'<raylib.h>',nodecl> end
function rl.loadDirectoryFilesEx(basePath: cstring, filter: cstring, scanSubDirs: boolean): rl.filePathList <cimport'LoadDirectoryFilesEx', cinclude'<raylib.h>',nodecl> end
function rl.unloadDirectoryFiles(files: rl.filePathList): void <cimport'UnloadDirectoryFiles', cinclude'<raylib.h>',nodecl> end
function rl.changeDirectory(dir: cstring): boolean <cimport'ChangeDirectory', cinclude'<raylib.h>',nodecl> end
function rl.isPathFile(path: cstring): boolean <cimport'IsPathFile', cinclude'<raylib.h>',nodecl> end
function rl.isFileDropped(): boolean <cimport'IsFileDropped', cinclude'<raylib.h>',nodecl> end
function rl.LoadDroppedFiles(files: rl.filePathList): void <cimport'LoadDroppedFiles', cinclude'<raylib.h>',nodecl> end
function rl.unloadDroppedFiles(files: rl.filePathList): void <cimport'UnloadDroppedFiles', cinclude'<raylib.h>',nodecl> end
function rl.getFileModTime(fileName: cstring): clong <cimport'GetFileModTime', cinclude'<raylib.h>',nodecl> end
-- Compression/Encoding functionality
function rl.compressData(data: *cuchar, dataLength: cint, compDataLength: *cint): *cuchar <cimport'CompressData', cinclude'<raylib.h>',nodecl> end
function rl.decompressData(compData: *cuchar, compDataLength: cint, dataLength: *cint): *cuchar <cimport'DecompressData', cinclude'<raylib.h>',nodecl> end
function rl.encodeDataBase64(data: *cuchar, dataLength: cint, outputLength: *cint): *cchar <cimport'EncodeDataBase64', cinclude'<raylib.h>',nodecl> end
function rl.decodeDataBase64(data: *cuchar, outputLength: *cint): *cuchar <cimport'DecodeDataBase64', cinclude'<raylib.h>',nodecl> end
-- Automation events functionality
function rl.loadAutomationEventList(fileName: cstring): rl.automationEventList <cimport'LoadAutomationEventList', cinclude'<raylib.h>',nodecl> end -- Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
function rl.unloadAutomationEventList(list: *rl.automationEventList): void <cimport'UnloadAutomationEventList', cinclude'<raylib.h>',nodecl> end -- Unload automation events list from file
function rl.exportAutomationEventList(list: *rl.automationEventList, fileName: cstring): boolean <cimport'ExportAutomationEventList', cinclude'<raylib.h>',nodecl> end -- Export automation events list as text file
function rl.setAutomationEventList(list: *rl.automationEventList): void <cimport'SetAutomationEventList', cinclude'<raylib.h>',nodecl> end -- Set automation event list to record to
function rl.setAutomationEventBaseFrame(frame: cint): void <cimport'SetAutomationEventBaseFrame', cinclude'<raylib.h>',nodecl> end -- Set automation event internal base frame to start recording
function rl.startAutomationEventRecording(): void <cimport'StartAutomationEventRecording', cinclude'<raylib.h>',nodecl> end -- Start recording automation events (AutomationEventList must be set)
function rl.stopAutomationEventRecording(): void <cimport'StopAutomationEventRecording', cinclude'<raylib.h>',nodecl> end -- Stop recording automation events
function rl.playAutomationEvent(event: rl.automationEvent): void <cimport'PlayAutomationEvent', cinclude'<raylib.h>',nodecl> end -- Play a recorded automation event
--------------------------------------------------------------------------------------
-- Input Handling Functions (Module: core)
--------------------------------------------------------------------------------------
-- Input-related functions: keyboard
function rl.isKeyPressed(key: cint): boolean <cimport'IsKeyPressed', cinclude'<raylib.h>',nodecl> end
function rl.isKeyPressedRepeat(key: cint): boolean <cimport'IsKeyPressedRepeat', cinclude'<raylib.h>',nodecl> end
function rl.isKeyDown(key: cint): boolean <cimport'IsKeyDown', cinclude'<raylib.h>',nodecl> end
function rl.isKeyReleased(key: cint): boolean <cimport'IsKeyReleased', cinclude'<raylib.h>',nodecl> end
function rl.isKeyUp(key: cint): boolean <cimport'IsKeyUp', cinclude'<raylib.h>',nodecl> end
function rl.getKeyPressed(): cint <cimport'GetKeyPressed', cinclude'<raylib.h>',nodecl> end
function rl.getCharPressed(): cint <cimport'GetCharPressed', cinclude'<raylib.h>',nodecl> end
function rl.setExitKey(key: cint): void <cimport'SetExitKey', cinclude'<raylib.h>',nodecl> end
-- Input-related functions: gamepads
function rl.isGamepadAvailable(gamepad: cint): boolean <cimport'IsGamepadAvailable', cinclude'<raylib.h>',nodecl> end
function rl.getGamepadName(gamepad: cint): cstring <cimport'GetGamepadName', cinclude'<raylib.h>',nodecl> end
function rl.isGamepadButtonPressed(gamepad: cint, button: cint): boolean <cimport'IsGamepadButtonPressed', cinclude'<raylib.h>',nodecl> end
function rl.isGamepadButtonDown(gamepad: cint, button: cint): boolean <cimport'IsGamepadButtonDown', cinclude'<raylib.h>',nodecl> end
function rl.isGamepadButtonReleased(gamepad: cint, button: cint): boolean <cimport'IsGamepadButtonReleased', cinclude'<raylib.h>',nodecl> end
function rl.isGamepadButtonUp(gamepad: cint, button: cint): boolean <cimport'IsGamepadButtonUp', cinclude'<raylib.h>',nodecl> end
function rl.getGamepadButtonPressed(): cint <cimport'GetGamepadButtonPressed', cinclude'<raylib.h>',nodecl> end
function rl.getGamepadAxisCount(gamepad: cint): cint <cimport'GetGamepadAxisCount', cinclude'<raylib.h>',nodecl> end
function rl.getGamepadAxisMovement(gamepad: cint, axis: cint): float32 <cimport'GetGamepadAxisMovement', cinclude'<raylib.h>',nodecl> end
function rl.setGamepadMappings(mappings: cstring): cint <cimport'SetGamepadMappings', cinclude'<raylib.h>',nodecl> end
-- Input-related functions: mouse
function rl.isMouseButtonPressed(button: cint): boolean <cimport'IsMouseButtonPressed', cinclude'<raylib.h>',nodecl> end
function rl.isMouseButtonDown(button: cint): boolean <cimport'IsMouseButtonDown', cinclude'<raylib.h>',nodecl> end
function rl.isMouseButtonReleased(button: cint): boolean <cimport'IsMouseButtonReleased', cinclude'<raylib.h>',nodecl> end
function rl.isMouseButtonUp(button: cint): boolean <cimport'IsMouseButtonUp', cinclude'<raylib.h>',nodecl> end
function rl.getMouseX(): cint <cimport'GetMouseX', cinclude'<raylib.h>',nodecl> end
function rl.getMouseY(): cint <cimport'GetMouseY', cinclude'<raylib.h>',nodecl> end
function rl.getMousePosition(): rl.vector2 <cimport'GetMousePosition', cinclude'<raylib.h>',nodecl> end
function rl.getMouseDelta(): rl.vector2 <cimport'GetMouseDelta', cinclude'<raylib.h>', nodecl> end
function rl.setMousePosition(x: cint, y: cint): void <cimport'SetMousePosition', cinclude'<raylib.h>',nodecl> end
function rl.setMouseOffset(offsetX: cint, offsetY: cint): void <cimport'SetMouseOffset', cinclude'<raylib.h>',nodecl> end
function rl.setMouseScale(scaleX: float32, scaleY: float32): void <cimport'SetMouseScale', cinclude'<raylib.h>',nodecl> end
function rl.getMouseWheelMove(): float32 <cimport'GetMouseWheelMove', cinclude'<raylib.h>',nodecl> end
function rl.getMouseWheelMoveV(): rl.vector2 <cimport'GetMouseWheelMoveV', cinclude'<raylib.h>',nodecl> end
function rl.setMouseCursor(cursor: cint): void <cimport'SetMouseCursor', cinclude'<raylib.h>',nodecl> end
-- Input-related functions: touch
function rl.getTouchX(): cint <cimport'GetTouchX', cinclude'<raylib.h>',nodecl> end
function rl.getTouchY(): cint <cimport'GetTouchY', cinclude'<raylib.h>',nodecl> end
function rl.getTouchPosition(index: cint): rl.vector2 <cimport'GetTouchPosition', cinclude'<raylib.h>',nodecl> end
function rl.getTouchPointID(index: cint): cint <cimport'GetTouchPosition', cinclude'<raylib.h>',nodecl> end