This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
raylib.nelua
2040 lines (1632 loc) · 148 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
-- links:
## linklib'raylib'
##[[ if RAYLIB_STATIC then
linklib'GL'
linklib'pthread'
linklib'dl'
linklib'rt'
linklib'X11'
end]]
-- raylib binding:
global Raylib = @record{}
-- ----------------------------------------------------------------------------------
-- Some basic Defines
-- ----------------------------------------------------------------------------------
global PI: float32 <cimport, cinclude'<raylib.h>', nodecl>
global DEG2RAD: float32 <cimport, cinclude'<raylib.h>', nodecl>
global RAD2DEG: float32 <cimport, cinclude'<raylib.h>', nodecl>
global MAX_TOUCH_POINTS: cint <cimport, cinclude'<raylib.h>', nodecl> -- Maximum number of touch points supported
-- ----------------------------------------------------------------------------------
-- Structures Definition
-- ----------------------------------------------------------------------------------
-- Vector2 type
global Vector2 <cimport, cinclude'<raylib.h>', nodecl> = @record{
x: float32,
y: float32,
}
## Vector2.value.is_vector2 = true
-- Vector3 type
global Vector3 <cimport, cinclude'<raylib.h>', nodecl> = @record{
x: float32,
y: float32,
z: float32,
}
## Vector3.value.is_vector3 = true
-- Vector4 type
global Vector4 <cimport, cinclude'<raylib.h>', nodecl> = @record{
x: float32,
y: float32,
z: float32,
w: float32,
}
## Vector4.value.is_vector4 = true
-- Quaternion type, same as Vector4
global Quaternion: type = @Vector4
-- Matrix type (OpenGL style 4x4 - right handed, column major)
global Matrix <cimport, cinclude'<raylib.h>', nodecl> = @record{
m0: float32, m4: float32, m8: float32, m12: float32,
m1: float32, m5: float32, m9: float32, m13: float32,
m2: float32, m6: float32, m10: float32, m14: float32,
m3: float32, m7: float32, m11: float32, m15: float32,
}
## Matrix.value.is_matrix = true
-- Color type, RGBA (32bit)
global Color <cimport, cinclude'<raylib.h>', nodecl> = @record{
r: cuchar,
g: cuchar,
b: cuchar,
a: cuchar,
}
## Color.value.is_color = true
-- Rectangle type
global Rectangle <cimport, cinclude'<raylib.h>', nodecl> = @record{
x: float32,
y: float32,
width: float32,
height: float32,
}
## Rectangle.value.is_rectangle = true
-- Image type, bpp always RGBA (32bit)
-- NOTE: Data stored in CPU memory (RAM)
global Image <cimport, 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)
}
## Image.value.is_image = true
-- Texture2D type
-- NOTE: Data stored in GPU memory
global Texture2D <cimport, 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: cint, -- Data format (PixelFormat type)
}
## Texture2D.value.is_texture2d = true
-- Texture type, same as Texture2D
global Texture: type = @Texture2D
-- TextureCubemap type, actually, same as Texture2D
global TextureCubemap: type = @Texture2D
-- RenderTexture2D type, for texture rendering
global RenderTexture2D <cimport, cinclude'<raylib.h>', nodecl> = @record{
id: cuint, -- OpenGL Framebuffer Object (FBO) id
texture: Texture2D, -- Color buffer attachment texture
depth: Texture2D, -- Depth buffer attachment texture
depthTexture: boolean, -- Track if depth attachment is a texture or renderbuffer
}
## RenderTexture2D.value.is_rendertexture2d = true
-- RenderTexture type, same as RenderTexture2D
global RenderTexture: type = @RenderTexture2D
-- N-Patch layout info
global NPatchInfo <cimport, cinclude'<raylib.h>', nodecl> = @record{
sourceRec: Rectangle, -- Region in the texture
left: cint, -- left border offset
top: cint, -- top border offset
right: cint, -- right border offset
bottom: cint, -- bottom border offset
type: cint, -- layout of the n-patch: 3x3, 1x3 or 3x1
}
## NPatchInfo.value.is_npatchinfo = true
-- Font character info
global CharInfo <cimport, cinclude'<raylib.h>', nodecl> = @record{
value: cint, -- Character value (Unicode)
offsetX: cint, -- Character offset X when drawing
offsetY: cint, -- Character offset Y when drawing
advanceX: cint, -- Character advance position X
image: Image, -- Character image data
}
## CharInfo.value.is_charinfo = true
-- Font type, includes texture and charSet array data
global Font <cimport, cinclude'<raylib.h>', nodecl> = @record{
baseSize: cint, -- Base size (default chars height)
charsCount: cint, -- Number of characters
texture: Texture2D, -- Characters texture atlas
recs: *[0]Rectangle, -- Characters rectangles in texture
chars: *[0]CharInfo, -- Characters info data
}
## Font.value.is_font = true
global SpriteFont <cimport, cinclude'<raylib.h>', nodecl> = Font -- SpriteFont type fallback, defaults to Font
-- Camera type, defines a camera position/orientation in 3d space
global Camera3D <cimport, cinclude'<raylib.h>', nodecl> = @record{
position: Vector3, -- Camera position
target: Vector3, -- Camera target it looks-at
up: Vector3, -- Camera up vector (rotation over its axis)
fovy: float32, -- Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
type: cint, -- Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
}
## Camera3D.value.is_camera3d = true
global Camera: type = @Camera3D -- Camera type fallback, defaults to Camera3D
-- Camera2D type, defines a 2d camera
global Camera2D <cimport, cinclude'<raylib.h>', nodecl> = @record{
offset: Vector2, -- Camera offset (displacement from target)
target: Vector2, -- Camera target (rotation and zoom origin)
rotation: float32, -- Camera rotation in degrees
zoom: float32, -- Camera zoom (scaling), should be 1.0f by default
}
## Camera2D.value.is_camera2d = true
-- Vertex data definning a mesh
-- NOTE: Data stored in CPU memory (and GPU)
global Mesh <cimport, cinclude'<raylib.h>', nodecl> = @record{
vertexCount: cint, -- Number of vertices stored in arrays
triangleCount: cint, -- Number of triangles stored (indexed or not)
-- Default vertex data
vertices: *[0]float32, -- Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
texcoords: *[0]float32, -- Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
texcoords2: *[0]float32, -- Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
normals: *[0]float32, -- Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
tangents: *[0]float32, -- Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
colors: *[0]cuchar, -- Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
indices: *[0]cushort, -- Vertex indices (in case vertex data comes indexed)
-- Animation vertex data
animVertices: *[0]float32, -- Animated vertex positions (after bones transformations)
animNormals: *[0]float32, -- Animated normals (after bones transformations)
boneIds: *[0]cint, -- Vertex bone ids, up to 4 bones influence by vertex (skinning)
boneWeights: *[0]float32, -- Vertex bone weight, up to 4 bones influence by vertex (skinning)
-- OpenGL identifiers
vaoId: cuint, -- OpenGL Vertex Array Object id
vboId: *[0]cuint, -- OpenGL Vertex Buffer Objects id (default vertex data)
}
## Mesh.value.is_mesh = true
-- Shader type (generic)
global Shader <cimport, cinclude'<raylib.h>', nodecl> = @record{
id: cuint, -- Shader program id
locs: *[0]cint, -- Shader locations array (MAX_SHADER_LOCATIONS)
}
## Shader.value.is_shader = true
-- Material texture map
global MaterialMap <cimport, cinclude'<raylib.h>', nodecl> = @record{
texture: Texture2D, -- Material map texture
color: Color, -- Material map color
value: float32, -- Material map value
}
## MaterialMap.value.is_materialmap = true
-- Material type (generic)
global Material <cimport, cinclude'<raylib.h>', nodecl> = @record{
shader: Shader, -- Material shader
maps: *[0]MaterialMap, -- Material maps array (MAX_MATERIAL_MAPS)
params: *[0]float32, -- Material generic parameters (if required)
}
## Material.value.is_material = true
-- Transformation properties
global Transform <cimport, cinclude'<raylib.h>', nodecl> = @record{
translation: Vector3, -- Translation
rotation: Quaternion, -- Rotation
scale: Vector3, -- Scale
}
## Transform.value.is_transform = true
-- Bone information
global BoneInfo <cimport, cinclude'<raylib.h>', nodecl> = @record{
name : [32]cchar, -- Bone name
parent: cint, -- Bone parent
}
## BoneInfo.value.is_boneinfo = true
-- Model type
global Model <cimport, cinclude'<raylib.h>', nodecl> = @record{
transform: Matrix, -- Local transform matrix
meshCount: cint, -- Number of meshes
meshes: *[0]Mesh, -- Meshes array
materialCount: cint, -- Number of materials
materials: *[0]Material, -- Materials array
meshMaterial: *[0]cint, -- Mesh material number
-- Animation data
boneCount: cint, -- Number of bones
bones: *[0]BoneInfo, -- Bones information (skeleton)
bindPose: *[0]Transform, -- Bones base transformation (pose)
}
## Model.value.is_model = true
-- Model animation
global ModelAnimation <cimport, cinclude'<raylib.h>', nodecl> = @record{
boneCount: cint, -- Number of bones
bones: *[0]BoneInfo, -- Bones information (skeleton)
frameCount: cint, -- Number of animation frames
framePoses: *[0]*[0]Transform, -- Poses array by frame
}
## ModelAnimation.value.is_modelanimation = true
-- Ray type (useful for raycast)
global Ray <cimport, cinclude'<raylib.h>', nodecl> = @record{
position: Vector3, -- Ray position (origin)
direction: Vector3, -- Ray direction
}
## Ray.value.is_ray = true
-- Raycast hit information
global RayHitInfo <cimport, cinclude'<raylib.h>', nodecl> = @record{
hit: boolean, -- Did the ray hit something?
distance: float32, -- Distance to nearest hit
position: Vector3, -- Position of nearest hit
normal: Vector3, -- Surface normal of hit
}
## RayHitInfo.value.is_rayhitinfo = true
-- Bounding box type
global BoundingBox <cimport, cinclude'<raylib.h>', nodecl> = @record{
min: Vector3, -- Minimum vertex box-corner
max: Vector3, -- Maximum vertex box-corner
}
## BoundingBox.value.is_boundingbox = true
-- Wave type, defines audio wave data
global Wave <cimport, cinclude'<raylib.h>', nodecl> = @record{
sampleCount: cuint, -- Total number of samples
sampleRate: cuint, -- Frequency (samples per second)
sampleSize: cuint, -- Bit depth (bits per sample): 8, 16, 32 (24 not supported)
channels: cuint, -- Number of channels (1-mono, 2-stereo)
data: pointer, -- Buffer data pointer
}
## Wave.value.is_wave = true
global rAudioBuffer <cimport, cinclude'<raylib.h>', nodecl> = @record{
}
## rAudioBuffer.value.is_raudiobuffer = true
-- Audio stream type
-- NOTE: Useful to create custom audio streams not bound to a specific file
global AudioStream <cimport, cinclude'<raylib.h>', nodecl> = @record{
sampleRate: cuint, -- Frequency (samples per second)
sampleSize: cuint, -- Bit depth (bits per sample): 8, 16, 32 (24 not supported)
channels: cuint, -- Number of channels (1-mono, 2-stereo)
buffer: *rAudioBuffer, -- Pointer to internal data used by the audio system
}
## AudioStream.value.is_audiostream = true
-- Sound source type
global Sound <cimport, cinclude'<raylib.h>', nodecl> = @record{
sampleCount: cuint, -- Total number of samples
stream: AudioStream, -- Audio stream
}
## Sound.value.is_sound = true
-- Music stream type (audio file streaming from memory)
-- NOTE: Anything longer than ~10 seconds should be streamed
global Music <cimport, cinclude'<raylib.h>', nodecl> = @record{
ctxType: cint, -- Type of music context (audio filetype)
ctxData: pointer, -- Audio context data, depends on type
sampleCount: cuint, -- Total number of samples
loopCount: cuint, -- Loops count (times music will play), 0 means infinite loop
stream: AudioStream, -- Audio stream
}
## Music.value.is_music = true
-- Head-Mounted-Display device parameters
global VrDeviceInfo <cimport, cinclude'<raylib.h>', nodecl> = @record{
hResolution: cint, -- HMD horizontal resolution in pixels
vResolution: cint, -- HMD vertical resolution in pixels
hScreenSize: float32, -- HMD horizontal size in meters
vScreenSize: float32, -- HMD vertical size in meters
vScreenCenter: float32, -- HMD screen center in meters
eyeToScreenDistance: float32, -- HMD distance between eye and display in meters
lensSeparationDistance: float32, -- HMD lens separation distance in meters
interpupillaryDistance: float32, -- HMD IPD (distance between pupils) in meters
lensDistortionValues : [4]float32, -- HMD lens distortion constant parameters
chromaAbCorrection : [4]float32, -- HMD chromatic aberration correction parameters
}
## VrDeviceInfo.value.is_vrdeviceinfo = true
-- ----------------------------------------------------------------------------------
-- Enumerators Definition
-- ----------------------------------------------------------------------------------
-- System config flags
-- NOTE: Used for bit masks
global ConfigFlag = @enum {
FLAG_RESERVED = 1, -- Reserved
FLAG_FULLSCREEN_MODE = 2, -- Set to run program in fullscreen
FLAG_WINDOW_RESIZABLE = 4, -- Set to allow resizable window
FLAG_WINDOW_UNDECORATED = 8, -- Set to disable window decoration (frame and buttons)
FLAG_WINDOW_TRANSPARENT = 16, -- Set to allow transparent window
FLAG_WINDOW_HIDDEN = 128, -- Set to create the window initially hidden
FLAG_WINDOW_ALWAYS_RUN = 256, -- Set to allow windows running while minimized
FLAG_MSAA_4X_HINT = 32, -- Set to try enabling MSAA 4X
FLAG_VSYNC_HINT = 64, -- Set to try enabling V-Sync on GPU
}
-- Trace log type
global TraceLogType = @enum {
LOG_ALL = 0, -- Display all logs
LOG_TRACE,
LOG_DEBUG,
LOG_INFO,
LOG_WARNING,
LOG_ERROR,
LOG_FATAL,
LOG_NONE, -- Disable logging
}
-- Keyboard keys
global KeyboardKey = @enum {
-- Alphanumeric keys
KEY_APOSTROPHE = 39,
KEY_COMMA = 44,
KEY_MINUS = 45,
KEY_PERIOD = 46,
KEY_SLASH = 47,
KEY_ZERO = 48,
KEY_ONE = 49,
KEY_TWO = 50,
KEY_THREE = 51,
KEY_FOUR = 52,
KEY_FIVE = 53,
KEY_SIX = 54,
KEY_SEVEN = 55,
KEY_EIGHT = 56,
KEY_NINE = 57,
KEY_SEMICOLON = 59,
KEY_EQUAL = 61,
KEY_A = 65,
KEY_B = 66,
KEY_C = 67,
KEY_D = 68,
KEY_E = 69,
KEY_F = 70,
KEY_G = 71,
KEY_H = 72,
KEY_I = 73,
KEY_J = 74,
KEY_K = 75,
KEY_L = 76,
KEY_M = 77,
KEY_N = 78,
KEY_O = 79,
KEY_P = 80,
KEY_Q = 81,
KEY_R = 82,
KEY_S = 83,
KEY_T = 84,
KEY_U = 85,
KEY_V = 86,
KEY_W = 87,
KEY_X = 88,
KEY_Y = 89,
KEY_Z = 90,
-- Function keys
KEY_SPACE = 32,
KEY_ESCAPE = 256,
KEY_ENTER = 257,
KEY_TAB = 258,
KEY_BACKSPACE = 259,
KEY_INSERT = 260,
KEY_DELETE = 261,
KEY_RIGHT = 262,
KEY_LEFT = 263,
KEY_DOWN = 264,
KEY_UP = 265,
KEY_PAGE_UP = 266,
KEY_PAGE_DOWN = 267,
KEY_HOME = 268,
KEY_END = 269,
KEY_CAPS_LOCK = 280,
KEY_SCROLL_LOCK = 281,
KEY_NUM_LOCK = 282,
KEY_PRINT_SCREEN = 283,
KEY_PAUSE = 284,
KEY_F1 = 290,
KEY_F2 = 291,
KEY_F3 = 292,
KEY_F4 = 293,
KEY_F5 = 294,
KEY_F6 = 295,
KEY_F7 = 296,
KEY_F8 = 297,
KEY_F9 = 298,
KEY_F10 = 299,
KEY_F11 = 300,
KEY_F12 = 301,
KEY_LEFT_SHIFT = 340,
KEY_LEFT_CONTROL = 341,
KEY_LEFT_ALT = 342,
KEY_LEFT_SUPER = 343,
KEY_RIGHT_SHIFT = 344,
KEY_RIGHT_CONTROL = 345,
KEY_RIGHT_ALT = 346,
KEY_RIGHT_SUPER = 347,
KEY_KB_MENU = 348,
KEY_LEFT_BRACKET = 91,
KEY_BACKSLASH = 92,
KEY_RIGHT_BRACKET = 93,
KEY_GRAVE = 96,
-- Keypad keys
KEY_KP_0 = 320,
KEY_KP_1 = 321,
KEY_KP_2 = 322,
KEY_KP_3 = 323,
KEY_KP_4 = 324,
KEY_KP_5 = 325,
KEY_KP_6 = 326,
KEY_KP_7 = 327,
KEY_KP_8 = 328,
KEY_KP_9 = 329,
KEY_KP_DECIMAL = 330,
KEY_KP_DIVIDE = 331,
KEY_KP_MULTIPLY = 332,
KEY_KP_SUBTRACT = 333,
KEY_KP_ADD = 334,
KEY_KP_ENTER = 335,
KEY_KP_EQUAL = 336,
}
-- Android buttons
global AndroidButton = @enum {
KEY_BACK = 4,
KEY_MENU = 82,
KEY_VOLUME_UP = 24,
KEY_VOLUME_DOWN = 25,
}
-- Mouse buttons
global MouseButton = @enum {
MOUSE_LEFT_BUTTON = 0,
MOUSE_RIGHT_BUTTON = 1,
MOUSE_MIDDLE_BUTTON = 2,
}
-- Gamepad number
global GamepadNumber = @enum {
GAMEPAD_PLAYER1 = 0,
GAMEPAD_PLAYER2 = 1,
GAMEPAD_PLAYER3 = 2,
GAMEPAD_PLAYER4 = 3,
}
-- Gamepad Buttons
global GamepadButton = @enum {
-- This is here just for error checking
GAMEPAD_BUTTON_UNKNOWN = 0,
-- This is normally a DPAD
GAMEPAD_BUTTON_LEFT_FACE_UP,
GAMEPAD_BUTTON_LEFT_FACE_RIGHT,
GAMEPAD_BUTTON_LEFT_FACE_DOWN,
GAMEPAD_BUTTON_LEFT_FACE_LEFT,
-- This normally corresponds with PlayStation and Xbox controllers
-- XBOX: [Y,X,A,B]
-- PS3: [Triangle,Square,Cross,Circle]
-- No support for 6 button controllers though..
GAMEPAD_BUTTON_RIGHT_FACE_UP,
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT,
GAMEPAD_BUTTON_RIGHT_FACE_DOWN,
GAMEPAD_BUTTON_RIGHT_FACE_LEFT,
-- Triggers
GAMEPAD_BUTTON_LEFT_TRIGGER_1,
GAMEPAD_BUTTON_LEFT_TRIGGER_2,
GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
GAMEPAD_BUTTON_RIGHT_TRIGGER_2,
-- These are buttons in the center of the gamepad
GAMEPAD_BUTTON_MIDDLE_LEFT, -- PS3 Select
GAMEPAD_BUTTON_MIDDLE, -- PS Button/XBOX Button
GAMEPAD_BUTTON_MIDDLE_RIGHT, -- PS3 Start
-- These are the joystick press in buttons
GAMEPAD_BUTTON_LEFT_THUMB,
GAMEPAD_BUTTON_RIGHT_THUMB,
}
global GamepadAxis = @enum {
-- This is here just for error checking
GAMEPAD_AXIS_UNKNOWN = 0,
-- Left stick
GAMEPAD_AXIS_LEFT_X,
GAMEPAD_AXIS_LEFT_Y,
-- Right stick
GAMEPAD_AXIS_RIGHT_X,
GAMEPAD_AXIS_RIGHT_Y,
-- Pressure levels for the back triggers
GAMEPAD_AXIS_LEFT_TRIGGER, -- [1..-1] (pressure-level)
GAMEPAD_AXIS_RIGHT_TRIGGER, -- [1..-1] (pressure-level)
}
-- Shader location point type
global ShaderLocationIndex = @enum {
LOC_VERTEX_POSITION = 0,
LOC_VERTEX_TEXCOORD01,
LOC_VERTEX_TEXCOORD02,
LOC_VERTEX_NORMAL,
LOC_VERTEX_TANGENT,
LOC_VERTEX_COLOR,
LOC_MATRIX_MVP,
LOC_MATRIX_MODEL,
LOC_MATRIX_VIEW,
LOC_MATRIX_PROJECTION,
LOC_VECTOR_VIEW,
LOC_COLOR_DIFFUSE,
LOC_COLOR_SPECULAR,
LOC_COLOR_AMBIENT,
LOC_MAP_ALBEDO, -- LOC_MAP_DIFFUSE
LOC_MAP_METALNESS, -- LOC_MAP_SPECULAR
LOC_MAP_NORMAL,
LOC_MAP_ROUGHNESS,
LOC_MAP_OCCLUSION,
LOC_MAP_EMISSION,
LOC_MAP_HEIGHT,
LOC_MAP_CUBEMAP,
LOC_MAP_IRRADIANCE,
LOC_MAP_PREFILTER,
LOC_MAP_BRDF,
}
-- ignored, because I don't know how this should be handled:
-- #define LOC_MAP_DIFFUSE LOC_MAP_ALBEDO
-- #define LOC_MAP_SPECULAR LOC_MAP_METALNESS
-- Shader uniform data types
global ShaderUniformDataType = @enum {
UNIFORM_FLOAT = 0,
UNIFORM_VEC2,
UNIFORM_VEC3,
UNIFORM_VEC4,
UNIFORM_INT,
UNIFORM_IVEC2,
UNIFORM_IVEC3,
UNIFORM_IVEC4,
UNIFORM_SAMPLER2D,
}
-- Material map type
global MaterialMapType = @enum {
MAP_ALBEDO = 0, -- MAP_DIFFUSE
MAP_METALNESS = 1, -- MAP_SPECULAR
MAP_NORMAL = 2,
MAP_ROUGHNESS = 3,
MAP_OCCLUSION,
MAP_EMISSION,
MAP_HEIGHT,
MAP_CUBEMAP, -- NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_IRRADIANCE, -- NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_PREFILTER, -- NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_BRDF,
}
-- ignored, because I don't know how this should be handled:
-- #define MAP_DIFFUSE MAP_ALBEDO
-- #define MAP_SPECULAR MAP_METALNESS
-- Pixel formats
-- NOTE: Support depends on OpenGL version and platform
global PixelFormat = @enum {
UNCOMPRESSED_GRAYSCALE = 1, -- 8 bit per pixel (no alpha)
UNCOMPRESSED_GRAY_ALPHA, -- 8*2 bpp (2 channels)
UNCOMPRESSED_R5G6B5, -- 16 bpp
UNCOMPRESSED_R8G8B8, -- 24 bpp
UNCOMPRESSED_R5G5B5A1, -- 16 bpp (1 bit alpha)
UNCOMPRESSED_R4G4B4A4, -- 16 bpp (4 bit alpha)
UNCOMPRESSED_R8G8B8A8, -- 32 bpp
UNCOMPRESSED_R32, -- 32 bpp (1 channel - float)
UNCOMPRESSED_R32G32B32, -- 32*3 bpp (3 channels - float)
UNCOMPRESSED_R32G32B32A32, -- 32*4 bpp (4 channels - float)
COMPRESSED_DXT1_RGB, -- 4 bpp (no alpha)
COMPRESSED_DXT1_RGBA, -- 4 bpp (1 bit alpha)
COMPRESSED_DXT3_RGBA, -- 8 bpp
COMPRESSED_DXT5_RGBA, -- 8 bpp
COMPRESSED_ETC1_RGB, -- 4 bpp
COMPRESSED_ETC2_RGB, -- 4 bpp
COMPRESSED_ETC2_EAC_RGBA, -- 8 bpp
COMPRESSED_PVRT_RGB, -- 4 bpp
COMPRESSED_PVRT_RGBA, -- 4 bpp
COMPRESSED_ASTC_4x4_RGBA, -- 8 bpp
COMPRESSED_ASTC_8x8_RGBA, -- 2 bpp
}
-- Texture parameters: filter mode
-- NOTE 1: Filtering considers mipmaps if available in the texture
-- NOTE 2: Filter is accordingly set for minification and magnification
global TextureFilterMode = @enum {
FILTER_POINT = 0, -- No filter, just pixel aproximation
FILTER_BILINEAR, -- Linear filtering
FILTER_TRILINEAR, -- Trilinear filtering (linear with mipmaps)
FILTER_ANISOTROPIC_4X, -- Anisotropic filtering 4x
FILTER_ANISOTROPIC_8X, -- Anisotropic filtering 8x
FILTER_ANISOTROPIC_16X, -- Anisotropic filtering 16x
}
-- Cubemap layout type
global CubemapLayoutType = @enum {
CUBEMAP_AUTO_DETECT = 0, -- Automatically detect layout type
CUBEMAP_LINE_VERTICAL, -- Layout is defined by a vertical line with faces
CUBEMAP_LINE_HORIZONTAL, -- Layout is defined by an horizontal line with faces
CUBEMAP_CROSS_THREE_BY_FOUR, -- Layout is defined by a 3x4 cross with cubemap faces
CUBEMAP_CROSS_FOUR_BY_THREE, -- Layout is defined by a 4x3 cross with cubemap faces
CUBEMAP_PANORAMA, -- Layout is defined by a panorama image (equirectangular map)
}
-- Texture parameters: wrap mode
global TextureWrapMode = @enum {
WRAP_REPEAT = 0, -- Repeats texture in tiled mode
WRAP_CLAMP, -- Clamps texture to edge pixel in tiled mode
WRAP_MIRROR_REPEAT, -- Mirrors and repeats the texture in tiled mode
WRAP_MIRROR_CLAMP, -- Mirrors and clamps to border the texture in tiled mode
}
-- Font type, defines generation method
global FontType = @enum {
FONT_DEFAULT = 0, -- Default font generation, anti-aliased
FONT_BITMAP, -- Bitmap font generation, no anti-aliasing
FONT_SDF, -- SDF font generation, requires external shader
}
-- Color blending modes (pre-defined)
global BlendMode = @enum {
BLEND_ALPHA = 0, -- Blend textures considering alpha (default)
BLEND_ADDITIVE, -- Blend textures adding colors
BLEND_MULTIPLIED, -- Blend textures multiplying colors
}
-- Gestures type
-- NOTE: It could be used as flags to enable only some gestures
global GestureType = @enum {
GESTURE_NONE = 0,
GESTURE_TAP = 1,
GESTURE_DOUBLETAP = 2,
GESTURE_HOLD = 4,
GESTURE_DRAG = 8,
GESTURE_SWIPE_RIGHT = 16,
GESTURE_SWIPE_LEFT = 32,
GESTURE_SWIPE_UP = 64,
GESTURE_SWIPE_DOWN = 128,
GESTURE_PINCH_IN = 256,
GESTURE_PINCH_OUT = 512,
}
-- Camera system modes
global CameraMode = @enum {
CAMERA_CUSTOM = 0,
CAMERA_FREE,
CAMERA_ORBITAL,
CAMERA_FIRST_PERSON,
CAMERA_THIRD_PERSON,
}
-- Camera projection modes
global CameraType = @enum {
CAMERA_PERSPECTIVE = 0,
CAMERA_ORTHOGRAPHIC,
}
-- Type of n-patch
global NPatchType = @enum {
NPT_9PATCH = 0, -- Npatch defined by 3x3 tiles
NPT_3PATCH_VERTICAL, -- Npatch defined by 1x3 tiles
NPT_3PATCH_HORIZONTAL, -- Npatch defined by 3x1 tiles
}
-- Callbacks to be implemented by users
-- ------------------------------------------------------------------------------------
-- Global Variables Definition
-- ------------------------------------------------------------------------------------
-- It's lonely here...
-- ------------------------------------------------------------------------------------
-- Window and Graphics Device Functions (Module: core)
-- ------------------------------------------------------------------------------------
-- Window-related functions
function Raylib.InitWindow(width: cint, height: cint, title: cstring): void <cimport'InitWindow', cinclude'<raylib.h>', nodecl> end -- Initialize window and OpenGL context
function Raylib.WindowShouldClose(): boolean <cimport'WindowShouldClose', cinclude'<raylib.h>', nodecl> end -- Check if KEY_ESCAPE pressed or Close icon pressed
function Raylib.CloseWindow(): void <cimport'CloseWindow', cinclude'<raylib.h>', nodecl> end -- Close window and unload OpenGL context
function Raylib.IsWindowReady(): boolean <cimport'IsWindowReady', cinclude'<raylib.h>', nodecl> end -- Check if window has been initialized successfully
function Raylib.IsWindowMinimized(): boolean <cimport'IsWindowMinimized', cinclude'<raylib.h>', nodecl> end -- Check if window has been minimized (or lost focus)
function Raylib.IsWindowResized(): boolean <cimport'IsWindowResized', cinclude'<raylib.h>', nodecl> end -- Check if window has been resized
function Raylib.IsWindowHidden(): boolean <cimport'IsWindowHidden', cinclude'<raylib.h>', nodecl> end -- Check if window is currently hidden
function Raylib.IsWindowFullscreen(): boolean <cimport'IsWindowFullscreen', cinclude'<raylib.h>', nodecl> end -- Check if window is currently fullscreen
function Raylib.ToggleFullscreen(): void <cimport'ToggleFullscreen', cinclude'<raylib.h>', nodecl> end -- Toggle fullscreen mode (only PLATFORM_DESKTOP)
function Raylib.UnhideWindow(): void <cimport'UnhideWindow', cinclude'<raylib.h>', nodecl> end -- Show the window
function Raylib.HideWindow(): void <cimport'HideWindow', cinclude'<raylib.h>', nodecl> end -- Hide the window
function Raylib.SetWindowIcon(image: Image): void <cimport'SetWindowIcon', cinclude'<raylib.h>', nodecl> end -- Set icon for window (only PLATFORM_DESKTOP)
function Raylib.SetWindowTitle(title: cstring): void <cimport'SetWindowTitle', cinclude'<raylib.h>', nodecl> end -- Set title for window (only PLATFORM_DESKTOP)
function Raylib.SetWindowPosition(x: cint, y: cint): void <cimport'SetWindowPosition', cinclude'<raylib.h>', nodecl> end -- Set window position on screen (only PLATFORM_DESKTOP)
function Raylib.SetWindowMonitor(monitor: cint): void <cimport'SetWindowMonitor', cinclude'<raylib.h>', nodecl> end -- Set monitor for the current window (fullscreen mode)
function Raylib.SetWindowMinSize(width: cint, height: cint): void <cimport'SetWindowMinSize', cinclude'<raylib.h>', nodecl> end -- Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
function Raylib.SetWindowSize(width: cint, height: cint): void <cimport'SetWindowSize', cinclude'<raylib.h>', nodecl> end -- Set window dimensions
function Raylib.GetWindowHandle(): pointer <cimport'GetWindowHandle', cinclude'<raylib.h>', nodecl> end -- Get native window handle
function Raylib.GetScreenWidth(): cint <cimport'GetScreenWidth', cinclude'<raylib.h>', nodecl> end -- Get current screen width
function Raylib.GetScreenHeight(): cint <cimport'GetScreenHeight', cinclude'<raylib.h>', nodecl> end -- Get current screen height
function Raylib.GetMonitorCount(): cint <cimport'GetMonitorCount', cinclude'<raylib.h>', nodecl> end -- Get number of connected monitors
function Raylib.GetMonitorWidth(monitor: cint): cint <cimport'GetMonitorWidth', cinclude'<raylib.h>', nodecl> end -- Get primary monitor width
function Raylib.GetMonitorHeight(monitor: cint): cint <cimport'GetMonitorHeight', cinclude'<raylib.h>', nodecl> end -- Get primary monitor height
function Raylib.GetMonitorPhysicalWidth(monitor: cint): cint <cimport'GetMonitorPhysicalWidth', cinclude'<raylib.h>', nodecl> end -- Get primary monitor physical width in millimetres
function Raylib.GetMonitorPhysicalHeight(monitor: cint): cint <cimport'GetMonitorPhysicalHeight', cinclude'<raylib.h>', nodecl> end -- Get primary monitor physical height in millimetres
function Raylib.GetWindowPosition(): Vector2 <cimport'GetWindowPosition', cinclude'<raylib.h>', nodecl> end -- Get window position XY on monitor
function Raylib.GetMonitorName(monitor: cint): cstring <cimport'GetMonitorName', cinclude'<raylib.h>', nodecl> end -- Get the human-readable, UTF-8 encoded name of the primary monitor
function Raylib.GetClipboardText(): cstring <cimport'GetClipboardText', cinclude'<raylib.h>', nodecl> end -- Get clipboard text content
function Raylib.SetClipboardText(text: cstring): void <cimport'SetClipboardText', cinclude'<raylib.h>', nodecl> end -- Set clipboard text content
-- Cursor-related functions
function Raylib.ShowCursor(): void <cimport'ShowCursor', cinclude'<raylib.h>', nodecl> end -- Shows cursor
function Raylib.HideCursor(): void <cimport'HideCursor', cinclude'<raylib.h>', nodecl> end -- Hides cursor
function Raylib.IsCursorHidden(): boolean <cimport'IsCursorHidden', cinclude'<raylib.h>', nodecl> end -- Check if cursor is not visible
function Raylib.EnableCursor(): void <cimport'EnableCursor', cinclude'<raylib.h>', nodecl> end -- Enables cursor (unlock cursor)
function Raylib.DisableCursor(): void <cimport'DisableCursor', cinclude'<raylib.h>', nodecl> end -- Disables cursor (lock cursor)
-- Drawing-related functions
function Raylib.ClearBackground(color: Color): void <cimport'ClearBackground', cinclude'<raylib.h>', nodecl> end -- Set background color (framebuffer clear color)
function Raylib.BeginDrawing(): void <cimport'BeginDrawing', cinclude'<raylib.h>', nodecl> end -- Setup canvas (framebuffer) to start drawing
function Raylib.EndDrawing(): void <cimport'EndDrawing', cinclude'<raylib.h>', nodecl> end -- End canvas drawing and swap buffers (double buffering)
function Raylib.BeginMode2D(camera: Camera2D): void <cimport'BeginMode2D', cinclude'<raylib.h>', nodecl> end -- Initialize 2D mode with custom camera (2D)
function Raylib.EndMode2D(): void <cimport'EndMode2D', cinclude'<raylib.h>', nodecl> end -- Ends 2D mode with custom camera
function Raylib.BeginMode3D(camera: Camera3D): void <cimport'BeginMode3D', cinclude'<raylib.h>', nodecl> end -- Initializes 3D mode with custom camera (3D)
function Raylib.EndMode3D(): void <cimport'EndMode3D', cinclude'<raylib.h>', nodecl> end -- Ends 3D mode and returns to default 2D orthographic mode
function Raylib.BeginTextureMode(target: RenderTexture2D): void <cimport'BeginTextureMode', cinclude'<raylib.h>', nodecl> end -- Initializes render texture for drawing
function Raylib.EndTextureMode(): void <cimport'EndTextureMode', cinclude'<raylib.h>', nodecl> end -- Ends drawing to render texture
function Raylib.BeginScissorMode(x: cint, y: cint, width: cint, height: cint): void <cimport'BeginScissorMode', cinclude'<raylib.h>', nodecl> end -- Begin scissor mode (define screen area for following drawing)
function Raylib.EndScissorMode(): void <cimport'EndScissorMode', cinclude'<raylib.h>', nodecl> end -- End scissor mode
-- Screen-space-related functions
function Raylib.GetMouseRay(mousePosition: Vector2, camera: Camera): Ray <cimport'GetMouseRay', cinclude'<raylib.h>', nodecl> end -- Returns a ray trace from mouse position
function Raylib.GetCameraMatrix(camera: Camera): Matrix <cimport'GetCameraMatrix', cinclude'<raylib.h>', nodecl> end -- Returns camera transform matrix (view matrix)
function Raylib.GetCameraMatrix2D(camera: Camera2D): Matrix <cimport'GetCameraMatrix2D', cinclude'<raylib.h>', nodecl> end -- Returns camera 2d transform matrix
function Raylib.GetWorldToScreen(position: Vector3, camera: Camera): Vector2 <cimport'GetWorldToScreen', cinclude'<raylib.h>', nodecl> end -- Returns the screen space position for a 3d world space position
function Raylib.GetWorldToScreenEx(position: Vector3, camera: Camera, width: cint, height: cint): Vector2 <cimport'GetWorldToScreenEx', cinclude'<raylib.h>', nodecl> end -- Returns size position for a 3d world space position
function Raylib.GetWorldToScreen2D(position: Vector2, camera: Camera2D): Vector2 <cimport'GetWorldToScreen2D', cinclude'<raylib.h>', nodecl> end -- Returns the screen space position for a 2d camera world space position
function Raylib.GetScreenToWorld2D(position: Vector2, camera: Camera2D): Vector2 <cimport'GetScreenToWorld2D', cinclude'<raylib.h>', nodecl> end -- Returns the world space position for a 2d camera screen space position
-- Timing-related functions
function Raylib.SetTargetFPS(fps: cint): void <cimport'SetTargetFPS', cinclude'<raylib.h>', nodecl> end -- Set target FPS (maximum)
function Raylib.GetFPS(): cint <cimport'GetFPS', cinclude'<raylib.h>', nodecl> end -- Returns current FPS
function Raylib.GetFrameTime(): float32 <cimport'GetFrameTime', cinclude'<raylib.h>', nodecl> end -- Returns time in seconds for last frame drawn
function Raylib.GetTime(): float64 <cimport'GetTime', cinclude'<raylib.h>', nodecl> end -- Returns elapsed time in seconds since InitWindow()
-- Color-related functions
function Raylib.ColorToInt(color: Color): cint <cimport'ColorToInt', cinclude'<raylib.h>', nodecl> end -- Returns hexadecimal value for a Color
function Raylib.ColorNormalize(color: Color): Vector4 <cimport'ColorNormalize', cinclude'<raylib.h>', nodecl> end -- Returns color normalized as float [0..1]
function Raylib.ColorFromNormalized(normalized: Vector4): Color <cimport'ColorFromNormalized', cinclude'<raylib.h>', nodecl> end -- Returns color from normalized values [0..1]
function Raylib.ColorToHSV(color: Color): Vector3 <cimport'ColorToHSV', cinclude'<raylib.h>', nodecl> end -- Returns HSV values for a Color
function Raylib.ColorFromHSV(hsv: Vector3): Color <cimport'ColorFromHSV', cinclude'<raylib.h>', nodecl> end -- Returns a Color from HSV values
function Raylib.GetColor(hexValue: cint): Color <cimport'GetColor', cinclude'<raylib.h>', nodecl> end -- Returns a Color struct from hexadecimal value
function Raylib.Fade(color: Color, alpha: float32): Color <cimport'Fade', cinclude'<raylib.h>', nodecl> end -- Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
-- Misc. functions
function Raylib.SetConfigFlags(flags: cuint): void <cimport'SetConfigFlags', cinclude'<raylib.h>', nodecl> end -- Setup window configuration flags (view FLAGS)
function Raylib.SetTraceLogLevel(logType: cint): void <cimport'SetTraceLogLevel', cinclude'<raylib.h>', nodecl> end -- Set the current threshold (minimum) log level
function Raylib.SetTraceLogExit(logType: cint): void <cimport'SetTraceLogExit', cinclude'<raylib.h>', nodecl> end -- Set the exit threshold (minimum) log level
-- function Raylib.SetTraceLogCallback(callback: TraceLogCallback): void <cimport'SetTraceLogCallback', cinclude'<raylib.h>', nodecl> end -- Set a trace log callback to enable custom logging
function Raylib.TraceLog(logType: cint, text: cstring, ...: cvarargs): void <cimport'TraceLog', cinclude'<raylib.h>', nodecl> end -- Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
function Raylib.TakeScreenshot(fileName: cstring): void <cimport'TakeScreenshot', cinclude'<raylib.h>', nodecl> end -- Takes a screenshot of current screen (saved a .png)
function Raylib.GetRandomValue(min: cint, max: cint): cint <cimport'GetRandomValue', cinclude'<raylib.h>', nodecl> end -- Returns a random value between min and max (both included)
-- Files management functions
function Raylib.LoadFileData(fileName: cstring, bytesRead: *cuint): *[0]cuchar <cimport'LoadFileData', cinclude'<raylib.h>', nodecl> end -- Load file data as byte array (read)
function Raylib.SaveFileData(fileName: cstring, data: pointer, bytesToWrite: cuint): void <cimport'SaveFileData', cinclude'<raylib.h>', nodecl> end -- Save data to file from byte array (write)
function Raylib.LoadFileText(fileName: cstring): cstring <cimport'LoadFileText', cinclude'<raylib.h>', nodecl> end -- Load text data from file (read), returns a '\0' terminated string
function Raylib.SaveFileText(fileName: cstring, text: cstring): void <cimport'SaveFileText', cinclude'<raylib.h>', nodecl> end -- Save text data to file (write), string must be '\0' terminated
function Raylib.FileExists(fileName: cstring): boolean <cimport'FileExists', cinclude'<raylib.h>', nodecl> end -- Check if file exists
function Raylib.IsFileExtension(fileName: cstring, ext: cstring): boolean <cimport'IsFileExtension', cinclude'<raylib.h>', nodecl> end -- Check file extension
function Raylib.DirectoryExists(dirPath: cstring): boolean <cimport'DirectoryExists', cinclude'<raylib.h>', nodecl> end -- Check if a directory path exists
function Raylib.GetExtension(fileName: cstring): cstring <cimport'GetExtension', cinclude'<raylib.h>', nodecl> end -- Get pointer to extension for a filename string
function Raylib.GetFileName(filePath: cstring): cstring <cimport'GetFileName', cinclude'<raylib.h>', nodecl> end -- Get pointer to filename for a path string
function Raylib.GetFileNameWithoutExt(filePath: cstring): cstring <cimport'GetFileNameWithoutExt', cinclude'<raylib.h>', nodecl> end -- Get filename string without extension (uses static string)
function Raylib.GetDirectoryPath(filePath: cstring): cstring <cimport'GetDirectoryPath', cinclude'<raylib.h>', nodecl> end -- Get full path for a given fileName with path (uses static string)
function Raylib.GetPrevDirectoryPath(dirPath: cstring): cstring <cimport'GetPrevDirectoryPath', cinclude'<raylib.h>', nodecl> end -- Get previous directory path for a given path (uses static string)
function Raylib.GetWorkingDirectory(): cstring <cimport'GetWorkingDirectory', cinclude'<raylib.h>', nodecl> end -- Get current working directory (uses static string)
function Raylib.GetDirectoryFiles(dirPath: cstring, count: *cint): *[0]cstring <cimport'GetDirectoryFiles', cinclude'<raylib.h>', nodecl> end -- Get filenames in a directory path (memory should be freed)
function Raylib.ClearDirectoryFiles(): void <cimport'ClearDirectoryFiles', cinclude'<raylib.h>', nodecl> end -- Clear directory files paths buffers (free memory)
function Raylib.ChangeDirectory(dir: cstring): boolean <cimport'ChangeDirectory', cinclude'<raylib.h>', nodecl> end -- Change working directory, returns true if success
function Raylib.IsFileDropped(): boolean <cimport'IsFileDropped', cinclude'<raylib.h>', nodecl> end -- Check if a file has been dropped into window
function Raylib.GetDroppedFiles(count: *cint): *[0]cstring <cimport'GetDroppedFiles', cinclude'<raylib.h>', nodecl> end -- Get dropped files names (memory should be freed)
function Raylib.ClearDroppedFiles(): void <cimport'ClearDroppedFiles', cinclude'<raylib.h>', nodecl> end -- Clear dropped files paths buffer (free memory)
function Raylib.GetFileModTime(fileName: cstring): clong <cimport'GetFileModTime', cinclude'<raylib.h>', nodecl> end -- Get file modification time (last write time)
function Raylib.CompressData(data: *[0]cuchar, dataLength: cint, compDataLength: *cint): *[0]cuchar <cimport'CompressData', cinclude'<raylib.h>', nodecl> end -- Compress data (DEFLATE algorythm)
function Raylib.DecompressData(compData: *[0]cuchar, compDataLength: cint, dataLength: *cint): *[0]cuchar <cimport'DecompressData', cinclude'<raylib.h>', nodecl> end -- Decompress data (DEFLATE algorythm)
-- Persistent storage management
function Raylib.SaveStorageValue(position: cuint, value: cint): void <cimport'SaveStorageValue', cinclude'<raylib.h>', nodecl> end -- Save integer value to storage file (to defined position)
function Raylib.LoadStorageValue(position: cuint): cint <cimport'LoadStorageValue', cinclude'<raylib.h>', nodecl> end -- Load integer value from storage file (from defined position)
function Raylib.OpenURL(url: cstring): void <cimport'OpenURL', cinclude'<raylib.h>', nodecl> end -- Open URL with default system browser (if available)
-- ------------------------------------------------------------------------------------
-- Input Handling Functions (Module: core)
-- ------------------------------------------------------------------------------------
-- Input-related functions: keyboard
function Raylib.IsKeyPressed(key: cint): boolean <cimport'IsKeyPressed', cinclude'<raylib.h>', nodecl> end -- Detect if a key has been pressed once
function Raylib.IsKeyDown(key: cint): boolean <cimport'IsKeyDown', cinclude'<raylib.h>', nodecl> end -- Detect if a key is being pressed
function Raylib.IsKeyReleased(key: cint): boolean <cimport'IsKeyReleased', cinclude'<raylib.h>', nodecl> end -- Detect if a key has been released once
function Raylib.IsKeyUp(key: cint): boolean <cimport'IsKeyUp', cinclude'<raylib.h>', nodecl> end -- Detect if a key is NOT being pressed
function Raylib.SetExitKey(key: cint): void <cimport'SetExitKey', cinclude'<raylib.h>', nodecl> end -- Set a custom key to exit program (default is ESC)
function Raylib.GetKeyPressed(): cint <cimport'GetKeyPressed', cinclude'<raylib.h>', nodecl> end -- Get key pressed, call it multiple times for chars queued
-- Input-related functions: gamepads
function Raylib.IsGamepadAvailable(gamepad: cint): boolean <cimport'IsGamepadAvailable', cinclude'<raylib.h>', nodecl> end -- Detect if a gamepad is available
function Raylib.IsGamepadName(gamepad: cint, name: cstring): boolean <cimport'IsGamepadName', cinclude'<raylib.h>', nodecl> end -- Check gamepad name (if available)
function Raylib.GetGamepadName(gamepad: cint): cstring <cimport'GetGamepadName', cinclude'<raylib.h>', nodecl> end -- Return gamepad internal name id
function Raylib.IsGamepadButtonPressed(gamepad: cint, button: cint): boolean <cimport'IsGamepadButtonPressed', cinclude'<raylib.h>', nodecl> end -- Detect if a gamepad button has been pressed once
function Raylib.IsGamepadButtonDown(gamepad: cint, button: cint): boolean <cimport'IsGamepadButtonDown', cinclude'<raylib.h>', nodecl> end -- Detect if a gamepad button is being pressed
function Raylib.IsGamepadButtonReleased(gamepad: cint, button: cint): boolean <cimport'IsGamepadButtonReleased', cinclude'<raylib.h>', nodecl> end -- Detect if a gamepad button has been released once
function Raylib.IsGamepadButtonUp(gamepad: cint, button: cint): boolean <cimport'IsGamepadButtonUp', cinclude'<raylib.h>', nodecl> end -- Detect if a gamepad button is NOT being pressed
function Raylib.GetGamepadButtonPressed(): cint <cimport'GetGamepadButtonPressed', cinclude'<raylib.h>', nodecl> end -- Get the last gamepad button pressed
function Raylib.GetGamepadAxisCount(gamepad: cint): cint <cimport'GetGamepadAxisCount', cinclude'<raylib.h>', nodecl> end -- Return gamepad axis count for a gamepad
function Raylib.GetGamepadAxisMovement(gamepad: cint, axis: cint): float32 <cimport'GetGamepadAxisMovement', cinclude'<raylib.h>', nodecl> end -- Return axis movement value for a gamepad axis
-- Input-related functions: mouse
function Raylib.IsMouseButtonPressed(button: cint): boolean <cimport'IsMouseButtonPressed', cinclude'<raylib.h>', nodecl> end -- Detect if a mouse button has been pressed once
function Raylib.IsMouseButtonDown(button: cint): boolean <cimport'IsMouseButtonDown', cinclude'<raylib.h>', nodecl> end -- Detect if a mouse button is being pressed
function Raylib.IsMouseButtonReleased(button: cint): boolean <cimport'IsMouseButtonReleased', cinclude'<raylib.h>', nodecl> end -- Detect if a mouse button has been released once
function Raylib.IsMouseButtonUp(button: cint): boolean <cimport'IsMouseButtonUp', cinclude'<raylib.h>', nodecl> end -- Detect if a mouse button is NOT being pressed
function Raylib.GetMouseX(): cint <cimport'GetMouseX', cinclude'<raylib.h>', nodecl> end -- Returns mouse position X
function Raylib.GetMouseY(): cint <cimport'GetMouseY', cinclude'<raylib.h>', nodecl> end -- Returns mouse position Y
function Raylib.GetMousePosition(): Vector2 <cimport'GetMousePosition', cinclude'<raylib.h>', nodecl> end -- Returns mouse position XY
function Raylib.SetMousePosition(x: cint, y: cint): void <cimport'SetMousePosition', cinclude'<raylib.h>', nodecl> end -- Set mouse position XY
function Raylib.SetMouseOffset(offsetX: cint, offsetY: cint): void <cimport'SetMouseOffset', cinclude'<raylib.h>', nodecl> end -- Set mouse offset
function Raylib.SetMouseScale(scaleX: float32, scaleY: float32): void <cimport'SetMouseScale', cinclude'<raylib.h>', nodecl> end -- Set mouse scaling
function Raylib.GetMouseWheelMove(): cint <cimport'GetMouseWheelMove', cinclude'<raylib.h>', nodecl> end -- Returns mouse wheel movement Y
-- Input-related functions: touch
function Raylib.GetTouchX(): cint <cimport'GetTouchX', cinclude'<raylib.h>', nodecl> end -- Returns touch position X for touch point 0 (relative to screen size)
function Raylib.GetTouchY(): cint <cimport'GetTouchY', cinclude'<raylib.h>', nodecl> end -- Returns touch position Y for touch point 0 (relative to screen size)
function Raylib.GetTouchPosition(index: cint): Vector2 <cimport'GetTouchPosition', cinclude'<raylib.h>', nodecl> end -- Returns touch position XY for a touch point index (relative to screen size)
-- ------------------------------------------------------------------------------------
-- Gestures and Touch Handling Functions (Module: gestures)
-- ------------------------------------------------------------------------------------
function Raylib.SetGesturesEnabled(gestureFlags: cuint): void <cimport'SetGesturesEnabled', cinclude'<raylib.h>', nodecl> end -- Enable a set of gestures using flags
function Raylib.IsGestureDetected(gesture: cint): boolean <cimport'IsGestureDetected', cinclude'<raylib.h>', nodecl> end -- Check if a gesture have been detected
function Raylib.GetGestureDetected(): cint <cimport'GetGestureDetected', cinclude'<raylib.h>', nodecl> end -- Get latest detected gesture
function Raylib.GetTouchPointsCount(): cint <cimport'GetTouchPointsCount', cinclude'<raylib.h>', nodecl> end -- Get touch points count
function Raylib.GetGestureHoldDuration(): float32 <cimport'GetGestureHoldDuration', cinclude'<raylib.h>', nodecl> end -- Get gesture hold time in milliseconds
function Raylib.GetGestureDragVector(): Vector2 <cimport'GetGestureDragVector', cinclude'<raylib.h>', nodecl> end -- Get gesture drag vector
function Raylib.GetGestureDragAngle(): float32 <cimport'GetGestureDragAngle', cinclude'<raylib.h>', nodecl> end -- Get gesture drag angle
function Raylib.GetGesturePinchVector(): Vector2 <cimport'GetGesturePinchVector', cinclude'<raylib.h>', nodecl> end -- Get gesture pinch delta
function Raylib.GetGesturePinchAngle(): float32 <cimport'GetGesturePinchAngle', cinclude'<raylib.h>', nodecl> end -- Get gesture pinch angle
-- ------------------------------------------------------------------------------------
-- Camera System Functions (Module: camera)
-- ------------------------------------------------------------------------------------
function Raylib.SetCameraMode(camera: Camera, mode: cint): void <cimport'SetCameraMode', cinclude'<raylib.h>', nodecl> end -- Set camera mode (multiple camera modes available)
function Camera.SetMode(camera: Camera, mode: cint): void <cimport'SetCameraMode', cinclude'<raylib.h>', nodecl> end -- Set camera mode (multiple camera modes available)
function Raylib.UpdateCamera(camera: *Camera): void <cimport'UpdateCamera', cinclude'<raylib.h>', nodecl> end -- Update camera position for selected mode
function Camera.Update(camera: *Camera): void <cimport'UpdateCamera', cinclude'<raylib.h>', nodecl> end -- Update camera position for selected mode
function Raylib.SetCameraPanControl(panKey: cint): void <cimport'SetCameraPanControl', cinclude'<raylib.h>', nodecl> end -- Set camera pan key to combine with mouse movement (free camera)
function Raylib.SetCameraAltControl(altKey: cint): void <cimport'SetCameraAltControl', cinclude'<raylib.h>', nodecl> end -- Set camera alt key to combine with mouse movement (free camera)
function Raylib.SetCameraSmoothZoomControl(szKey: cint): void <cimport'SetCameraSmoothZoomControl', cinclude'<raylib.h>', nodecl> end -- Set camera smooth zoom key to combine with mouse (free camera)
function Raylib.SetCameraMoveControls(frontKey: cint, backKey: cint, rightKey: cint, leftKey: cint, upKey: cint, downKey: cint): void <cimport'SetCameraMoveControls', cinclude'<raylib.h>', nodecl> end -- Set camera move controls (1st person and 3rd person cameras)
-- ------------------------------------------------------------------------------------
-- Basic Shapes Drawing Functions (Module: shapes)
-- ------------------------------------------------------------------------------------
-- Basic shapes drawing functions
function Raylib.DrawPixel(posX: cint, posY: cint, color: Color): void <cimport'DrawPixel', cinclude'<raylib.h>', nodecl> end -- Draw a pixel
function Raylib.DrawPixelV(position: Vector2, color: Color): void <cimport'DrawPixelV', cinclude'<raylib.h>', nodecl> end -- Draw a pixel (Vector version)
function Raylib.DrawLine(startPosX: cint, startPosY: cint, endPosX: cint, endPosY: cint, color: Color): void <cimport'DrawLine', cinclude'<raylib.h>', nodecl> end -- Draw a line
function Raylib.DrawLineV(startPos: Vector2, endPos: Vector2, color: Color): void <cimport'DrawLineV', cinclude'<raylib.h>', nodecl> end -- Draw a line (Vector version)
function Raylib.DrawLineEx(startPos: Vector2, endPos: Vector2, thick: float32, color: Color): void <cimport'DrawLineEx', cinclude'<raylib.h>', nodecl> end -- Draw a line defining thickness
function Raylib.DrawLineBezier(startPos: Vector2, endPos: Vector2, thick: float32, color: Color): void <cimport'DrawLineBezier', cinclude'<raylib.h>', nodecl> end -- Draw a line using cubic-bezier curves in-out
function Raylib.DrawLineStrip(points: *[0]Vector2, numPoints: cint, color: Color): void <cimport'DrawLineStrip', cinclude'<raylib.h>', nodecl> end -- Draw lines sequence
function Raylib.DrawCircle(centerX: cint, centerY: cint, radius: float32, color: Color): void <cimport'DrawCircle', cinclude'<raylib.h>', nodecl> end -- Draw a color-filled circle
function Raylib.DrawCircleSector(center: Vector2, radius: float32, startAngle: cint, endAngle: cint, segments: cint, color: Color): void <cimport'DrawCircleSector', cinclude'<raylib.h>', nodecl> end -- Draw a piece of a circle
function Raylib.DrawCircleSectorLines(center: Vector2, radius: float32, startAngle: cint, endAngle: cint, segments: cint, color: Color): void <cimport'DrawCircleSectorLines', cinclude'<raylib.h>', nodecl> end -- Draw circle sector outline
function Raylib.DrawCircleGradient(centerX: cint, centerY: cint, radius: float32, color1: Color, color2: Color): void <cimport'DrawCircleGradient', cinclude'<raylib.h>', nodecl> end -- Draw a gradient-filled circle
function Raylib.DrawCircleV(center: Vector2, radius: float32, color: Color): void <cimport'DrawCircleV', cinclude'<raylib.h>', nodecl> end -- Draw a color-filled circle (Vector version)
function Raylib.DrawCircleLines(centerX: cint, centerY: cint, radius: float32, color: Color): void <cimport'DrawCircleLines', cinclude'<raylib.h>', nodecl> end -- Draw circle outline
function Raylib.DrawEllipse(centerX: cint, centerY: cint, radiusH: float32, radiusV: float32, color: Color): void <cimport'DrawEllipse', cinclude'<raylib.h>', nodecl> end -- Draw ellipse
function Raylib.DrawEllipseLines(centerX: cint, centerY: cint, radiusH: float32, radiusV: float32, color: Color): void <cimport'DrawEllipseLines', cinclude'<raylib.h>', nodecl> end -- Draw ellipse outline
function Raylib.DrawRing(center: Vector2, innerRadius: float32, outerRadius: float32, startAngle: cint, endAngle: cint, segments: cint, color: Color): void <cimport'DrawRing', cinclude'<raylib.h>', nodecl> end -- Draw ring
function Raylib.DrawRingLines(center: Vector2, innerRadius: float32, outerRadius: float32, startAngle: cint, endAngle: cint, segments: cint, color: Color): void <cimport'DrawRingLines', cinclude'<raylib.h>', nodecl> end -- Draw ring outline
function Raylib.DrawRectangle(posX: cint, posY: cint, width: cint, height: cint, color: Color): void <cimport'DrawRectangle', cinclude'<raylib.h>', nodecl> end -- Draw a color-filled rectangle
function Raylib.DrawRectangleV(position: Vector2, size: Vector2, color: Color): void <cimport'DrawRectangleV', cinclude'<raylib.h>', nodecl> end -- Draw a color-filled rectangle (Vector version)
function Raylib.DrawRectangleRec(rec: Rectangle, color: Color): void <cimport'DrawRectangleRec', cinclude'<raylib.h>', nodecl> end -- Draw a color-filled rectangle
function Raylib.DrawRectanglePro(rec: Rectangle, origin: Vector2, rotation: float32, color: Color): void <cimport'DrawRectanglePro', cinclude'<raylib.h>', nodecl> end -- Draw a color-filled rectangle with pro parameters
function Raylib.DrawRectangleGradientV(posX: cint, posY: cint, width: cint, height: cint, color1: Color, color2: Color): void <cimport'DrawRectangleGradientV', cinclude'<raylib.h>', nodecl> end -- Draw a vertical-gradient-filled rectangle
function Raylib.DrawRectangleGradientH(posX: cint, posY: cint, width: cint, height: cint, color1: Color, color2: Color): void <cimport'DrawRectangleGradientH', cinclude'<raylib.h>', nodecl> end -- Draw a horizontal-gradient-filled rectangle
function Raylib.DrawRectangleGradientEx(rec: Rectangle, col1: Color, col2: Color, col3: Color, col4: Color): void <cimport'DrawRectangleGradientEx', cinclude'<raylib.h>', nodecl> end -- Draw a gradient-filled rectangle with custom vertex colors
function Raylib.DrawRectangleLines(posX: cint, posY: cint, width: cint, height: cint, color: Color): void <cimport'DrawRectangleLines', cinclude'<raylib.h>', nodecl> end -- Draw rectangle outline
function Raylib.DrawRectangleLinesEx(rec: Rectangle, lineThick: cint, color: Color): void <cimport'DrawRectangleLinesEx', cinclude'<raylib.h>', nodecl> end -- Draw rectangle outline with extended parameters
function Raylib.DrawRectangleRounded(rec: Rectangle, roundness: float32, segments: cint, color: Color): void <cimport'DrawRectangleRounded', cinclude'<raylib.h>', nodecl> end -- Draw rectangle with rounded edges
function Raylib.DrawRectangleRoundedLines(rec: Rectangle, roundness: float32, segments: cint, lineThick: cint, color: Color): void <cimport'DrawRectangleRoundedLines', cinclude'<raylib.h>', nodecl> end -- Draw rectangle with rounded edges outline
function Raylib.DrawTriangle(v1: Vector2, v2: Vector2, v3: Vector2, color: Color): void <cimport'DrawTriangle', cinclude'<raylib.h>', nodecl> end -- Draw a color-filled triangle (vertex in counter-clockwise order!)
function Raylib.DrawTriangleLines(v1: Vector2, v2: Vector2, v3: Vector2, color: Color): void <cimport'DrawTriangleLines', cinclude'<raylib.h>', nodecl> end -- Draw triangle outline (vertex in counter-clockwise order!)
function Raylib.DrawTriangleFan(points: *Vector2, numPoints: cint, color: Color): void <cimport'DrawTriangleFan', cinclude'<raylib.h>', nodecl> end -- Draw a triangle fan defined by points (first vertex is the center)
function Raylib.DrawTriangleStrip(points: *Vector2, pointsCount: cint, color: Color): void <cimport'DrawTriangleStrip', cinclude'<raylib.h>', nodecl> end -- Draw a triangle strip defined by points
function Raylib.DrawPoly(center: Vector2, sides: cint, radius: float32, rotation: float32, color: Color): void <cimport'DrawPoly', cinclude'<raylib.h>', nodecl> end -- Draw a regular polygon (Vector version)
function Raylib.DrawPolyLines(center: Vector2, sides: cint, radius: float32, rotation: float32, color: Color): void <cimport'DrawPolyLines', cinclude'<raylib.h>', nodecl> end -- Draw a polygon outline of n sides
-- Basic shapes collision detection functions
function Raylib.CheckCollisionRecs(rec1: Rectangle, rec2: Rectangle): boolean <cimport'CheckCollisionRecs', cinclude'<raylib.h>', nodecl> end -- Check collision between two rectangles
function Raylib.CheckCollisionCircles(center1: Vector2, radius1: float32, center2: Vector2, radius2: float32): boolean <cimport'CheckCollisionCircles', cinclude'<raylib.h>', nodecl> end -- Check collision between two circles
function Raylib.CheckCollisionCircleRec(center: Vector2, radius: float32, rec: Rectangle): boolean <cimport'CheckCollisionCircleRec', cinclude'<raylib.h>', nodecl> end -- Check collision between circle and rectangle
function Raylib.GetCollisionRec(rec1: Rectangle, rec2: Rectangle): Rectangle <cimport'GetCollisionRec', cinclude'<raylib.h>', nodecl> end -- Get collision rectangle for two rectangles collision
function Raylib.CheckCollisionPointRec(point: Vector2, rec: Rectangle): boolean <cimport'CheckCollisionPointRec', cinclude'<raylib.h>', nodecl> end -- Check if point is inside rectangle
function Raylib.CheckCollisionPointCircle(point: Vector2, center: Vector2, radius: float32): boolean <cimport'CheckCollisionPointCircle', cinclude'<raylib.h>', nodecl> end -- Check if point is inside circle
function Raylib.CheckCollisionPointTriangle(point: Vector2, p1: Vector2, p2: Vector2, p3: Vector2): boolean <cimport'CheckCollisionPointTriangle', cinclude'<raylib.h>', nodecl> end -- Check if point is inside a triangle
-- ------------------------------------------------------------------------------------
-- Texture Loading and Drawing Functions (Module: textures)
-- ------------------------------------------------------------------------------------
-- Image loading functions
-- NOTE: This functions do not require GPU access