-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathraylib.rb
1978 lines (1644 loc) · 71.4 KB
/
raylib.rb
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 'ffi'
module Raylib
extend FFI::Library
# We load the lib
ffi_lib 'raylib.dll'
# Some constant
PI = 3.14159265358979323846
DEG2RAD = (PI/180.0)
RAD2DEG = (180.0/PI)
#=raylib Config Flags
FLAG_SHOW_LOGO= 1 # Set to show raylib logo at startup
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_MSAA_4X_HINT= 32 # Set to try enabling MSAA 4X
FLAG_VSYNC_HINT= 64 # Set to try enabling V#Sync on GPU
#=Keyboard 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_RIGHT_SHIFT= 344
KEY_RIGHT_CONTROL= 345
KEY_RIGHT_ALT= 346
KEY_GRAVE= 96
KEY_SLASH= 47
KEY_BACKSLASH= 92
#=Keyboard Alpha Numeric Keys
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_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
#=Android Physical Buttons
KEY_BACK= 4
KEY_MENU= 82
KEY_VOLUME_UP= 24
KEY_VOLUME_DOWN= 25
#=Mouse Buttons
MOUSE_LEFT_BUTTON= 0
MOUSE_RIGHT_BUTTON= 1
MOUSE_MIDDLE_BUTTON= 2
#=Touch points registered
MAX_TOUCH_POINTS= 2
#=Gamepad Number
GAMEPAD_PLAYER1= 0
GAMEPAD_PLAYER2= 1
GAMEPAD_PLAYER3= 2
GAMEPAD_PLAYER4= 3
#=Gamepad Buttons/Axis
#=PS3 USB Controller Buttons
GAMEPAD_PS3_BUTTON_TRIANGLE=0
GAMEPAD_PS3_BUTTON_CIRCLE= 1
GAMEPAD_PS3_BUTTON_CROSS= 2
GAMEPAD_PS3_BUTTON_SQUARE= 3
GAMEPAD_PS3_BUTTON_L1= 6
GAMEPAD_PS3_BUTTON_R1= 7
GAMEPAD_PS3_BUTTON_L2= 4
GAMEPAD_PS3_BUTTON_R2= 5
GAMEPAD_PS3_BUTTON_START= 8
GAMEPAD_PS3_BUTTON_SELECT= 9
GAMEPAD_PS3_BUTTON_UP= 24
GAMEPAD_PS3_BUTTON_RIGHT= 25
GAMEPAD_PS3_BUTTON_DOWN= 26
GAMEPAD_PS3_BUTTON_LEFT= 27
GAMEPAD_PS3_BUTTON_PS= 12
#=PS3 USB Controller Axis
GAMEPAD_PS3_AXIS_LEFT_X= 0
GAMEPAD_PS3_AXIS_LEFT_Y= 1
GAMEPAD_PS3_AXIS_RIGHT_X= 2
GAMEPAD_PS3_AXIS_RIGHT_Y= 5
GAMEPAD_PS3_AXIS_L2= 3 # [1..#1] (pressure#level)
GAMEPAD_PS3_AXIS_R2= 4 # [1..#1] (pressure#level)
#=Xbox360 USB Controller Buttons
GAMEPAD_XBOX_BUTTON_A= 0
GAMEPAD_XBOX_BUTTON_B= 1
GAMEPAD_XBOX_BUTTON_X= 2
GAMEPAD_XBOX_BUTTON_Y= 3
GAMEPAD_XBOX_BUTTON_LB= 4
GAMEPAD_XBOX_BUTTON_RB= 5
GAMEPAD_XBOX_BUTTON_SELECT= 6
GAMEPAD_XBOX_BUTTON_START= 7
GAMEPAD_XBOX_BUTTON_UP= 10
GAMEPAD_XBOX_BUTTON_RIGHT= 11
GAMEPAD_XBOX_BUTTON_DOWN= 12
GAMEPAD_XBOX_BUTTON_LEFT= 13
GAMEPAD_XBOX_BUTTON_HOME= 8
#=Android Gamepad Controller (SNES CLASSIC)
GAMEPAD_ANDROID_DPAD_UP= 19
GAMEPAD_ANDROID_DPAD_DOWN= 20
GAMEPAD_ANDROID_DPAD_LEFT= 21
GAMEPAD_ANDROID_DPAD_RIGHT= 22
GAMEPAD_ANDROID_DPAD_CENTER= 23
GAMEPAD_ANDROID_BUTTON_A= 96
GAMEPAD_ANDROID_BUTTON_B= 97
GAMEPAD_ANDROID_BUTTON_C= 98
GAMEPAD_ANDROID_BUTTON_X= 99
GAMEPAD_ANDROID_BUTTON_Y= 100
GAMEPAD_ANDROID_BUTTON_Z= 101
GAMEPAD_ANDROID_BUTTON_L1= 102
GAMEPAD_ANDROID_BUTTON_R1= 103
GAMEPAD_ANDROID_BUTTON_L2= 104
GAMEPAD_ANDROID_BUTTON_R2= 105
# Shader and material limits
MAX_SHADER_LOCATIONS = 32 # Maximum number of predefined locations stored in shader struct
MAX_MATERIAL_MAPS = 12 # Maximum number of texture maps stored in shader struct
# Music enum
enum :MusicContextType, [:MUSIC_AUDIO_OGG, 0,
:MUSIC_AUDIO_FLAC,
:MUSIC_AUDIO_MP3,
:MUSIC_MODULE_XM,
:MUSIC_MODULE_MOD ]
CAMERA_PERSPECTIVE = 0
CAMERA_ORTHOGRAPHIC = 1
# Structs
# Vector2 type
class Vector2 < FFI::Struct
layout :x, :float,
:y, :float
def x; self[:x]; end
def y; self[:y]; end
def x=(v); self[:x] = v; end
def y=(v); self[:y] = v; end
end
# Vector3 type
class Vector3 < FFI::Struct
layout :x, :float,
:y, :float,
:z, :float
def x; self[:x]; end
def y; self[:y]; end
def z; self[:z]; end
def x=(v); self[:x] = v; end
def y=(v); self[:y] = v; end
def z=(v); self[:z] = v; end
end
# Vector4 type
class Vector4 < FFI::Struct
layout :x, :float,
:y, :float,
:z, :float,
:w, :float
def x; self[:x]; end
def y; self[:y]; end
def z; self[:z]; end
def w; self[:w]; end
def x=(v); self[:x] = v; end
def y=(v); self[:y] = v; end
def z=(v); self[:z] = v; end
def w=(v); self[:w] = v; end
end
# Quaternion type, same as Vector4
# Matrix type (OpenGL style 4x4 - right handed, column major)
class Matrix < FFI::Struct
layout :m0, :float,
:m4, :float,
:m8, :float,
:m12, :float,
:m1, :float,
:m5, :float,
:m9, :float,
:m13, :float,
:m2, :float,
:m6, :float,
:m10, :float,
:m14, :float,
:m3, :float,
:m7, :float,
:m11, :float,
:m15, :float
end
# Color type, RGBA (32bit)
class Color < FFI::Struct
layout :r, :uchar,
:g, :uchar,
:b, :uchar,
:a, :uchar
def r; self[:r]; end
def g; self[:g]; end
def b; self[:b]; end
def a; self[:a]; end
def r=(v); self[:r] = v; end
def g=(v); self[:g] = v; end
def b=(v); self[:b] = v; end
def a=(v); self[:a] = v; end
end
# Rectangle type
class Rectangle < FFI::Struct
layout :x, :float,
:y, :float,
:width, :float,
:height, :float
def x; self[:x]; end
def y; self[:y]; end
def width; self[:width]; end
def height; self[:height]; end
def x=(v); self[:x] = v; end
def y=(v); self[:y] = v; end
def width=(v); self[:width] = v; end
def height=(v); self[:height] = v; end
end
# Image type, bpp always RGBA (32bit)
# NOTE: Data stored in CPU memory (RAM)
class Image < FFI::Struct
layout :data, :pointer,
:width, :int,
:height, :int,
:mipmaps, :int,
:format, :int
end
# Texture2D type
# NOTE: Data stored in GPU memory
class Texture2D < FFI::Struct
layout :id, :uint,
:width, :int,
:height, :int,
:mipmaps, :int,
:format, :int
end
# Texture type, same as Texture2D
# RenderTexture2D type, for texture rendering
class RenderTexture2D < FFI::Struct
layout :id, :uint,
:texture, Texture2D,
:depth, Texture2D
end
# RenderTexture type, same as RenderTexture2D
# Font character info
class CharInfo < FFI::Struct
layout :value, :int,
# Character rectangle in sprite font
:offsetX, :int,
:offsetY, :int,
:advanceX, :int,
:data, :uchar
end
# Font type, includes texture and charSet array data
class Font < FFI::Struct
layout :texture, Texture2D.by_value,
:baseSize, :int,
:charsCount, :int,
:chars, CharInfo
end
#define SpriteFont Font# SpriteFont type fallback, defaults to Font
# Camera type, defines a camera position/orientation in 3d space
class Camera < FFI::Struct
layout :position, Vector3.by_value,
:target, Vector3.by_value,
:up, Vector3.by_value,
:fovy, :float,
:type, :int
def position; self[:position]; end
def target; self[:target]; end
def up; self[:up]; end
def fovy; self[:fovy]; end
def type; self[:type]; end
def position=(v); self[:position] = v; end
def target=(v); self[:target] = v; end
def up=(v); self[:up] = v; end
def fovy=(v); self[:fovy] = v; end
def type=(v); self[:type] = v; end
end
#define Camera Camera3D# Camera type fallback, defaults to Camera3D
# Camera2D type, defines a 2d camera
class Camera2D < FFI::Struct
layout :offset, Vector2.by_value,
:target, Vector2.by_value,
:rotation, :float,
:zoom, :float
def offset; self[:offset]; end
def target; self[:target]; end
def rotation; self[:rotation]; end
def zoom; self[:zoom]; end
def offset=(v); self[:offset] = v; end
def target=(v); self[:target] = v; end
def rotation=(v); self[:rotation] = v; end
def zoom=(v); self[:zoom] = v; end
end
# Bounding box type
class BoundingBox < FFI::Struct
layout :min, Vector3.by_value,
:max, Vector3.by_value
end
# Vertex data definning a mesh
# NOTE: Data stored in CPU memory (and GPU)
class Mesh < FFI::Struct
layout :vertexCount, :int,
:triangleCount, :int,
:vertices, :pointer,
:texcoords, :pointer,
:texcoords2, :pointer,
:normals, :pointer,
:tangents, :pointer,
:colors, :pointer,
:indices, :pointer,
# Vertex indices (in case vertex data comes indexed)
:vaoId, :uint,
:vboId, [:uint, 7]
end
# Shader type (generic)
class Shader < FFI::Struct
layout :id, :uint,
:locs, [:int, MAX_SHADER_LOCATIONS]
end
# Material texture map
class MaterialMap < FFI::Struct
layout :texture, Texture2D.by_value,
:color, Color.by_value,
:value, :float
def texture; self[:texture]; end
def color; self[:color]; end
def value; self[:value]; end
def texture=(v); self[:texture] = v; end
def color=(v); self[:color] = v; end
def value=(v); self[:value] = v; end
end
# Material type (generic)
class Material < FFI::Struct
layout :shader, Shader.by_value,
:maps, [MaterialMap.by_value, MAX_MATERIAL_MAPS],
:params, :pointer
def shader; self[:shader]; end
def maps; self[:maps]; end
def value; self[:value]; end
def shader=(v); self[:shader] = v; end
def maps=(v); self[:maps] = v; end
def value=(v); self[:value] = v; end
end
# Model type
class Model < FFI::Struct
layout :mesh, Mesh.by_value,
:transform, Matrix.by_value,
:material, Material.by_value
def mesh; self[:mesh]; end
def transform; self[:transform]; end
def material; self[:material]; end
def mesh=(v); self[:mesh] = v; end
def transform=(v); self[:transform] = v; end
def material=(v); self[:material] = v; end
end
# Ray type (useful for raycast)
class Ray < FFI::Struct
layout :position, Vector3.by_value,
:direction, Vector3.by_value
def position; self[:position]; end
def direction; self[:direction]; end
def position=(v); self[:position] = v; end
def direction=(v); self[:direction] = v; end
end
# Raycast hit information
class RayHitInfo < FFI::Struct
layout :hit, :bool,
:distance, :float,
:position, Vector3.by_value,
:normal, Vector3.by_value
end
# Wave type, defines audio wave data
class Wave < FFI::Struct
layout :sampleCount, :uint,
:sampleRate, :uint,
:sampleSize, :uint,
:channels, :uint,
:data, :pointer
end
# Sound source type
class Sound < FFI::Struct
layout :audioBuffer, :pointer,
:source, :uint,
:buffer, :uint,
:format, :int
end
# Music type (file streaming from memory)
# NOTE: Anything longer than ~10 seconds should be streamed
# class Music < FFI::Struct # Audio stream type
# NOTE: Useful to create custom audio streams not bound to a specific file
class AudioStream < FFI::Struct
layout :sampleRate, :uint,
:sampleSize, :uint,
:channels, :uint,
:audioBuffer, :pointer,
:format, :int,
:source, :uint,
:buffers, [:uint, 2]
end
# Head-Mounted-Display device parameters
class VrDeviceInfo < FFI::Struct
layout :hResolution, :int,
:vResolution, :int,
:hScreenSize, :float,
:vScreenSize, :float,
:vScreenCenter, :float,
:eyeToScreenDistance, :float,
:lensSeparationDistance, :float,
:interpupillaryDistance, :float,
:lensDistortionValues, [:float, 4],
:chromaAbCorrection, [:float, 4]
end
## SOME FUNCTIONS ##
def Raylib.new_color(r, g, b, a)
c = Color.new
c.r = r
c.g = g
c.b = b
c.a = a
return c
end
def Raylib.new_rectangle(x, y, width, height)
rect = Rectangle.new
rect.x = x
rect.y = y
rect.width = width
rect.height = height
return rect
end
def Raylib.new_camera2d()
cam = Camera2D.new
return cam
end
def Raylib.new_camera()
cam = Camera.new
return cam
end
def Raylib.new_vector2(x, y)
vec2 = Vector2.new
vec2[:x] = x.to_f
vec2[:y] = y.to_f
return vec2
end
def Raylib.new_vector3(x, y, z)
vec3 = Vector3.new
vec3[:x] = x.to_f
vec3[:y] = y.to_f
vec3[:z] = z.to_f
return vec3
end
def Raylib.new_bounding_box(min, max)
bb = BoundingBox.new
bb[:min] = min
bb[:max] = max
return bb
end
def Raylib.new_ray()
ray = Ray.new
return ray
end
## SOME OTHER DEFINES ##
# Colors
LIGHTGRAY = new_color(200, 200, 200, 255) # Light Gray
GRAY = new_color(130, 130, 130, 255) # Gray
DARKGRAY = new_color(80, 80, 80, 255) # Dark Gray
YELLOW = new_color(253, 249, 0, 255) # Yellow
GOLD = new_color(255, 203, 0, 255) # Gold
ORANGE = new_color(255, 161, 0, 255) # Orange
PINK = new_color(255, 109, 194, 255) # Pink
RED = new_color(230, 41, 55, 255) # Red
MAROON = new_color(190, 33, 55, 255) # Maroon
GREEN = new_color(0, 228, 48, 255) # Green
LIME = new_color(0, 158, 47, 255) # Lime
DARKGREEN = new_color(0, 117, 44, 255) # Dark Green
SKYBLUE = new_color(102, 191, 255, 255) # Sky Blue
BLUE = new_color(0, 121, 241, 255) # Blue
DARKBLUE = new_color(0, 82, 172, 255) # Dark Blue
PURPLE = new_color(200, 122, 255, 255) # Purple
VIOLET = new_color(135, 60, 190, 255) # Violet
DARKPURPLE= new_color(112, 31, 126, 255) # Dark Purple
BEIGE = new_color(211, 176, 131, 255) # Beige
BROWN = new_color(127, 106, 79, 255) # Brown
DARKBROWN = new_color(76, 63, 47, 255) # Dark Brown
WHITE = new_color(255, 255, 255, 255) # White
BLACK = new_color(0, 0, 0, 255) # Black
BLANK = new_color(0, 0, 0, 0) # Blank (Transparent)
MAGENTA = new_color(255, 0, 255, 255) # Magenta
RAYWHITE = new_color(245, 245, 245, 255) # My own White (raylib logo)
# Trace log type
LOG_INFO = 0
LOG_WARNING = 1
LOG_ERROR = 2
LOG_DEBUG = 3
LOG_OTHER = 4
# Shader location point type
LOC_VERTEX_POSITION = 0
LOC_VERTEX_TEXCOORD01 = 5
LOC_VERTEX_TEXCOORD02 = 6
LOC_VERTEX_NORMAL = 7
LOC_VERTEX_TANGENT = 8
LOC_VERTEX_COLOR = 9
LOC_MATRIX_MVP = 10
LOC_MATRIX_MODEL = 11
LOC_MATRIX_VIEW = 12
LOC_MATRIX_PROJECTION = 13
LOC_VECTOR_VIEW = 14
LOC_COLOR_DIFFUSE = 15
LOC_COLOR_SPECULAR = 16
LOC_COLOR_AMBIENT = 17
LOC_MAP_ALBEDO = 18 # LOC_MAP_DIFFUSE
LOC_MAP_METALNESS = 19 # LOC_MAP_SPECULAR
LOC_MAP_NORMAL = 20
LOC_MAP_ROUGHNESS = 21
LOC_MAP_OCCUSION = 22
LOC_MAP_EMISSION = 23
LOC_MAP_HEIGHT = 24
LOC_MAP_CUBEMAP = 25
LOC_MAP_IRRADIANCE = 26
LOC_MAP_PREFILTER = 27
LOC_MAP_BRDF = 28
LOC_MAP_DIFFUSE = LOC_MAP_ALBEDO
LOC_MAP_SPECULAR = LOC_MAP_METALNESS
# Material map type
MAP_ALBEDO = 0
MAP_METALNESS = 1
MAP_NORMAL = 2
MAP_ROUGHNESS = 3
MAP_OCCLUSION = 4
MAP_EMISSION = 5
MAP_HEIGHT = 6
MAP_CUBEMAP = 7 # NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_IRRADIANCE = 8 # NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_PREFILTER = 9 # NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_BRDF = 10
MAP_DIFFUSE = MAP_ALBEDO
MAP_SPECULAR = MAP_METALNESS
# Texture formats
# NOTE: Support depends on OpenGL version and platform
UNCOMPRESSED_GRAYSCALE = 1 # 8 bit per pixel (no alpha)
UNCOMPRESSED_GRAY_ALPHA = 2 # 16 bpp (2 channels)
UNCOMPRESSED_R5G6B5 = 3 # 16 bpp
UNCOMPRESSED_R8G8B8 = 4 # 24 bpp
UNCOMPRESSED_R5G5B5A1 = 5 # 16 bpp (1 bit alpha)
UNCOMPRESSED_R4G4B4A4 = 6 # 16 bpp (4 bit alpha)
UNCOMPRESSED_R8G8B8A8 = 7 # 32 bpp
UNCOMPRESSED_R32G32B32 = 8 # 32 bit per channel (float) - HDR
COMPRESSED_DXT1_RGB = 9 # 4 bpp (no alpha)
COMPRESSED_DXT1_RGBA = 10 # 4 bpp (1 bit alpha)
COMPRESSED_DXT3_RGBA = 11 # 8 bpp
COMPRESSED_DXT5_RGBA = 12 # 8 bpp
COMPRESSED_ETC1_RGB = 13 # 4 bpp
COMPRESSED_ETC2_RGB = 14 # 4 bpp
COMPRESSED_ETC2_EAC_RGBA = 15 # 8 bpp
COMPRESSED_PVRT_RGB = 16 # 4 bpp
COMPRESSED_PVRT_RGBA = 17 # 4 bpp
COMPRESSED_ASTC_4x4_RGBA = 18 # 8 bpp
COMPRESSED_ASTC_8x8_RGBA = 19 # 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
FILTER_POINT = 0 # No filter = just pixel aproximation
FILTER_BILINEAR = 1 # Linear filtering
FILTER_TRILINEAR = 2 # Trilinear filtering (linear with mipmaps)
FILTER_ANISOTROPIC_4X = 3 # Anisotropic filtering 4x
FILTER_ANISOTROPIC_8X = 4 # Anisotropic filtering 8x
FILTER_ANISOTROPIC_16X = 5 # Anisotropic filtering 16x
# Texture parameters: wrap mode
WRAP_REPEAT = 0
WRAP_CLAMP = 1
WRAP_MIRROR = 2
# Color blending modes (pre-defined)
BLEND_ALPHA = 0
BLEND_ADDITIVE = 1
BLEND_MULTIPLIED = 2
# Gestures type
# NOTE: It could be used as flags to enable only some gestures
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
CAMERA_CUSTOM = 0
CAMERA_FREE = 1
CAMERA_ORBITAL = 2
CAMERA_FIRST_PERSON = 3
CAMERA_THIRD_PERSON = 4
# Head Mounted Display devices
HMD_DEFAULT_DEVICE = 0
HMD_OCULUS_RIFT_DK2 = 1
HMD_OCULUS_RIFT_CV1 = 2
HMD_OCULUS_GO = 3
HMD_VALVE_HTC_VIVE = 4
HMD_SONY_PSVR = 5
# RRESData type
RRES_TYPE_RAW = 0
RRES_TYPE_IMAGE = 1
RRES_TYPE_WAVE = 2
RRES_TYPE_VERTEX = 3
RRES_TYPE_TEXT = 4
RRES_TYPE_FONT_IMAGE = 5
RRES_TYPE_FONT_CHARDATA = 6# CharInfo data array
RRES_TYPE_DIRECTORY = 7
# Window-related functions
attach_function :InitWindow, [:int, :int, :string], :void
attach_function :CloseWindow, [], :void
attach_function :IsWindowReady, [], :bool
attach_function :WindowShouldClose, [], :bool
attach_function :IsWindowMinimized, [], :bool
attach_function :ToggleFullscreen, [], :void
attach_function :SetWindowIcon, [Image.by_value], :void
attach_function :SetWindowTitle, [], :void
attach_function :SetWindowPosition, [:int, :int], :void
attach_function :SetWindowMonitor, [:int], :void
attach_function :SetWindowMinSize, [:int, :int], :void
attach_function :SetWindowSize, [:int, :int], :void
attach_function :GetScreenWidth, [], :int
attach_function :GetScreenHeight, [], :int
# Cursor-related functions
attach_function :ShowCursor, [], :void
attach_function :HideCursor, [], :void
attach_function :IsCursorHidden, [], :bool
attach_function :EnableCursor, [], :void
attach_function :DisableCursor, [], :void
# Drawing-related functions
attach_function :ClearBackground, [Color.by_value], :void
attach_function :BeginDrawing, [], :void
attach_function :EndDrawing, [], :void
attach_function :BeginMode2D, [Camera2D.by_value], :void
attach_function :EndMode2D, [], :void
attach_function :BeginMode3D, [Camera.by_value], :void
attach_function :EndMode3D, [], :void
attach_function :BeginTextureMode, [], :void
attach_function :EndTextureMode, [], :void
# Screen-space-related functions
attach_function :GetMouseRay, [Vector2.by_value, Camera.by_value], Ray.by_value
attach_function :GetWorldToScreen, [Vector3.by_value, Camera.by_value], Vector2.by_value
attach_function :GetCameraMatrix, [Camera.by_value], Matrix.by_value
# Timing-related functions
attach_function :SetTargetFPS, [:int], :void
attach_function :GetFPS, [], :int
attach_function :GetFrameTime, [], :float
# Color-related functions
attach_function :ColorToInt, [Color.by_value], :int
attach_function :ColorNormalize, [Color.by_value], Vector4.by_value
attach_function :ColorToHSV, [Color.by_value], Vector3.by_value
attach_function :GetColor, [:int], Color.by_value
attach_function :Fade, [Color.by_value, :float], Color.by_value
# Misc. functions
attach_function :ShowLogo, [], :void
attach_function :SetConfigFlags, [], :void
attach_function :SetTraceLog, [], :void
attach_function :TraceLog, [:int], :void
attach_function :TakeScreenshot, [], :void
attach_function :GetRandomValue, [:int, :int], :int
# Files management functions
attach_function :IsFileExtension, [], :bool
attach_function :ChangeDirectory, [], :bool
attach_function :IsFileDropped, [], :bool
attach_function :ClearDroppedFiles, [], :void
# Persistent storage management
attach_function :StorageSaveValue, [:int, :int], :void
attach_function :StorageLoadValue, [:int], :int
# Input-related functions: keyboard
attach_function :IsKeyPressed, [:int], :bool
attach_function :IsKeyDown, [:int], :bool
attach_function :IsKeyReleased, [:int], :bool
attach_function :IsKeyUp, [:int], :bool
attach_function :GetKeyPressed, [], :int
attach_function :SetExitKey, [:int], :void
# Input-related functions: gamepads
attach_function :IsGamepadAvailable, [:int], :bool
attach_function :IsGamepadName, [:int], :bool
attach_function :IsGamepadButtonPressed, [:int, :int], :bool