-
Notifications
You must be signed in to change notification settings - Fork 1
/
ray.zig
2214 lines (2118 loc) · 88.2 KB
/
ray.zig
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
// use @cImport({ @cInclude("raylib.h"); });
// pub const lib = @cImport({
// // @cDefine("_NO_CRT_STDIO_INLINE", "1");
// // @cDefine("_GNU_SOURCE", "1");
// // @cDefine("PLATFORM", "PLATFORM_DESKTOP");
// @cInclude("raylib.h");
// });
pub fn CLiteral(r: u8, g: u8, b: u8, a: u8) Color {
return Color { .r = r, .g = g, .b = b, .a = a };
}
// pub const LIGHTGRAY =
pub const LIGHTGRAY = CLiteral(200, 200, 200, 255); // Light Gray
pub const GRAY = CLiteral(130, 130, 130, 255); // Gray
pub const DARKGRAY = CLiteral(80, 80, 80, 255); // Dark Gray
pub const YELLOW = CLiteral(253, 249, 0, 255); // Yellow
pub const GOLD = CLiteral(255, 203, 0, 255); // Gold
pub const ORANGE = CLiteral(255, 161, 0, 255); // Orange
pub const PINK = CLiteral(255, 109, 194, 255); // Pink
pub const RED = CLiteral(230, 41, 55, 255); // Red
pub const MAROON = CLiteral(190, 33, 55, 255); // Maroon
pub const GREEN = CLiteral(0, 228, 48, 255); // Green
pub const LIME = CLiteral(0, 158, 47, 255); // Lime
pub const DARKGREEN = CLiteral(0, 117, 44, 255); // Dark Green
pub const SKYBLUE = CLiteral(102, 191, 255, 255); // Sky Blue
pub const BLUE = CLiteral(0, 121, 241, 255); // Blue
pub const DARKBLUE = CLiteral(0, 82, 172, 255); // Dark Blue
pub const PURPLE = CLiteral(200, 122, 255, 255); // Purple
pub const VIOLET = CLiteral(135, 60, 190, 255); // Violet
pub const DARKPURPLE = CLiteral(112, 31, 126, 255); // Dark Purple
pub const BEIGE = CLiteral(211, 176, 131, 255); // Beige
pub const BROWN = CLiteral(127, 106, 79, 255); // Brown
pub const DARKBROWN = CLiteral(76, 63, 47, 255); // Dark Brown
pub const WHITE = CLiteral(255, 255, 255, 255); // White
pub const BLACK = CLiteral(0, 0, 0, 255); // Black
pub const BLANK = CLiteral(0, 0, 0, 0); // Blank (Transparent)
pub const MAGENTA = CLiteral(255, 0, 255, 255); // Magenta
pub const RAYWHITE = CLiteral(245, 245, 245, 255); // My own White (raylib logo)
pub fn CheckCollisionRecs(rec1: Rectangle, rec2: Rectangle)
bool {
return
(rec1.x <= (rec2.x + rec2.width) and
(rec1.x + rec1.width) >= rec2.x) and
(rec1.y <= (rec2.y + rec2.height) and
(rec1.y + rec1.height) >= rec2.y);
}
// from cInclude
pub const struct___va_list_tag = extern struct {
gp_offset: c_uint,
fp_offset: c_uint,
overflow_arg_area: ?*c_void,
reg_save_area: ?*c_void,
};
pub const __builtin_va_list = [1]struct___va_list_tag;
pub const va_list = __builtin_va_list;
pub const __gnuc_va_list = __builtin_va_list;
pub const struct_Vector2 = extern struct {
x: f32,
y: f32,
};
pub const Vector2 = struct_Vector2;
pub const struct_Vector3 = extern struct {
x: f32,
y: f32,
z: f32,
};
pub const Vector3 = struct_Vector3;
pub const struct_Vector4 = extern struct {
x: f32,
y: f32,
z: f32,
w: f32,
};
pub const Vector4 = struct_Vector4;
pub const Quaternion = Vector4;
pub const struct_Matrix = extern struct {
m0: f32,
m4: f32,
m8: f32,
m12: f32,
m1: f32,
m5: f32,
m9: f32,
m13: f32,
m2: f32,
m6: f32,
m10: f32,
m14: f32,
m3: f32,
m7: f32,
m11: f32,
m15: f32,
};
pub const Matrix = struct_Matrix;
pub const struct_Color = extern struct {
r: u8,
g: u8,
b: u8,
a: u8,
};
pub const Color = struct_Color;
pub const Rectangle = struct {
x: f32,
y: f32,
width: f32,
height: f32,
};
// pub const Rectangle = struct_Rectangle;
pub const struct_Image = extern struct {
data: ?*c_void,
width: c_int,
height: c_int,
mipmaps: c_int,
format: c_int,
};
pub const Image = struct_Image;
pub const struct_Texture2D = extern struct {
id: c_uint,
width: c_int,
height: c_int,
mipmaps: c_int,
format: c_int,
};
pub const Texture2D = struct_Texture2D;
pub const Texture = Texture2D;
pub const TextureCubemap = Texture2D;
pub const struct_RenderTexture2D = extern struct {
id: c_uint,
texture: Texture2D,
depth: Texture2D,
depthTexture: bool,
};
pub const RenderTexture2D = struct_RenderTexture2D;
pub const RenderTexture = RenderTexture2D;
pub const struct_NPatchInfo = extern struct {
sourceRec: Rectangle,
left: c_int,
top: c_int,
right: c_int,
bottom: c_int,
type: c_int,
};
pub const NPatchInfo = struct_NPatchInfo;
pub const struct_CharInfo = extern struct {
value: c_int,
rec: Rectangle,
offsetX: c_int,
offsetY: c_int,
advanceX: c_int,
data: [*c]u8,
};
pub const CharInfo = struct_CharInfo;
pub const struct_Font = extern struct {
texture: Texture2D,
baseSize: c_int,
charsCount: c_int,
chars: [*c]CharInfo,
};
pub const Font = struct_Font;
pub const struct_Camera3D = extern struct {
position: Vector3,
target: Vector3,
up: Vector3,
fovy: f32,
type: c_int,
};
pub const Camera3D = struct_Camera3D;
pub const Camera = Camera3D;
pub const struct_Camera2D = extern struct {
offset: Vector2,
target: Vector2,
rotation: f32,
zoom: f32,
};
pub const Camera2D = struct_Camera2D;
pub const struct_Mesh = extern struct {
vertexCount: c_int,
triangleCount: c_int,
vertices: [*c]f32,
texcoords: [*c]f32,
texcoords2: [*c]f32,
normals: [*c]f32,
tangents: [*c]f32,
colors: [*c]u8,
indices: [*c]c_ushort,
animVertices: [*c]f32,
animNormals: [*c]f32,
boneIds: [*c]c_int,
boneWeights: [*c]f32,
vaoId: c_uint,
vboId: [7]c_uint,
};
pub const Mesh = struct_Mesh;
pub const struct_Shader = extern struct {
id: c_uint,
locs: [32]c_int,
};
pub const Shader = struct_Shader;
pub const struct_MaterialMap = extern struct {
texture: Texture2D,
color: Color,
value: f32,
};
pub const MaterialMap = struct_MaterialMap;
pub const struct_Material = extern struct {
shader: Shader,
maps: [12]MaterialMap,
params: [*c]f32,
};
pub const Material = struct_Material;
pub const struct_Transform = extern struct {
translation: Vector3,
rotation: Quaternion,
scale: Vector3,
};
pub const Transform = struct_Transform;
pub const struct_BoneInfo = extern struct {
name: [32]u8,
parent: c_int,
};
pub const BoneInfo = struct_BoneInfo;
pub const struct_Model = extern struct {
transform: Matrix,
meshCount: c_int,
meshes: [*c]Mesh,
materialCount: c_int,
materials: [*c]Material,
meshMaterial: [*c]c_int,
boneCount: c_int,
bones: [*c]BoneInfo,
bindPose: [*c]Transform,
};
pub const Model = struct_Model;
pub const struct_ModelAnimation = extern struct {
boneCount: c_int,
bones: [*c]BoneInfo,
frameCount: c_int,
framePoses: [*c]([*c]Transform),
};
pub const ModelAnimation = struct_ModelAnimation;
pub const struct_Ray = extern struct {
position: Vector3,
direction: Vector3,
};
pub const Ray = struct_Ray;
pub const struct_RayHitInfo = extern struct {
hit: bool,
distance: f32,
position: Vector3,
normal: Vector3,
};
pub const RayHitInfo = struct_RayHitInfo;
pub const struct_BoundingBox = extern struct {
min: Vector3,
max: Vector3,
};
pub const BoundingBox = struct_BoundingBox;
pub const struct_Wave = extern struct {
sampleCount: c_uint,
sampleRate: c_uint,
sampleSize: c_uint,
channels: c_uint,
data: ?*c_void,
};
pub const Wave = struct_Wave;
pub const struct_Sound = extern struct {
audioBuffer: ?*c_void,
source: c_uint,
buffer: c_uint,
format: c_int,
};
pub const Sound = struct_Sound;
pub const struct_MusicData = @OpaqueType();
pub const Music = ?*struct_MusicData;
pub const struct_AudioStream = extern struct {
sampleRate: c_uint,
sampleSize: c_uint,
channels: c_uint,
audioBuffer: ?*c_void,
format: c_int,
source: c_uint,
buffers: [2]c_uint,
};
pub const AudioStream = struct_AudioStream;
pub const struct_VrDeviceInfo = extern struct {
hResolution: c_int,
vResolution: c_int,
hScreenSize: f32,
vScreenSize: f32,
vScreenCenter: f32,
eyeToScreenDistance: f32,
lensSeparationDistance: f32,
interpupillaryDistance: f32,
lensDistortionValues: [4]f32,
chromaAbCorrection: [4]f32,
};
pub const VrDeviceInfo = struct_VrDeviceInfo;
pub const FLAG_SHOW_LOGO = 1;
pub const FLAG_FULLSCREEN_MODE = 2;
pub const FLAG_WINDOW_RESIZABLE = 4;
pub const FLAG_WINDOW_UNDECORATED = 8;
pub const FLAG_WINDOW_TRANSPARENT = 16;
pub const FLAG_WINDOW_HIDDEN = 128;
pub const FLAG_MSAA_4X_HINT = 32;
pub const FLAG_VSYNC_HINT = 64;
pub const ConfigFlag = extern enum {
FLAG_SHOW_LOGO = 1,
FLAG_FULLSCREEN_MODE = 2,
FLAG_WINDOW_RESIZABLE = 4,
FLAG_WINDOW_UNDECORATED = 8,
FLAG_WINDOW_TRANSPARENT = 16,
FLAG_WINDOW_HIDDEN = 128,
FLAG_MSAA_4X_HINT = 32,
FLAG_VSYNC_HINT = 64,
};
pub const LOG_ALL = 0;
pub const LOG_TRACE = 1;
pub const LOG_DEBUG = 2;
pub const LOG_INFO = 3;
pub const LOG_WARNING = 4;
pub const LOG_ERROR = 5;
pub const LOG_FATAL = 6;
pub const LOG_NONE = 7;
pub const TraceLogType = extern enum {
LOG_ALL = 0,
LOG_TRACE = 1,
LOG_DEBUG = 2,
LOG_INFO = 3,
LOG_WARNING = 4,
LOG_ERROR = 5,
LOG_FATAL = 6,
LOG_NONE = 7,
};
pub const KEY_APOSTROPHE = 39;
pub const KEY_COMMA = 44;
pub const KEY_MINUS = 45;
pub const KEY_PERIOD = 46;
pub const KEY_SLASH = 47;
pub const KEY_ZERO = 48;
pub const KEY_ONE = 49;
pub const KEY_TWO = 50;
pub const KEY_THREE = 51;
pub const KEY_FOUR = 52;
pub const KEY_FIVE = 53;
pub const KEY_SIX = 54;
pub const KEY_SEVEN = 55;
pub const KEY_EIGHT = 56;
pub const KEY_NINE = 57;
pub const KEY_SEMICOLON = 59;
pub const KEY_EQUAL = 61;
pub const KEY_A = 65;
pub const KEY_B = 66;
pub const KEY_C = 67;
pub const KEY_D = 68;
pub const KEY_E = 69;
pub const KEY_F = 70;
pub const KEY_G = 71;
pub const KEY_H = 72;
pub const KEY_I = 73;
pub const KEY_J = 74;
pub const KEY_K = 75;
pub const KEY_L = 76;
pub const KEY_M = 77;
pub const KEY_N = 78;
pub const KEY_O = 79;
pub const KEY_P = 80;
pub const KEY_Q = 81;
pub const KEY_R = 82;
pub const KEY_S = 83;
pub const KEY_T = 84;
pub const KEY_U = 85;
pub const KEY_V = 86;
pub const KEY_W = 87;
pub const KEY_X = 88;
pub const KEY_Y = 89;
pub const KEY_Z = 90;
pub const KEY_SPACE = 32;
pub const KEY_ESCAPE = 256;
pub const KEY_ENTER = 257;
pub const KEY_TAB = 258;
pub const KEY_BACKSPACE = 259;
pub const KEY_INSERT = 260;
pub const KEY_DELETE = 261;
pub const KEY_RIGHT = 262;
pub const KEY_LEFT = 263;
pub const KEY_DOWN = 264;
pub const KEY_UP = 265;
pub const KEY_PAGE_UP = 266;
pub const KEY_PAGE_DOWN = 267;
pub const KEY_HOME = 268;
pub const KEY_END = 269;
pub const KEY_CAPS_LOCK = 280;
pub const KEY_SCROLL_LOCK = 281;
pub const KEY_NUM_LOCK = 282;
pub const KEY_PRINT_SCREEN = 283;
pub const KEY_PAUSE = 284;
pub const KEY_F1 = 290;
pub const KEY_F2 = 291;
pub const KEY_F3 = 292;
pub const KEY_F4 = 293;
pub const KEY_F5 = 294;
pub const KEY_F6 = 295;
pub const KEY_F7 = 296;
pub const KEY_F8 = 297;
pub const KEY_F9 = 298;
pub const KEY_F10 = 299;
pub const KEY_F11 = 300;
pub const KEY_F12 = 301;
pub const KEY_LEFT_SHIFT = 340;
pub const KEY_LEFT_CONTROL = 341;
pub const KEY_LEFT_ALT = 342;
pub const KEY_LEFT_SUPER = 343;
pub const KEY_RIGHT_SHIFT = 344;
pub const KEY_RIGHT_CONTROL = 345;
pub const KEY_RIGHT_ALT = 346;
pub const KEY_RIGHT_SUPER = 347;
pub const KEY_KB_MENU = 348;
pub const KEY_LEFT_BRACKET = 91;
pub const KEY_BACKSLASH = 92;
pub const KEY_RIGHT_BRACKET = 93;
pub const KEY_GRAVE = 96;
pub const KEY_KP_0 = 320;
pub const KEY_KP_1 = 321;
pub const KEY_KP_2 = 322;
pub const KEY_KP_3 = 323;
pub const KEY_KP_4 = 324;
pub const KEY_KP_5 = 325;
pub const KEY_KP_6 = 326;
pub const KEY_KP_7 = 327;
pub const KEY_KP_8 = 328;
pub const KEY_KP_9 = 329;
pub const KEY_KP_DECIMAL = 330;
pub const KEY_KP_DIVIDE = 331;
pub const KEY_KP_MULTIPLY = 332;
pub const KEY_KP_SUBTRACT = 333;
pub const KEY_KP_ADD = 334;
pub const KEY_KP_ENTER = 335;
pub const KEY_KP_EQUAL = 336;
pub const KeyboardKey = extern enum {
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,
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,
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,
};
pub const KEY_BACK = 4;
pub const KEY_MENU = 82;
pub const KEY_VOLUME_UP = 24;
pub const KEY_VOLUME_DOWN = 25;
pub const AndroidButton = extern enum {
KEY_BACK = 4,
KEY_MENU = 82,
KEY_VOLUME_UP = 24,
KEY_VOLUME_DOWN = 25,
};
pub const MOUSE_LEFT_BUTTON = 0;
pub const MOUSE_RIGHT_BUTTON = 1;
pub const MOUSE_MIDDLE_BUTTON = 2;
pub const MouseButton = extern enum {
MOUSE_LEFT_BUTTON = 0,
MOUSE_RIGHT_BUTTON = 1,
MOUSE_MIDDLE_BUTTON = 2,
};
pub const GAMEPAD_PLAYER1 = 0;
pub const GAMEPAD_PLAYER2 = 1;
pub const GAMEPAD_PLAYER3 = 2;
pub const GAMEPAD_PLAYER4 = 3;
pub const GamepadNumber = extern enum {
GAMEPAD_PLAYER1 = 0,
GAMEPAD_PLAYER2 = 1,
GAMEPAD_PLAYER3 = 2,
GAMEPAD_PLAYER4 = 3,
};
pub const GAMEPAD_BUTTON_UNKNOWN = 0;
pub const GAMEPAD_BUTTON_LEFT_FACE_UP = 1;
pub const GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2;
pub const GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3;
pub const GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4;
pub const GAMEPAD_BUTTON_RIGHT_FACE_UP = 5;
pub const GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6;
pub const GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7;
pub const GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8;
pub const GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9;
pub const GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10;
pub const GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11;
pub const GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12;
pub const GAMEPAD_BUTTON_MIDDLE_LEFT = 13;
pub const GAMEPAD_BUTTON_MIDDLE = 14;
pub const GAMEPAD_BUTTON_MIDDLE_RIGHT = 15;
pub const GAMEPAD_BUTTON_LEFT_THUMB = 16;
pub const GAMEPAD_BUTTON_RIGHT_THUMB = 17;
pub const GamepadButton = extern enum {
GAMEPAD_BUTTON_UNKNOWN = 0,
GAMEPAD_BUTTON_LEFT_FACE_UP = 1,
GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2,
GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3,
GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4,
GAMEPAD_BUTTON_RIGHT_FACE_UP = 5,
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6,
GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7,
GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8,
GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9,
GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10,
GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11,
GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12,
GAMEPAD_BUTTON_MIDDLE_LEFT = 13,
GAMEPAD_BUTTON_MIDDLE = 14,
GAMEPAD_BUTTON_MIDDLE_RIGHT = 15,
GAMEPAD_BUTTON_LEFT_THUMB = 16,
GAMEPAD_BUTTON_RIGHT_THUMB = 17,
};
pub const GAMEPAD_AXIS_UNKNOWN = 0;
pub const GAMEPAD_AXIS_LEFT_X = 1;
pub const GAMEPAD_AXIS_LEFT_Y = 2;
pub const GAMEPAD_AXIS_RIGHT_X = 3;
pub const GAMEPAD_AXIS_RIGHT_Y = 4;
pub const GAMEPAD_AXIS_LEFT_TRIGGER = 5;
pub const GAMEPAD_AXIS_RIGHT_TRIGGER = 6;
pub const GamepadAxis = extern enum {
GAMEPAD_AXIS_UNKNOWN = 0,
GAMEPAD_AXIS_LEFT_X = 1,
GAMEPAD_AXIS_LEFT_Y = 2,
GAMEPAD_AXIS_RIGHT_X = 3,
GAMEPAD_AXIS_RIGHT_Y = 4,
GAMEPAD_AXIS_LEFT_TRIGGER = 5,
GAMEPAD_AXIS_RIGHT_TRIGGER = 6,
};
pub const LOC_VERTEX_POSITION = 0;
pub const LOC_VERTEX_TEXCOORD01 = 1;
pub const LOC_VERTEX_TEXCOORD02 = 2;
pub const LOC_VERTEX_NORMAL = 3;
pub const LOC_VERTEX_TANGENT = 4;
pub const LOC_VERTEX_COLOR = 5;
pub const LOC_MATRIX_MVP = 6;
pub const LOC_MATRIX_MODEL = 7;
pub const LOC_MATRIX_VIEW = 8;
pub const LOC_MATRIX_PROJECTION = 9;
pub const LOC_VECTOR_VIEW = 10;
pub const LOC_COLOR_DIFFUSE = 11;
pub const LOC_COLOR_SPECULAR = 12;
pub const LOC_COLOR_AMBIENT = 13;
pub const LOC_MAP_ALBEDO = 14;
pub const LOC_MAP_METALNESS = 15;
pub const LOC_MAP_NORMAL = 16;
pub const LOC_MAP_ROUGHNESS = 17;
pub const LOC_MAP_OCCLUSION = 18;
pub const LOC_MAP_EMISSION = 19;
pub const LOC_MAP_HEIGHT = 20;
pub const LOC_MAP_CUBEMAP = 21;
pub const LOC_MAP_IRRADIANCE = 22;
pub const LOC_MAP_PREFILTER = 23;
pub const LOC_MAP_BRDF = 24;
pub const ShaderLocationIndex = extern enum {
LOC_VERTEX_POSITION = 0,
LOC_VERTEX_TEXCOORD01 = 1,
LOC_VERTEX_TEXCOORD02 = 2,
LOC_VERTEX_NORMAL = 3,
LOC_VERTEX_TANGENT = 4,
LOC_VERTEX_COLOR = 5,
LOC_MATRIX_MVP = 6,
LOC_MATRIX_MODEL = 7,
LOC_MATRIX_VIEW = 8,
LOC_MATRIX_PROJECTION = 9,
LOC_VECTOR_VIEW = 10,
LOC_COLOR_DIFFUSE = 11,
LOC_COLOR_SPECULAR = 12,
LOC_COLOR_AMBIENT = 13,
LOC_MAP_ALBEDO = 14,
LOC_MAP_METALNESS = 15,
LOC_MAP_NORMAL = 16,
LOC_MAP_ROUGHNESS = 17,
LOC_MAP_OCCLUSION = 18,
LOC_MAP_EMISSION = 19,
LOC_MAP_HEIGHT = 20,
LOC_MAP_CUBEMAP = 21,
LOC_MAP_IRRADIANCE = 22,
LOC_MAP_PREFILTER = 23,
LOC_MAP_BRDF = 24,
};
pub const UNIFORM_FLOAT = 0;
pub const UNIFORM_VEC2 = 1;
pub const UNIFORM_VEC3 = 2;
pub const UNIFORM_VEC4 = 3;
pub const UNIFORM_INT = 4;
pub const UNIFORM_IVEC2 = 5;
pub const UNIFORM_IVEC3 = 6;
pub const UNIFORM_IVEC4 = 7;
pub const UNIFORM_SAMPLER2D = 8;
pub const ShaderUniformDataType = extern enum {
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,
};
pub const MAP_ALBEDO = 0;
pub const MAP_METALNESS = 1;
pub const MAP_NORMAL = 2;
pub const MAP_ROUGHNESS = 3;
pub const MAP_OCCLUSION = 4;
pub const MAP_EMISSION = 5;
pub const MAP_HEIGHT = 6;
pub const MAP_CUBEMAP = 7;
pub const MAP_IRRADIANCE = 8;
pub const MAP_PREFILTER = 9;
pub const MAP_BRDF = 10;
pub const MaterialMapType = extern enum {
MAP_ALBEDO = 0,
MAP_METALNESS = 1,
MAP_NORMAL = 2,
MAP_ROUGHNESS = 3,
MAP_OCCLUSION = 4,
MAP_EMISSION = 5,
MAP_HEIGHT = 6,
MAP_CUBEMAP = 7,
MAP_IRRADIANCE = 8,
MAP_PREFILTER = 9,
MAP_BRDF = 10,
};
pub const UNCOMPRESSED_GRAYSCALE = 1;
pub const UNCOMPRESSED_GRAY_ALPHA = 2;
pub const UNCOMPRESSED_R5G6B5 = 3;
pub const UNCOMPRESSED_R8G8B8 = 4;
pub const UNCOMPRESSED_R5G5B5A1 = 5;
pub const UNCOMPRESSED_R4G4B4A4 = 6;
pub const UNCOMPRESSED_R8G8B8A8 = 7;
pub const UNCOMPRESSED_R32 = 8;
pub const UNCOMPRESSED_R32G32B32 = 9;
pub const UNCOMPRESSED_R32G32B32A32 = 10;
pub const COMPRESSED_DXT1_RGB = 11;
pub const COMPRESSED_DXT1_RGBA = 12;
pub const COMPRESSED_DXT3_RGBA = 13;
pub const COMPRESSED_DXT5_RGBA = 14;
pub const COMPRESSED_ETC1_RGB = 15;
pub const COMPRESSED_ETC2_RGB = 16;
pub const COMPRESSED_ETC2_EAC_RGBA = 17;
pub const COMPRESSED_PVRT_RGB = 18;
pub const COMPRESSED_PVRT_RGBA = 19;
pub const COMPRESSED_ASTC_4x4_RGBA = 20;
pub const COMPRESSED_ASTC_8x8_RGBA = 21;
pub const PixelFormat = extern enum {
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,
COMPRESSED_DXT1_RGB = 11,
COMPRESSED_DXT1_RGBA = 12,
COMPRESSED_DXT3_RGBA = 13,
COMPRESSED_DXT5_RGBA = 14,
COMPRESSED_ETC1_RGB = 15,
COMPRESSED_ETC2_RGB = 16,
COMPRESSED_ETC2_EAC_RGBA = 17,
COMPRESSED_PVRT_RGB = 18,
COMPRESSED_PVRT_RGBA = 19,
COMPRESSED_ASTC_4x4_RGBA = 20,
COMPRESSED_ASTC_8x8_RGBA = 21,
};
pub const FILTER_POINT = 0;
pub const FILTER_BILINEAR = 1;
pub const FILTER_TRILINEAR = 2;
pub const FILTER_ANISOTROPIC_4X = 3;
pub const FILTER_ANISOTROPIC_8X = 4;
pub const FILTER_ANISOTROPIC_16X = 5;
pub const TextureFilterMode = extern enum {
FILTER_POINT = 0,
FILTER_BILINEAR = 1,
FILTER_TRILINEAR = 2,
FILTER_ANISOTROPIC_4X = 3,
FILTER_ANISOTROPIC_8X = 4,
FILTER_ANISOTROPIC_16X = 5,
};
pub const CUBEMAP_AUTO_DETECT = 0;
pub const CUBEMAP_LINE_VERTICAL = 1;
pub const CUBEMAP_LINE_HORIZONTAL = 2;
pub const CUBEMAP_CROSS_THREE_BY_FOUR = 3;
pub const CUBEMAP_CROSS_FOUR_BY_THREE = 4;
pub const CUBEMAP_PANORAMA = 5;
pub const CubemapLayoutType = extern enum {
CUBEMAP_AUTO_DETECT = 0,
CUBEMAP_LINE_VERTICAL = 1,
CUBEMAP_LINE_HORIZONTAL = 2,
CUBEMAP_CROSS_THREE_BY_FOUR = 3,
CUBEMAP_CROSS_FOUR_BY_THREE = 4,
CUBEMAP_PANORAMA = 5,
};
pub const WRAP_REPEAT = 0;
pub const WRAP_CLAMP = 1;
pub const WRAP_MIRROR_REPEAT = 2;
pub const WRAP_MIRROR_CLAMP = 3;
pub const TextureWrapMode = extern enum {
WRAP_REPEAT = 0,
WRAP_CLAMP = 1,
WRAP_MIRROR_REPEAT = 2,
WRAP_MIRROR_CLAMP = 3,
};
pub const FONT_DEFAULT = 0;
pub const FONT_BITMAP = 1;
pub const FONT_SDF = 2;
pub const FontType = extern enum {
FONT_DEFAULT = 0,
FONT_BITMAP = 1,
FONT_SDF = 2,
};
pub const BLEND_ALPHA = 0;
pub const BLEND_ADDITIVE = 1;
pub const BLEND_MULTIPLIED = 2;
pub const BlendMode = extern enum {
BLEND_ALPHA = 0,
BLEND_ADDITIVE = 1,
BLEND_MULTIPLIED = 2,
};
pub const GESTURE_NONE = 0;
pub const GESTURE_TAP = 1;
pub const GESTURE_DOUBLETAP = 2;
pub const GESTURE_HOLD = 4;
pub const GESTURE_DRAG = 8;
pub const GESTURE_SWIPE_RIGHT = 16;
pub const GESTURE_SWIPE_LEFT = 32;
pub const GESTURE_SWIPE_UP = 64;
pub const GESTURE_SWIPE_DOWN = 128;
pub const GESTURE_PINCH_IN = 256;
pub const GESTURE_PINCH_OUT = 512;
pub const GestureType = extern 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,
};
pub const CAMERA_CUSTOM = 0;
pub const CAMERA_FREE = 1;
pub const CAMERA_ORBITAL = 2;
pub const CAMERA_FIRST_PERSON = 3;
pub const CAMERA_THIRD_PERSON = 4;
pub const CameraMode = extern enum {
CAMERA_CUSTOM = 0,
CAMERA_FREE = 1,
CAMERA_ORBITAL = 2,
CAMERA_FIRST_PERSON = 3,
CAMERA_THIRD_PERSON = 4,
};
pub const CAMERA_PERSPECTIVE = 0;
pub const CAMERA_ORTHOGRAPHIC = 1;
pub const CameraType = extern enum {
CAMERA_PERSPECTIVE = 0,
CAMERA_ORTHOGRAPHIC = 1,
};
pub const NPT_9PATCH = 0;
pub const NPT_3PATCH_VERTICAL = 1;
pub const NPT_3PATCH_HORIZONTAL = 2;
pub const NPatchType = extern enum {
NPT_9PATCH = 0,
NPT_3PATCH_VERTICAL = 1,
NPT_3PATCH_HORIZONTAL = 2,
};
pub const TraceLogCallback = ?extern fn(c_int, [*c]const u8, [*c]struct___va_list_tag) void;
pub extern fn InitWindow(width: c_int, height: c_int, title: [*c]const u8) void;
pub extern fn WindowShouldClose() bool;
pub extern fn CloseWindow() void;
pub extern fn IsWindowReady() bool;
pub extern fn IsWindowMinimized() bool;
pub extern fn IsWindowResized() bool;
pub extern fn IsWindowHidden() bool;
pub extern fn ToggleFullscreen() void;
pub extern fn UnhideWindow() void;
pub extern fn HideWindow() void;
pub extern fn SetWindowIcon(image: Image) void;
pub extern fn SetWindowTitle(title: [*c]const u8) void;
pub extern fn SetWindowPosition(x: c_int, y: c_int) void;
pub extern fn SetWindowMonitor(monitor: c_int) void;
pub extern fn SetWindowMinSize(width: c_int, height: c_int) void;
pub extern fn SetWindowSize(width: c_int, height: c_int) void;
pub extern fn GetWindowHandle() ?*c_void;
pub extern fn GetScreenWidth() c_int;
pub extern fn GetScreenHeight() c_int;
pub extern fn GetMonitorCount() c_int;
pub extern fn GetMonitorWidth(monitor: c_int) c_int;
pub extern fn GetMonitorHeight(monitor: c_int) c_int;
pub extern fn GetMonitorPhysicalWidth(monitor: c_int) c_int;
pub extern fn GetMonitorPhysicalHeight(monitor: c_int) c_int;
pub extern fn GetMonitorName(monitor: c_int) [*c]const u8;
pub extern fn GetClipboardText() [*c]const u8;
pub extern fn SetClipboardText(text: [*c]const u8) void;
pub extern fn ShowCursor() void;
pub extern fn HideCursor() void;
pub extern fn IsCursorHidden() bool;
pub extern fn EnableCursor() void;
pub extern fn DisableCursor() void;
pub extern fn ClearBackground(color: Color) void;
pub extern fn BeginDrawing() void;
pub extern fn EndDrawing() void;
pub extern fn BeginMode2D(camera: Camera2D) void;
pub extern fn EndMode2D() void;
pub extern fn BeginMode3D(camera: Camera3D) void;
pub extern fn EndMode3D() void;
pub extern fn BeginTextureMode(target: RenderTexture2D) void;
pub extern fn EndTextureMode() void;
pub extern fn GetMouseRay(mousePosition: Vector2, camera: Camera) Ray;
pub extern fn GetWorldToScreen(position: Vector3, camera: Camera) Vector2;
pub extern fn GetCameraMatrix(camera: Camera) Matrix;
pub extern fn SetTargetFPS(fps: c_int) void;
pub extern fn GetFPS() c_int;
pub extern fn GetFrameTime() f32;
pub extern fn GetTime() f64;
pub extern fn ColorToInt(color: Color) c_int;
pub extern fn ColorNormalize(color: Color) Vector4;
pub extern fn ColorToHSV(color: Color) Vector3;
pub extern fn ColorFromHSV(hsv: Vector3) Color;
pub extern fn GetColor(hexValue: c_int) Color;
pub extern fn Fade(color: Color, alpha: f32) Color;
pub extern fn SetConfigFlags(flags: u8) void;
pub extern fn SetTraceLogLevel(logType: c_int) void;
pub extern fn SetTraceLogExit(logType: c_int) void;
pub extern fn SetTraceLogCallback(callback: TraceLogCallback) void;
pub extern fn TraceLog(logType: c_int, text: [*c]const u8, ...) void;
pub extern fn TakeScreenshot(fileName: [*c]const u8) void;
pub extern fn GetRandomValue(min: c_int, max: c_int) c_int;
pub extern fn FileExists(fileName: [*c]const u8) bool;
pub extern fn IsFileExtension(fileName: [*c]const u8, ext: [*c]const u8) bool;
pub extern fn GetExtension(fileName: [*c]const u8) [*c]const u8;
pub extern fn GetFileName(filePath: [*c]const u8) [*c]const u8;
pub extern fn GetFileNameWithoutExt(filePath: [*c]const u8) [*c]const u8;
pub extern fn GetDirectoryPath(fileName: [*c]const u8) [*c]const u8;
pub extern fn GetWorkingDirectory() [*c]const u8;
pub extern fn GetDirectoryFiles(dirPath: [*c]const u8, count: [*c]c_int) [*c]([*c]u8);
pub extern fn ClearDirectoryFiles() void;
pub extern fn ChangeDirectory(dir: [*c]const u8) bool;
pub extern fn IsFileDropped() bool;
pub extern fn GetDroppedFiles(count: [*c]c_int) [*c]([*c]u8);
pub extern fn ClearDroppedFiles() void;
pub extern fn GetFileModTime(fileName: [*c]const u8) c_long;
pub extern fn StorageSaveValue(position: c_int, value: c_int) void;
pub extern fn StorageLoadValue(position: c_int) c_int;
pub extern fn OpenURL(url: [*c]const u8) void;
pub extern fn IsKeyPressed(key: c_int) bool;
pub extern fn IsKeyDown(key: c_int) bool;
pub extern fn IsKeyReleased(key: c_int) bool;
pub extern fn IsKeyUp(key: c_int) bool;
pub extern fn GetKeyPressed() c_int;
pub extern fn SetExitKey(key: c_int) void;
pub extern fn IsGamepadAvailable(gamepad: c_int) bool;
pub extern fn IsGamepadName(gamepad: c_int, name: [*c]const u8) bool;
pub extern fn GetGamepadName(gamepad: c_int) [*c]const u8;
pub extern fn IsGamepadButtonPressed(gamepad: c_int, button: c_int) bool;
pub extern fn IsGamepadButtonDown(gamepad: c_int, button: c_int) bool;
pub extern fn IsGamepadButtonReleased(gamepad: c_int, button: c_int) bool;
pub extern fn IsGamepadButtonUp(gamepad: c_int, button: c_int) bool;
pub extern fn GetGamepadButtonPressed() c_int;
pub extern fn GetGamepadAxisCount(gamepad: c_int) c_int;
pub extern fn GetGamepadAxisMovement(gamepad: c_int, axis: c_int) f32;
pub extern fn IsMouseButtonPressed(button: c_int) bool;
pub extern fn IsMouseButtonDown(button: c_int) bool;
pub extern fn IsMouseButtonReleased(button: c_int) bool;
pub extern fn IsMouseButtonUp(button: c_int) bool;
pub extern fn GetMouseX() c_int;
pub extern fn GetMouseY() c_int;
pub extern fn GetMousePosition() Vector2;