-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraylib.c.v
5658 lines (4396 loc) · 148 KB
/
raylib.c.v
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
module raylib
pub type Vector2 = C.Vector2
// Vector2, 2 components
pub struct C.Vector2 {
// Vector x component
x f32
// Vector y component
y f32
}
pub type Vector3 = C.Vector3
// Vector3, 3 components
pub struct C.Vector3 {
// Vector x component
x f32
// Vector y component
y f32
// Vector z component
z f32
}
pub type Vector4 = C.Vector4
// Vector4, 4 components
pub struct C.Vector4 {
// Vector x component
x f32
// Vector y component
y f32
// Vector z component
z f32
// Vector w component
w f32
}
pub type Matrix = C.Matrix
// Matrix, 4x4 components, column major, OpenGL style, right-handed
pub struct C.Matrix {
// Matrix first row (4 components)
m0 f32
// Matrix first row (4 components)
m4 f32
// Matrix first row (4 components)
m8 f32
// Matrix first row (4 components)
m12 f32
// Matrix second row (4 components)
m1 f32
// Matrix second row (4 components)
m5 f32
// Matrix second row (4 components)
m9 f32
// Matrix second row (4 components)
m13 f32
// Matrix third row (4 components)
m2 f32
// Matrix third row (4 components)
m6 f32
// Matrix third row (4 components)
m10 f32
// Matrix third row (4 components)
m14 f32
// Matrix fourth row (4 components)
m3 f32
// Matrix fourth row (4 components)
m7 f32
// Matrix fourth row (4 components)
m11 f32
// Matrix fourth row (4 components)
m15 f32
}
pub type Color = C.Color
// Color, 4 components, R8G8B8A8 (32bit)
pub struct C.Color {
// Color red value
r u8
// Color green value
g u8
// Color blue value
b u8
// Color alpha value
a u8
}
pub type Rectangle = C.Rectangle
// Rectangle, 4 components
pub struct C.Rectangle {
// Rectangle top-left corner position x
x f32
// Rectangle top-left corner position y
y f32
// Rectangle width
width f32
// Rectangle height
height f32
}
pub type Image = C.Image
// Image, pixel data stored in CPU memory (RAM)
pub struct C.Image {
// Image raw data
data voidptr
// Image base width
width int
// Image base height
height int
// Mipmap levels, 1 by default
mipmaps int
// Data format (PixelFormat type)
format int
}
pub type Texture = C.Texture
// Texture, tex data stored in GPU memory (VRAM)
pub struct C.Texture {
// OpenGL texture id
id u32
// Texture base width
width int
// Texture base height
height int
// Mipmap levels, 1 by default
mipmaps int
// Data format (PixelFormat type)
format int
}
pub type RenderTexture = C.RenderTexture
// RenderTexture, fbo for texture rendering
pub struct C.RenderTexture {
// OpenGL framebuffer object id
id u32
// Color buffer attachment texture
texture Texture
// Depth buffer attachment texture
depth Texture
}
pub type NPatchInfo = C.NPatchInfo
// NPatchInfo, n-patch layout info
pub struct C.NPatchInfo {
// Texture source rectangle
source Rectangle
// Left border offset
left int
// Top border offset
top int
// Right border offset
right int
// Bottom border offset
bottom int
// Layout of the n-patch: 3x3, 1x3 or 3x1
layout int
}
pub type GlyphInfo = C.GlyphInfo
// GlyphInfo, font characters glyphs info
pub struct C.GlyphInfo {
// Character value (Unicode)
value int
// Character offset X when drawing
offset_x int
// Character offset Y when drawing
offset_y int
// Character advance position X
advance_x int
// Character image data
image Image
}
pub type Font = C.Font
// Font, font texture and GlyphInfo array data
pub struct C.Font {
// Base size (default chars height)
base_size int
// Number of glyph characters
glyph_count int
// Padding around the glyph characters
glyph_padding int
// Texture atlas containing the glyphs
texture Texture2D
// Rectangles in texture for the glyphs
recs &Rectangle
// Glyphs info data
glyphs &GlyphInfo
}
pub type Camera3D = C.Camera3D
// Camera, defines position/orientation in 3d space
pub struct C.Camera3D {
// Camera position
position Vector3
// Camera target it looks-at
target Vector3
// Camera up vector (rotation over its axis)
up Vector3
// Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
fovy f32
// Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
projection int
}
pub type Camera2D = C.Camera2D
// Camera2D, defines position/orientation in 2d space
pub struct C.Camera2D {
// Camera offset (displacement from target)
offset Vector2
// Camera target (rotation and zoom origin)
target Vector2
// Camera rotation in degrees
rotation f32
// Camera zoom (scaling), should be 1.0f by default
zoom f32
}
pub type Mesh = C.Mesh
// Mesh, vertex data and vao/vbo
pub struct C.Mesh {
// Number of vertices stored in arrays
vertex_count int
// Number of triangles stored (indexed or not)
triangle_count int
// Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
vertices &f32
// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
texcoords &f32
// Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
texcoords2 &f32
// Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
normals &f32
// Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
tangents &f32
// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
colors &u8
// Vertex indices (in case vertex data comes indexed)
indices &u16
// Animated vertex positions (after bones transformations)
anim_vertices &f32
// Animated normals (after bones transformations)
anim_normals &f32
// Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) (shader-location = 6)
bone_ids &u8
// Vertex bone weight, up to 4 bones influence by vertex (skinning) (shader-location = 7)
bone_weights &f32
// Bones animated transformation matrices
bone_matrices &Matrix
// Number of bones
bone_count int
// OpenGL Vertex Array Object id
vao_id u32
// OpenGL Vertex Buffer Objects id (default vertex data)
vbo_id &u32
}
pub type Shader = C.Shader
// Shader
pub struct C.Shader {
// Shader program id
id u32
// Shader locations array (RL_MAX_SHADER_LOCATIONS)
locs &int
}
pub type MaterialMap = C.MaterialMap
// MaterialMap
pub struct C.MaterialMap {
// Material map texture
texture Texture2D
// Material map color
color Color
// Material map value
value f32
}
pub type Material = C.Material
// Material, includes shader and maps
pub struct C.Material {
// Material shader
shader Shader
// Material maps array (MAX_MATERIAL_MAPS)
maps &MaterialMap
// Material generic parameters (if required)
params [4]f32
}
pub type Transform = C.Transform
// Transform, vertex transformation data
pub struct C.Transform {
// Translation
translation Vector3
// Rotation
rotation Quaternion
// Scale
scale Vector3
}
pub type BoneInfo = C.BoneInfo
// Bone, skeletal animation bone
pub struct C.BoneInfo {
// Bone name
name [32]char
// Bone parent
parent int
}
pub type Model = C.Model
// Model, meshes, materials and animation data
pub struct C.Model {
// Local transform matrix
transform Matrix
// Number of meshes
mesh_count int
// Number of materials
material_count int
// Meshes array
meshes &Mesh
// Materials array
materials &Material
// Mesh material number
mesh_material &int
// Number of bones
bone_count int
// Bones information (skeleton)
bones &BoneInfo
// Bones base transformation (pose)
bind_pose &Transform
}
pub type ModelAnimation = C.ModelAnimation
// ModelAnimation
pub struct C.ModelAnimation {
// Number of bones
bone_count int
// Number of animation frames
frame_count int
// Bones information (skeleton)
bones &BoneInfo
// Poses array by frame
frame_poses &&Transform
// Animation name
name [32]char
}
pub type Ray = C.Ray
// Ray, ray for raycasting
pub struct C.Ray {
// Ray position (origin)
position Vector3
// Ray direction (normalized)
direction Vector3
}
pub type RayCollision = C.RayCollision
// RayCollision, ray hit information
pub struct C.RayCollision {
// Did the ray hit something?
hit bool
// Distance to the nearest hit
distance f32
// Point of the nearest hit
point Vector3
// Surface normal of hit
normal Vector3
}
pub type BoundingBox = C.BoundingBox
// BoundingBox
pub struct C.BoundingBox {
// Minimum vertex box-corner
min Vector3
// Maximum vertex box-corner
max Vector3
}
pub type Wave = C.Wave
// Wave, audio wave data
pub struct C.Wave {
// Total number of frames (considering channels)
frame_count u32
// Frequency (samples per second)
sample_rate u32
// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
sample_size u32
// Number of channels (1-mono, 2-stereo, ...)
channels u32
// Buffer data pointer
data voidptr
}
pub type AudioStream = C.AudioStream
// AudioStream, custom audio stream
pub struct C.AudioStream {
// Pointer to internal data used by the audio system
buffer &AudioBuffer
// Pointer to internal data processor, useful for audio effects
processor &AudioProcessor
// Frequency (samples per second)
sample_rate u32
// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
sample_size u32
// Number of channels (1-mono, 2-stereo, ...)
channels u32
}
pub type Sound = C.Sound
// Sound
pub struct C.Sound {
// Audio stream
stream AudioStream
// Total number of frames (considering channels)
frame_count u32
}
pub type Music = C.Music
// Music, audio stream, anything longer than ~10 seconds should be streamed
pub struct C.Music {
// Audio stream
stream AudioStream
// Total number of frames (considering channels)
frame_count u32
// Music looping enable
looping bool
// Type of music context (audio filetype)
ctx_type int
// Audio context data, depends on type
ctx_data voidptr
}
pub type VrDeviceInfo = C.VrDeviceInfo
// VrDeviceInfo, Head-Mounted-Display device parameters
pub struct C.VrDeviceInfo {
// Horizontal resolution in pixels
h_resolution int
// Vertical resolution in pixels
v_resolution int
// Horizontal size in meters
h_screen_size f32
// Vertical size in meters
v_screen_size f32
// Distance between eye and display in meters
eye_to_screen_distance f32
// Lens separation distance in meters
lens_separation_distance f32
// IPD (distance between pupils) in meters
interpupillary_distance f32
// Lens distortion constant parameters
lens_distortion_values [4]f32
// Chromatic aberration correction parameters
chroma_ab_correction [4]f32
}
pub type VrStereoConfig = C.VrStereoConfig
// VrStereoConfig, VR stereo rendering configuration for simulator
pub struct C.VrStereoConfig {
// VR projection matrices (per eye)
projection [2]Matrix
// VR view offset matrices (per eye)
view_offset [2]Matrix
// VR left lens center
left_lens_center [2]f32
// VR right lens center
right_lens_center [2]f32
// VR left screen center
left_screen_center [2]f32
// VR right screen center
right_screen_center [2]f32
// VR distortion scale
scale [2]f32
// VR distortion scale in
scale_in [2]f32
}
pub type FilePathList = C.FilePathList
// File path list
pub struct C.FilePathList {
// Filepaths max entries
capacity u32
// Filepaths entries count
count u32
// Filepaths entries
paths &&char
}
pub type AutomationEvent = C.AutomationEvent
// Automation event
pub struct C.AutomationEvent {
// Event frame
frame u32
// Event type (AutomationEventType)
typ u32
// Event parameters (if required)
params [4]int
}
pub type AutomationEventList = C.AutomationEventList
// Automation event list
pub struct C.AutomationEventList {
// Events max entries (MAX_AUTOMATION_EVENTS)
capacity u32
// Events entries count
count u32
// Events entries
events &AutomationEvent
}
// Quaternion, 4 components (Vector4 alias)
pub type Quaternion = C.Vector4
// Texture2D, same as Texture
pub type Texture2D = C.Texture
// TextureCubemap, same as Texture
pub type TextureCubemap = C.Texture
// RenderTexture2D, same as RenderTexture
pub type RenderTexture2D = C.RenderTexture
// Camera type fallback, defaults to Camera3D
pub type Camera = C.Camera3D
// Logging: Redirect trace log messages
pub type TraceLogCallback = fn (int, &char, C.va_list)
// FileIO: Load binary data
pub type LoadFileDataCallback = fn (&char, &int) &u8
// FileIO: Save binary data
pub type SaveFileDataCallback = fn (&char, voidptr, int) bool
// FileIO: Load text data
pub type LoadFileTextCallback = fn (&char) &char
// FileIO: Save text data
pub type SaveFileTextCallback = fn (&char, &char) bool
pub type AudioCallback = fn (voidptr, u32)
// System/Window config flags
@[flag]
pub enum ConfigFlags as u32 {
flag_vsync_hint // Set to try enabling V-Sync on GPU
flag_fullscreen_mode // Set to run program in fullscreen
flag_window_resizable // Set to allow resizable window
flag_window_undecorated // Set to disable window decoration (frame and buttons)
flag_window_hidden // Set to hide window
flag_window_minimized // Set to minimize window (iconify)
flag_window_maximized // Set to maximize window (expanded to monitor)
flag_window_unfocused // Set to window non focused
flag_window_topmost // Set to window always on top
flag_window_always_run // Set to allow windows running while minimized
flag_window_transparent // Set to allow transparent framebuffer
flag_window_highdpi // Set to support HighDPI
flag_window_mouse_passthrough // Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
flag_borderless_windowed_mode // Set to run program in borderless windowed mode
flag_msaa_4x_hint // Set to try enabling MSAA 4X
flag_interlaced_hint // Set to try enabling interlaced video format (for V3D)
}
// Trace log level
pub enum TraceLogLevel {
log_all = 0 // Display all logs
log_trace = 1 // Trace logging, intended for internal use only
log_debug = 2 // Debug logging, used for internal debugging, it should be disabled on release builds
log_info = 3 // Info logging, used for program execution info
log_warning = 4 // Warning logging, used on recoverable failures
log_error = 5 // Error logging, used on unrecoverable failures
log_fatal = 6 // Fatal logging, used to abort program: exit(EXIT_FAILURE)
log_none = 7 // Disable logging
}
// Keyboard keys (US keyboard layout)
pub enum KeyboardKey {
key_null = 0 // Key: NULL, used for no key pressed
key_apostrophe = 39 // Key: '
key_comma = 44 // Key: ,
key_minus = 45 // Key: -
key_period = 46 // Key: .
key_slash = 47 // Key: /
key_zero = 48 // Key: 0
key_one = 49 // Key: 1
key_two = 50 // Key: 2
key_three = 51 // Key: 3
key_four = 52 // Key: 4
key_five = 53 // Key: 5
key_six = 54 // Key: 6
key_seven = 55 // Key: 7
key_eight = 56 // Key: 8
key_nine = 57 // Key: 9
key_semicolon = 59 // Key: ;
key_equal = 61 // Key: =
key_a = 65 // Key: A | a
key_b = 66 // Key: B | b
key_c = 67 // Key: C | c
key_d = 68 // Key: D | d
key_e = 69 // Key: E | e
key_f = 70 // Key: F | f
key_g = 71 // Key: G | g
key_h = 72 // Key: H | h
key_i = 73 // Key: I | i
key_j = 74 // Key: J | j
key_k = 75 // Key: K | k
key_l = 76 // Key: L | l
key_m = 77 // Key: M | m
key_n = 78 // Key: N | n
key_o = 79 // Key: O | o
key_p = 80 // Key: P | p
key_q = 81 // Key: Q | q
key_r = 82 // Key: R | r
key_s = 83 // Key: S | s
key_t = 84 // Key: T | t
key_u = 85 // Key: U | u
key_v = 86 // Key: V | v
key_w = 87 // Key: W | w
key_x = 88 // Key: X | x
key_y = 89 // Key: Y | y
key_z = 90 // Key: Z | z
key_left_bracket = 91 // Key: [
key_backslash = 92 // Key: '\'
key_right_bracket = 93 // Key: ]
key_grave = 96 // Key: `
key_space = 32 // Key: Space
key_escape = 256 // Key: Esc
key_enter = 257 // Key: Enter
key_tab = 258 // Key: Tab
key_backspace = 259 // Key: Backspace
key_insert = 260 // Key: Ins
key_delete = 261 // Key: Del
key_right = 262 // Key: Cursor right
key_left = 263 // Key: Cursor left
key_down = 264 // Key: Cursor down
key_up = 265 // Key: Cursor up
key_page_up = 266 // Key: Page up
key_page_down = 267 // Key: Page down
key_home = 268 // Key: Home
key_end = 269 // Key: End
key_caps_lock = 280 // Key: Caps lock
key_scroll_lock = 281 // Key: Scroll down
key_num_lock = 282 // Key: Num lock
key_print_screen = 283 // Key: Print screen
key_pause = 284 // Key: Pause
key_f1 = 290 // Key: F1
key_f2 = 291 // Key: F2
key_f3 = 292 // Key: F3
key_f4 = 293 // Key: F4
key_f5 = 294 // Key: F5
key_f6 = 295 // Key: F6
key_f7 = 296 // Key: F7
key_f8 = 297 // Key: F8
key_f9 = 298 // Key: F9
key_f10 = 299 // Key: F10
key_f11 = 300 // Key: F11
key_f12 = 301 // Key: F12
key_left_shift = 340 // Key: Shift left
key_left_control = 341 // Key: Control left
key_left_alt = 342 // Key: Alt left
key_left_super = 343 // Key: Super left
key_right_shift = 344 // Key: Shift right
key_right_control = 345 // Key: Control right
key_right_alt = 346 // Key: Alt right
key_right_super = 347 // Key: Super right
key_kb_menu = 348 // Key: KB menu
key_kp_0 = 320 // Key: Keypad 0
key_kp_1 = 321 // Key: Keypad 1
key_kp_2 = 322 // Key: Keypad 2
key_kp_3 = 323 // Key: Keypad 3
key_kp_4 = 324 // Key: Keypad 4
key_kp_5 = 325 // Key: Keypad 5
key_kp_6 = 326 // Key: Keypad 6
key_kp_7 = 327 // Key: Keypad 7
key_kp_8 = 328 // Key: Keypad 8
key_kp_9 = 329 // Key: Keypad 9
key_kp_decimal = 330 // Key: Keypad .
key_kp_divide = 331 // Key: Keypad /
key_kp_multiply = 332 // Key: Keypad *
key_kp_subtract = 333 // Key: Keypad -
key_kp_add = 334 // Key: Keypad +
key_kp_enter = 335 // Key: Keypad Enter
key_kp_equal = 336 // Key: Keypad =
key_back = 4 // Key: Android back button
key_menu = 5 // Key: Android menu button
key_volume_up = 24 // Key: Android volume up button
key_volume_down = 25 // Key: Android volume down button
}
// Mouse buttons
pub enum MouseButton {
mouse_button_left = 0 // Mouse button left
mouse_button_right = 1 // Mouse button right
mouse_button_middle = 2 // Mouse button middle (pressed wheel)
mouse_button_side = 3 // Mouse button side (advanced mouse device)
mouse_button_extra = 4 // Mouse button extra (advanced mouse device)
mouse_button_forward = 5 // Mouse button forward (advanced mouse device)
mouse_button_back = 6 // Mouse button back (advanced mouse device)
}
// Mouse cursor
pub enum MouseCursor {
mouse_cursor_default = 0 // Default pointer shape
mouse_cursor_arrow = 1 // Arrow shape
mouse_cursor_ibeam = 2 // Text writing cursor shape
mouse_cursor_crosshair = 3 // Cross shape
mouse_cursor_pointing_hand = 4 // Pointing hand cursor
mouse_cursor_resize_ew = 5 // Horizontal resize/move arrow shape
mouse_cursor_resize_ns = 6 // Vertical resize/move arrow shape
mouse_cursor_resize_nwse = 7 // Top-left to bottom-right diagonal resize/move arrow shape
mouse_cursor_resize_nesw = 8 // The top-right to bottom-left diagonal resize/move arrow shape
mouse_cursor_resize_all = 9 // The omnidirectional resize/move cursor shape
mouse_cursor_not_allowed = 10 // The operation-not-allowed shape
}
// Gamepad buttons
pub enum GamepadButton {
gamepad_button_unknown = 0 // Unknown button, just for error checking
gamepad_button_left_face_up = 1 // Gamepad left DPAD up button
gamepad_button_left_face_right = 2 // Gamepad left DPAD right button
gamepad_button_left_face_down = 3 // Gamepad left DPAD down button
gamepad_button_left_face_left = 4 // Gamepad left DPAD left button
gamepad_button_right_face_up = 5 // Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)
gamepad_button_right_face_right = 6 // Gamepad right button right (i.e. PS3: Circle, Xbox: B)
gamepad_button_right_face_down = 7 // Gamepad right button down (i.e. PS3: Cross, Xbox: A)
gamepad_button_right_face_left = 8 // Gamepad right button left (i.e. PS3: Square, Xbox: X)
gamepad_button_left_trigger_1 = 9 // Gamepad top/back trigger left (first), it could be a trailing button
gamepad_button_left_trigger_2 = 10 // Gamepad top/back trigger left (second), it could be a trailing button
gamepad_button_right_trigger_1 = 11 // Gamepad top/back trigger right (first), it could be a trailing button
gamepad_button_right_trigger_2 = 12 // Gamepad top/back trigger right (second), it could be a trailing button
gamepad_button_middle_left = 13 // Gamepad center buttons, left one (i.e. PS3: Select)
gamepad_button_middle = 14 // Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)
gamepad_button_middle_right = 15 // Gamepad center buttons, right one (i.e. PS3: Start)
gamepad_button_left_thumb = 16 // Gamepad joystick pressed button left
gamepad_button_right_thumb = 17 // Gamepad joystick pressed button right
}
// Gamepad axis
pub enum GamepadAxis {
gamepad_axis_left_x = 0 // Gamepad left stick X axis
gamepad_axis_left_y = 1 // Gamepad left stick Y axis
gamepad_axis_right_x = 2 // Gamepad right stick X axis
gamepad_axis_right_y = 3 // Gamepad right stick Y axis
gamepad_axis_left_trigger = 4 // Gamepad back trigger left, pressure level: [1..-1]
gamepad_axis_right_trigger = 5 // Gamepad back trigger right, pressure level: [1..-1]
}
// Material map index
pub enum MaterialMapIndex {
material_map_albedo = 0 // Albedo material (same as: MATERIAL_MAP_DIFFUSE)
material_map_metalness = 1 // Metalness material (same as: MATERIAL_MAP_SPECULAR)
material_map_normal = 2 // Normal material
material_map_roughness = 3 // Roughness material
material_map_occlusion = 4 // Ambient occlusion material
material_map_emission = 5 // Emission material
material_map_height = 6 // Heightmap material
material_map_cubemap = 7 // Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
material_map_irradiance = 8 // Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
material_map_prefilter = 9 // Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
material_map_brdf = 10 // Brdf material
}
// Shader location index
pub enum ShaderLocationIndex {
shader_loc_vertex_position = 0 // Shader location: vertex attribute: position
shader_loc_vertex_texcoord01 = 1 // Shader location: vertex attribute: texcoord01
shader_loc_vertex_texcoord02 = 2 // Shader location: vertex attribute: texcoord02
shader_loc_vertex_normal = 3 // Shader location: vertex attribute: normal
shader_loc_vertex_tangent = 4 // Shader location: vertex attribute: tangent
shader_loc_vertex_color = 5 // Shader location: vertex attribute: color
shader_loc_matrix_mvp = 6 // Shader location: matrix uniform: model-view-projection
shader_loc_matrix_view = 7 // Shader location: matrix uniform: view (camera transform)
shader_loc_matrix_projection = 8 // Shader location: matrix uniform: projection
shader_loc_matrix_model = 9 // Shader location: matrix uniform: model (transform)
shader_loc_matrix_normal = 10 // Shader location: matrix uniform: normal
shader_loc_vector_view = 11 // Shader location: vector uniform: view
shader_loc_color_diffuse = 12 // Shader location: vector uniform: diffuse color
shader_loc_color_specular = 13 // Shader location: vector uniform: specular color
shader_loc_color_ambient = 14 // Shader location: vector uniform: ambient color
shader_loc_map_albedo = 15 // Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE)
shader_loc_map_metalness = 16 // Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR)
shader_loc_map_normal = 17 // Shader location: sampler2d texture: normal
shader_loc_map_roughness = 18 // Shader location: sampler2d texture: roughness
shader_loc_map_occlusion = 19 // Shader location: sampler2d texture: occlusion
shader_loc_map_emission = 20 // Shader location: sampler2d texture: emission
shader_loc_map_height = 21 // Shader location: sampler2d texture: height
shader_loc_map_cubemap = 22 // Shader location: samplerCube texture: cubemap
shader_loc_map_irradiance = 23 // Shader location: samplerCube texture: irradiance
shader_loc_map_prefilter = 24 // Shader location: samplerCube texture: prefilter
shader_loc_map_brdf = 25 // Shader location: sampler2d texture: brdf
shader_loc_vertex_boneids = 26 // Shader location: vertex attribute: boneIds
shader_loc_vertex_boneweights = 27 // Shader location: vertex attribute: boneWeights
shader_loc_bone_matrices = 28 // Shader location: array of matrices uniform: boneMatrices
}
// Shader uniform data type
pub enum ShaderUniformDataType {
shader_uniform_float = 0 // Shader uniform type: float
shader_uniform_vec2 = 1 // Shader uniform type: vec2 (2 float)
shader_uniform_vec3 = 2 // Shader uniform type: vec3 (3 float)
shader_uniform_vec4 = 3 // Shader uniform type: vec4 (4 float)
shader_uniform_int = 4 // Shader uniform type: int
shader_uniform_ivec2 = 5 // Shader uniform type: ivec2 (2 int)
shader_uniform_ivec3 = 6 // Shader uniform type: ivec3 (3 int)
shader_uniform_ivec4 = 7 // Shader uniform type: ivec4 (4 int)
shader_uniform_sampler2d = 8 // Shader uniform type: sampler2d
}
// Shader attribute data types
pub enum ShaderAttributeDataType {
shader_attrib_float = 0 // Shader attribute type: float
shader_attrib_vec2 = 1 // Shader attribute type: vec2 (2 float)
shader_attrib_vec3 = 2 // Shader attribute type: vec3 (3 float)
shader_attrib_vec4 = 3 // Shader attribute type: vec4 (4 float)
}
// Pixel formats
pub enum PixelFormat {
pixelformat_uncompressed_grayscale = 1 // 8 bit per pixel (no alpha)
pixelformat_uncompressed_gray_alpha = 2 // 8*2 bpp (2 channels)
pixelformat_uncompressed_r5g6b5 = 3 // 16 bpp
pixelformat_uncompressed_r8g8b8 = 4 // 24 bpp
pixelformat_uncompressed_r5g5b5a1 = 5 // 16 bpp (1 bit alpha)
pixelformat_uncompressed_r4g4b4a4 = 6 // 16 bpp (4 bit alpha)
pixelformat_uncompressed_r8g8b8a8 = 7 // 32 bpp
pixelformat_uncompressed_r32 = 8 // 32 bpp (1 channel - float)
pixelformat_uncompressed_r32g32b32 = 9 // 32*3 bpp (3 channels - float)
pixelformat_uncompressed_r32g32b32a32 = 10 // 32*4 bpp (4 channels - float)
pixelformat_uncompressed_r16 = 11 // 16 bpp (1 channel - half float)
pixelformat_uncompressed_r16g16b16 = 12 // 16*3 bpp (3 channels - half float)
pixelformat_uncompressed_r16g16b16a16 = 13 // 16*4 bpp (4 channels - half float)
pixelformat_compressed_dxt1_rgb = 14 // 4 bpp (no alpha)
pixelformat_compressed_dxt1_rgba = 15 // 4 bpp (1 bit alpha)
pixelformat_compressed_dxt3_rgba = 16 // 8 bpp
pixelformat_compressed_dxt5_rgba = 17 // 8 bpp
pixelformat_compressed_etc1_rgb = 18 // 4 bpp
pixelformat_compressed_etc2_rgb = 19 // 4 bpp
pixelformat_compressed_etc2_eac_rgba = 20 // 8 bpp
pixelformat_compressed_pvrt_rgb = 21 // 4 bpp
pixelformat_compressed_pvrt_rgba = 22 // 4 bpp
pixelformat_compressed_astc_4x4_rgba = 23 // 8 bpp
pixelformat_compressed_astc_8x8_rgba = 24 // 2 bpp
}
// Texture parameters: filter mode
pub enum TextureFilter {
texture_filter_point = 0 // No filter, just pixel approximation
texture_filter_bilinear = 1 // Linear filtering
texture_filter_trilinear = 2 // Trilinear filtering (linear with mipmaps)
texture_filter_anisotropic_4x = 3 // Anisotropic filtering 4x
texture_filter_anisotropic_8x = 4 // Anisotropic filtering 8x
texture_filter_anisotropic_16x = 5 // Anisotropic filtering 16x
}
// Texture parameters: wrap mode
pub enum TextureWrap {
texture_wrap_repeat = 0 // Repeats texture in tiled mode
texture_wrap_clamp = 1 // Clamps texture to edge pixel in tiled mode
texture_wrap_mirror_repeat = 2 // Mirrors and repeats the texture in tiled mode
texture_wrap_mirror_clamp = 3 // Mirrors and clamps to border the texture in tiled mode
}
// Cubemap layouts
pub enum CubemapLayout {
cubemap_layout_auto_detect = 0 // Automatically detect layout type
cubemap_layout_line_vertical = 1 // Layout is defined by a vertical line with faces
cubemap_layout_line_horizontal = 2 // Layout is defined by a horizontal line with faces
cubemap_layout_cross_three_by_four = 3 // Layout is defined by a 3x4 cross with cubemap faces
cubemap_layout_cross_four_by_three = 4 // Layout is defined by a 4x3 cross with cubemap faces
}
// Font type, defines generation method
pub enum FontType {
font_default = 0 // Default font generation, anti-aliased
font_bitmap = 1 // Bitmap font generation, no anti-aliasing
font_sdf = 2 // SDF font generation, requires external shader
}
// Color blending modes (pre-defined)
pub enum BlendMode {
blend_alpha = 0 // Blend textures considering alpha (default)
blend_additive = 1 // Blend textures adding colors
blend_multiplied = 2 // Blend textures multiplying colors
blend_add_colors = 3 // Blend textures adding colors (alternative)
blend_subtract_colors = 4 // Blend textures subtracting colors (alternative)
blend_alpha_premultiply = 5 // Blend premultiplied textures considering alpha
blend_custom = 6 // Blend textures using custom src/dst factors (use rlSetBlendFactors())
blend_custom_separate = 7 // Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())
}
// Gesture
@[flag]
pub enum Gesture as u32 {
gesture_none // No gesture
gesture_tap // Tap gesture
gesture_doubletap // Double tap gesture
gesture_hold // Hold gesture
gesture_drag // Drag gesture
gesture_swipe_right // Swipe right gesture
gesture_swipe_left // Swipe left gesture
gesture_swipe_up // Swipe up gesture
gesture_swipe_down // Swipe down gesture
gesture_pinch_in // Pinch in gesture
gesture_pinch_out // Pinch out gesture
}
// Camera system modes
pub enum CameraMode {
camera_custom = 0 // Camera custom, controlled by user (UpdateCamera() does nothing)
camera_free = 1 // Camera free mode
camera_orbital = 2 // Camera orbital, around target, zoom supported
camera_first_person = 3 // Camera first person
camera_third_person = 4 // Camera third person
}
// Camera projection
pub enum CameraProjection {
camera_perspective = 0 // Perspective projection
camera_orthographic = 1 // Orthographic projection
}
// N-patch layout
pub enum NPatchLayout {
npatch_nine_patch = 0 // Npatch layout: 3x3 tiles
npatch_three_patch_vertical = 1 // Npatch layout: 1x3 tiles
npatch_three_patch_horizontal = 2 // Npatch layout: 3x1 tiles
}
fn C.InitWindow(int, int, &char)
// Initialize window and OpenGL context
@[inline]
pub fn init_window(width int, height int, title string) {
C.InitWindow(width, height, title.str)
}
fn C.CloseWindow()
// Close window and unload OpenGL context
@[inline]
pub fn close_window() {
C.CloseWindow()
}
fn C.WindowShouldClose() bool
// Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
@[inline]
pub fn window_should_close() bool {
return C.WindowShouldClose()
}
fn C.IsWindowReady() bool
// Check if window has been initialized successfully
@[inline]
pub fn is_window_ready() bool {
return C.IsWindowReady()
}
fn C.IsWindowFullscreen() bool
// Check if window is currently fullscreen
@[inline]
pub fn is_window_fullscreen() bool {
return C.IsWindowFullscreen()
}
fn C.IsWindowHidden() bool