-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathray.ss
More file actions
3110 lines (2410 loc) · 110 KB
/
ray.ss
File metadata and controls
3110 lines (2410 loc) · 110 KB
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
(import (chezscheme))
(library (ray)
(export
Vector2 Vector3 Vector4 Quaternion Matrix Color make-rectangle make-color make-fvec fvec-at
make-vector2 make-camera2d camera2d-target-set! camera2d-rotation-set! camera2d-zoom-set!
camera2d-rotation camera2d-zoom rect-x rect-y rect-width rect-height camera2d-target-x
camera2d-target-y camera2d-offet-x camera2d-offset-y
frand-between rand-between Rectangle Image
Texture Texture2D TextureCubemap RenderTexture RenderTexture2D NPatchInfo GlyphInfo
Font Camera3D Camera Camera2D Mesh Shader MaterialMap Material Transform BoneInfo
Model ModelAnimation Ray rAudioBuffer rAudioProcessor RayCollision BoundingBox Wave
AudioStream Sound Music VrDeviceInfo VrStereoConfig FilePathList AutomationEvent
AutomationEventList init-window close-window window-should-close is-window-ready
is-window-fullscreen is-window-hidden is-window-minimized is-window-maximized
is-window-focused is-window-resized is-window-state set-window-state clear-window-state
toggle-fullscreen toggle-borderless-windowed maximize-window minimize-window
restore-window set-window-icon set-window-icons set-window-title set-window-position
set-window-monitor set-window-min-size set-window-max-size set-window-size
set-window-opacity set-window-focused get-window-handle get-screen-width
get-screen-height get-render-width get-render-height get-monitor-count
get-current-monitor get-monitor-position get-monitor-width get-monitor-height
get-monitor-physical-width get-monitor-physical-height get-monitor-refresh-rate
get-window-position get-window-scale-dpi get-monitor-name set-clipboard-text
get-clipboard-text enable-event-waiting disable-event-waiting show-cursor hide-cursor
is-cursor-hidden enable-cursor disable-cursor is-cursor-on-screen clear-background
begin-drawing end-drawing begin-mode-2d end-mode-2d begin-mode-3d end-mode-3d
begin-texture-mode end-texture-mode begin-shader-mode end-shader-mode begin-blend-mode
end-blend-mode begin-scissor-mode end-scissor-mode begin-vr-stereo-mode
end-vr-stereo-mode load-vr-stereo-config unload-vr-stereo-config load-shader
load-shader-from-memory is-shader-ready get-shader-location get-shader-location-attrib
set-shader-value set-shader-value-v set-shader-value-matrix set-shader-value-texture
unload-shader get-mouse-ray get-camera-matrix get-camera-matrix-2d get-world-to-screen
get-screen-to-world-2d get-world-to-screen-ex get-world-to-screen-2d set-target-fps
get-frame-time get-time get-fps swap-screen-buffer poll-input-events wait-time
set-random-seed get-random-value load-random-sequence unload-random-sequence
take-screenshot set-config-flags open-url trace-log set-trace-log-level mem-alloc
mem-realloc mem-free set-trace-log-callback set-load-file-data-callback
set-save-file-data-callback set-load-file-text-callback set-save-file-text-callback
load-file-data unload-file-data save-file-data export-data-as-code load-file-text
unload-file-text save-file-text file-exists directory-exists is-file-extension
get-file-length get-file-extension get-file-name get-file-name-without-ext
get-directory-path get-prev-directory-path get-working-directory
get-application-directory change-directory is-path-file load-directory-files
load-directory-files-ex unload-directory-files is-file-dropped load-dropped-files
unload-dropped-files get-file-mod-time compress-data decompress-data encode-data-base64
decode-data-base64 load-automation-event-list unload-automation-event-list
export-automation-event-list set-automation-event-list set-automation-event-base-frame
start-automation-event-recording stop-automation-event-recording play-automation-event
is-key-pressed is-key-pressed-repeat is-key-down is-key-released is-key-up
get-key-pressed get-char-pressed set-exit-key is-gamepad-available get-gamepad-name
is-gamepad-button-pressed is-gamepad-button-down is-gamepad-button-released
is-gamepad-button-up get-gamepad-button-pressed get-gamepad-axis-count
get-gamepad-axis-movement set-gamepad-mappings is-mouse-button-pressed
is-mouse-button-down is-mouse-button-released is-mouse-button-up get-mouse-x
get-mouse-y get-mouse-position get-mouse-delta set-mouse-position set-mouse-offset
set-mouse-scale get-mouse-wheel-move get-mouse-wheel-move-v set-mouse-cursor
get-touch-x get-touch-y get-touch-position get-touch-point-id get-touch-point-count
set-gestures-enabled is-gesture-detected get-gesture-detected get-gesture-hold-duration
get-gesture-drag-vector get-gesture-drag-angle get-gesture-pinch-vector
get-gesture-pinch-angle update-camera update-camera-pro set-shapes-texture draw-pixel
draw-pixel-v draw-line draw-line-v draw-line-ex draw-line-strip draw-line-bezier
draw-circle draw-circle-sector draw-circle-sector-lines draw-circle-gradient
draw-circle-v draw-circle-lines draw-circle-lines-v draw-ellipse draw-ellipse-lines
draw-ring draw-ring-lines draw-rectangle draw-rectangle-v draw-rectangle-rec
draw-rectangle-pro draw-rectangle-gradient-v draw-rectangle-gradient-h
draw-rectangle-gradient-ex draw-rectangle-lines draw-rectangle-lines-ex
draw-rectangle-rounded draw-rectangle-rounded-lines draw-triangle draw-triangle-lines
draw-triangle-fan draw-triangle-strip draw-poly draw-poly-lines draw-poly-lines-ex
draw-spline-linear draw-spline-basis draw-spline-catmull-rom draw-spline-bezier-quadratic
draw-spline-bezier-cubic draw-spline-segment-linear draw-spline-segment-basis
raw-spline-segment-catmull-ro raw-spline-segment-bezier-quadrati
raw-spline-segment-bezier-cubi et-spline-point-linea et-spline-point-basi
et-spline-point-catmull-ro et-spline-point-bezier-qua et-spline-point-bezier-cubi
heck-collision-rec heck-collision-circle heck-collision-circle-re heck-collision-point-re
heck-collision-point-circl heck-collision-point-triangl heck-collision-point-pol
heck-collision-line heck-collision-point-lin et-collision-re oad-imag oad-image-ra
oad-image-sv oad-image-ani oad-image-from-memor oad-image-from-textur
oad-image-from-scree s-image-read nload-imag export-image export-image-to-memory
export-image-as-code gen-image-color gen-image-gradient-linear gen-image-gradient-radial
gen-image-gradient-square gen-image-checked gen-image-white-noise gen-image-perlin-noise
gen-image-cellular gen-image-text image-copy image-from-image image-text image-text-ex
image-format image-to-pot image-crop image-alpha-crop image-alpha-clear image-alpha-mask
image-alpha-premultiply image-blur-gaussian image-resize image-resize-nn
image-resize-canvas image-mipmaps image-dither image-flip-vertical image-flip-horizontal
image-rotate image-rotate-cw image-rotate-ccw image-color-tint image-color-invert
image-color-grayscale image-color-contrast image-color-brightness image-color-replace
load-image-colors load-image-palette unload-image-colors unload-image-palette
get-image-alpha-border get-image-color image-clear-background image-draw-pixel
image-draw-pixel-v image-draw-line image-draw-line-v image-draw-circle image-draw-circle-v
image-draw-circle-lines image-draw-circle-lines-v image-draw-rectangle
image-draw-rectangle-v image-draw-rectangle-rec image-draw-rectangle-lines image-draw
image-draw-text image-draw-text-ex load-texture load-texture-from-image
load-texture-cubemap load-render-texture is-texture-ready unload-texture
is-render-texture-ready unload-render-texture update-texture update-texture-rec
gen-texture-mipmaps set-texture-filter set-texture-wrap draw-texture draw-texture-v
draw-texture-ex draw-texture-rec draw-texture-pro draw-texture-n-patch fade color-to-int
color-normalize color-from-normalized color-to-hsv color-from-hsv color-tint
color-brightness color-contrast color-alpha color-alpha-blend get-color get-pixel-color
set-pixel-color get-pixel-data-size get-font-default load-font load-font-ex
load-font-from-image load-font-from-memory is-font-ready load-font-data
gen-image-font-atlas unload-font-data unload-font export-font-as-code draw-fps draw-text
draw-text-ex draw-text-pro draw-text-codepoint draw-text-codepoints set-text-line-spacing
measure-text measure-text-ex get-glyph-index get-glyph-info get-glyph-atlas-rec
load-utf8 unload-utf8 load-codepoints unload-codepoints get-codepoint-count
get-codepoint get-codepoint-next get-codepoint-previous codepoint-to-utf8 text-copy
text-is-equal text-length text-subtext text-replace text-insert text-join text-split
text-append text-find-index text-to-upper text-to-lower text-to-pascal text-to-integer
draw-line-3d draw-point-3d draw-circle-3d draw-triangle-3d draw-triangle-strip-3d
draw-cube draw-cube-v draw-cube-wires draw-cube-wires-v draw-sphere draw-sphere-ex
draw-sphere-wires draw-cylinder draw-cylinder-ex draw-cylinder-wires
draw-cylinder-wires-ex draw-capsule draw-capsule-wires draw-plane draw-ray draw-grid
load-model load-model-from-mesh is-model-ready unload-model get-model-bounding-box
draw-model draw-model-ex draw-model-wires draw-model-wires-ex draw-bounding-box
draw-billboard draw-billboard-rec draw-billboard-pro upload-mesh update-mesh-buffer
unload-mesh draw-mesh draw-mesh-instanced export-mesh get-mesh-bounding-box
gen-mesh-tangents gen-mesh-poly gen-mesh-plane gen-mesh-cube gen-mesh-sphere
gen-mesh-hemi-sphere gen-mesh-cylinder gen-mesh-cone gen-mesh-torus gen-mesh-knot
gen-mesh-heightmap gen-mesh-cubicmap load-materials load-material-default
is-material-ready unload-material set-material-texture set-model-mesh-material
load-model-animations update-model-animation unload-model-animation
unload-model-animations is-model-animation-valid check-collision-spheres
check-collision-boxes check-collision-box-sphere get-ray-collision-sphere
get-ray-collision-box get-ray-collision-mesh get-ray-collision-triangle
get-ray-collision-quad init-audio-device close-audio-device is-audio-device-ready
set-master-volume get-master-volume load-wave load-wave-from-memory is-wave-ready
load-sound load-sound-from-wave load-sound-alias is-sound-ready update-sound unload-wave
unload-sound unload-sound-alias export-wave export-wave-as-code play-sound stop-sound
pause-sound resume-sound is-sound-playing set-sound-volume set-sound-pitch set-sound-pan
wave-copy wave-crop wave-format load-wave-samples unload-wave-samples load-music-stream
load-music-stream-from-memory is-music-ready unload-music-stream play-music-stream
is-music-stream-playing update-music-stream stop-music-stream pause-music-stream
resume-music-stream seek-music-stream set-music-volume set-music-pitch set-music-pan
get-music-time-length get-music-time-played load-audio-stream is-audio-stream-ready
unload-audio-stream update-audio-stream is-audio-stream-processed play-audio-stream
pause-audio-stream resume-audio-stream is-audio-stream-playing stop-audio-stream
set-audio-stream-volume set-audio-stream-pitch set-audio-stream-pan
set-audio-stream-buffer-size-default set-audio-stream-callback
attach-audio-stream-processor detach-audio-stream-processor attach-audio-mixed-processor
detach-audio-mixed-processor FLAG_VSYNC_HINT FLAG_FULLSCREEN_MODE FLAG_WINDOW_RESIZABLE
FLAG_WINDOW_UNDECORATED FLAG_WINDOW_HIDDEN FLAG_WINDOW_MINIMIZED FLAG_WINDOW_MAXIMIZED
FLAG_WINDOW_UNFOCUSED FLAG_WINDOW_TOPMOST FLAG_WINDOW_ALWAYS_RUN FLAG_WINDOW_TRANSPARENT
FLAG_WINDOW_HIGHDPI FLAG_WINDOW_MOUSE_PASSTHROUGH FLAG_BORDERLESS_WINDOWED_MODE
FLAG_MSAA_4X_HINT FLAG_INTERLACED_HINT LOG_ALL LOG_TRACE LOG_DEBUG LOG_INFO LOG_WARNING
LOG_ERROR LOG_FATAL LOG_NONE KEY_NULL KEY_APOSTROPHE KEY_COMMA KEY_MINUS KEY_PERIOD
KEY_SLASH KEY_ZERO KEY_ONE KEY_TWO KEY_THREE KEY_FOUR KEY_FIVE KEY_SIX KEY_SEVEN
KEY_EIGHT KEY_NINE KEY_SEMICOLON KEY_EQUAL KEY_A KEY_B KEY_C KEY_D KEY_E KEY_F KEY_G
KEY_H KEY_I KEY_J KEY_K KEY_L KEY_M KEY_N KEY_O KEY_P KEY_Q KEY_R KEY_S KEY_T KEY_U
KEY_V KEY_W KEY_X KEY_Y KEY_Z KEY_LEFT_BRACKET KEY_BACKSLASH KEY_RIGHT_BRACKET KEY_GRAVE
KEY_SPACE KEY_ESCAPE KEY_ENTER KEY_TAB KEY_BACKSPACE KEY_INSERT KEY_DELETE KEY_RIGHT
KEY_LEFT KEY_DOWN KEY_UP KEY_PAGE_UP KEY_PAGE_DOWN KEY_HOME KEY_END KEY_CAPS_LOCK
KEY_SCROLL_LOCK KEY_NUM_LOCK KEY_PRINT_SCREEN KEY_PAUSE KEY_F1 KEY_F2 KEY_F3 KEY_F4
KEY_F5 KEY_F6 KEY_F7 KEY_F8 KEY_F9 KEY_F10 KEY_F11 KEY_F12 KEY_LEFT_SHIFT
KEY_LEFT_CONTROL KEY_LEFT_ALT KEY_LEFT_SUPER KEY_RIGHT_SHIFT KEY_RIGHT_CONTROL
KEY_RIGHT_ALT KEY_RIGHT_SUPER KEY_KB_MENU KEY_KP_0 KEY_KP_1 KEY_KP_2 KEY_KP_3 KEY_KP_4
KEY_KP_5 KEY_KP_6 KEY_KP_7 KEY_KP_8 KEY_KP_9 KEY_KP_DECIMAL KEY_KP_DIVIDE KEY_KP_MULTIPLY
KEY_KP_SUBTRACT KEY_KP_ADD KEY_KP_ENTER KEY_KP_EQUAL KEY_BACK KEY_MENU KEY_VOLUME_UP
KEY_VOLUME_DOWN MOUSE_BUTTON_LEFT MOUSE_BUTTON_RIGHT MOUSE_BUTTON_MIDDLE
MOUSE_BUTTON_SIDE MOUSE_BUTTON_EXTRA MOUSE_BUTTON_FORWARD MOUSE_BUTTON_BACK
MOUSE_CURSOR_DEFAULT MOUSE_CURSOR_ARROW MOUSE_CURSOR_IBEAM MOUSE_CURSOR_CROSSHAIR
MOUSE_CURSOR_POINTING_HAND MOUSE_CURSOR_RESIZE_EW MOUSE_CURSOR_RESIZE_NS
MOUSE_CURSOR_RESIZE_NWSE MOUSE_CURSOR_RESIZE_NESW MOUSE_CURSOR_RESIZE_ALL
MOUSE_CURSOR_NOT_ALLOWED GAMEPAD_BUTTON_UNKNOWN GAMEPAD_BUTTON_LEFT_FACE_UP
GAMEPAD_BUTTON_LEFT_FACE_RIGHT GAMEPAD_BUTTON_LEFT_FACE_DOWN GAMEPAD_BUTTON_LEFT_FACE_LEFT
GAMEPAD_BUTTON_RIGHT_FACE_UP GAMEPAD_BUTTON_RIGHT_FACE_RIGHT GAMEPAD_BUTTON_RIGHT_FACE_DOWN
GAMEPAD_BUTTON_RIGHT_FACE_LEFT GAMEPAD_BUTTON_LEFT_TRIGGER_1 GAMEPAD_BUTTON_LEFT_TRIGGER_2
GAMEPAD_BUTTON_RIGHT_TRIGGER_1 GAMEPAD_BUTTON_RIGHT_TRIGGER_2 GAMEPAD_BUTTON_MIDDLE_LEFT
GAMEPAD_BUTTON_MIDDLE GAMEPAD_BUTTON_MIDDLE_RIGHT GAMEPAD_BUTTON_LEFT_THUMB
GAMEPAD_BUTTON_RIGHT_THUMB GAMEPAD_AXIS_LEFT_X GAMEPAD_AXIS_LEFT_Y GAMEPAD_AXIS_RIGHT_X
GAMEPAD_AXIS_RIGHT_Y GAMEPAD_AXIS_LEFT_TRIGGER GAMEPAD_AXIS_RIGHT_TRIGGER
MATERIAL_MAP_ALBEDO MATERIAL_MAP_METALNESS MATERIAL_MAP_NORMAL MATERIAL_MAP_ROUGHNESS
MATERIAL_MAP_OCCLUSION MATERIAL_MAP_EMISSION MATERIAL_MAP_HEIGHT MATERIAL_MAP_CUBEMAP
MATERIAL_MAP_IRRADIANCE MATERIAL_MAP_PREFILTER MATERIAL_MAP_BRDF SHADER_LOC_VERTEX_POSITION
SHADER_LOC_VERTEX_TEXCOORD01 SHADER_LOC_VERTEX_TEXCOORD02 SHADER_LOC_VERTEX_NORMAL
SHADER_LOC_VERTEX_TANGENT SHADER_LOC_VERTEX_COLOR SHADER_LOC_MATRIX_MVP
SHADER_LOC_MATRIX_VIEW SHADER_LOC_MATRIX_PROJECTION SHADER_LOC_MATRIX_MODEL
SHADER_LOC_MATRIX_NORMAL SHADER_LOC_VECTOR_VIEW SHADER_LOC_COLOR_DIFFUSE
SHADER_LOC_COLOR_SPECULAR SHADER_LOC_COLOR_AMBIENT SHADER_LOC_MAP_ALBEDO
SHADER_LOC_MAP_METALNESS SHADER_LOC_MAP_NORMAL SHADER_LOC_MAP_ROUGHNESS
SHADER_LOC_MAP_OCCLUSION SHADER_LOC_MAP_EMISSION SHADER_LOC_MAP_HEIGHT
SHADER_LOC_MAP_CUBEMAP SHADER_LOC_MAP_IRRADIANCE SHADER_LOC_MAP_PREFILTER
SHADER_LOC_MAP_BRDF SHADER_UNIFORM_FLOAT SHADER_UNIFORM_VEC2 SHADER_UNIFORM_VEC3
SHADER_UNIFORM_VEC4 SHADER_UNIFORM_INT SHADER_UNIFORM_IVEC2 SHADER_UNIFORM_IVEC3
SHADER_UNIFORM_IVEC4 SHADER_UNIFORM_SAMPLER2D SHADER_ATTRIB_FLOAT SHADER_ATTRIB_VEC2
SHADER_ATTRIB_VEC3 SHADER_ATTRIB_VEC4 PIXELFORMAT_UNCOMPRESSED_GRAYSCALE
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA PIXELFORMAT_UNCOMPRESSED_R5G6B5
PIXELFORMAT_UNCOMPRESSED_R8G8B8 PIXELFORMAT_UNCOMPRESSED_R5G5B5A1
PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
PIXELFORMAT_UNCOMPRESSED_R32 PIXELFORMAT_UNCOMPRESSED_R32G32B32
PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 PIXELFORMAT_UNCOMPRESSED_R16
PIXELFORMAT_UNCOMPRESSED_R16G16B16 PIXELFORMAT_UNCOMPRESSED_R16G16B16A16
PIXELFORMAT_COMPRESSED_DXT1_RGB PIXELFORMAT_COMPRESSED_DXT1_RGBA
PIXELFORMAT_COMPRESSED_DXT3_RGBA PIXELFORMAT_COMPRESSED_DXT5_RGBA
PIXELFORMAT_COMPRESSED_ETC1_RGB PIXELFORMAT_COMPRESSED_ETC2_RGB
PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA PIXELFORMAT_COMPRESSED_PVRT_RGB
PIXELFORMAT_COMPRESSED_PVRT_RGBA PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA TEXTURE_FILTER_POINT TEXTURE_FILTER_BILINEAR
TEXTURE_FILTER_TRILINEAR TEXTURE_FILTER_ANISOTROPIC_4X TEXTURE_FILTER_ANISOTROPIC_8X
TEXTURE_FILTER_ANISOTROPIC_16X TEXTURE_WRAP_REPEAT TEXTURE_WRAP_CLAMP
TEXTURE_WRAP_MIRROR_REPEAT TEXTURE_WRAP_MIRROR_CLAMP CUBEMAP_LAYOUT_AUTO_DETECT
CUBEMAP_LAYOUT_LINE_VERTICAL CUBEMAP_LAYOUT_LINE_HORIZONTAL
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE
CUBEMAP_LAYOUT_PANORAMA FONT_DEFAULT FONT_BITMAP FONT_SDF BLEND_ALPHA BLEND_ADDITIVE
BLEND_MULTIPLIED BLEND_ADD_COLORS BLEND_SUBTRACT_COLORS BLEND_ALPHA_PREMULTIPLY
BLEND_CUSTOM BLEND_CUSTOM_SEPARATE GESTURE_NONE GESTURE_TAP GESTURE_DOUBLETAP
GESTURE_HOLD GESTURE_DRAG GESTURE_SWIPE_RIGHT GESTURE_SWIPE_LEFT GESTURE_SWIPE_UP
GESTURE_SWIPE_DOWN GESTURE_PINCH_IN GESTURE_PINCH_OUT CAMERA_CUSTOM CAMERA_FREE
CAMERA_ORBITAL CAMERA_FIRST_PERSON CAMERA_THIRD_PERSON CAMERA_PERSPECTIVE
CAMERA_ORTHOGRAPHIC NPATCH_NINE_PATCH NPATCH_THREE_PATCH_VERTICAL
NPATCH_THREE_PATCH_HORIZONTAL LIGHTGRAY GRAY DARKGRAY YELLOW GOLD ORANGE PINK RED
MAROON GREEN LIME DARKGREEN SKYBLUE BLUE DARKBLUE PURPLE VIOLET DARKPURPLE BEIGE
BROWN DARKBROWN WHITE BLACK BLANK MAGENTA RAYWHITE)
(import (chezscheme))
(define *raylib*
(case (machine-type)
((i3nt ti3nt a6nt ta6nt) (load-shared-object "raylib.dll"))
((i3le ti3le a6le ta6le) (load-shared-object "libraylib.so"))
((i3osx ti3osx a6osx ta6osx) (load-shared-object "libraylib.dylib"))))
;; GC related routines
(define *guardian* (make-guardian))
;; Register object with guardian
;; params:
;; obj - object being guarded
;; proc - func that will be invoked by gc to free object
(define (register-object obj proc)
(let [(x (cons obj proc))]
(*guardian* x)
x))
;; Simple finalizer which invokes foreign-free on the object
;; Assumes obj was allocated using foreign-free and was not previously freed.
(define (finalizer x)
(foreign-free x))
(define run-finalizers
(lambda ()
(let run ()
(let ([x (*guardian*)])
(when x
(((cdr x) (car x)) 'erased)
(run))))))
(define-ftype Vector2
(struct
[x float]
[y float]))
(define (vector2-x v)
(ftype-ref Vector2 (x) v))
(define (vector2-y v)
(ftype-ref Vector2 (y) v))
(define-ftype Vector3
(struct
[x float]
[y float]
[z float]))
(define-ftype Vector4
(struct
[x float]
[y float]
[z float]
[w float]))
(define-ftype Quaternion Vector4)
(define-ftype Matrix
(struct
[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]))
(define-ftype Color
(struct
[r unsigned-8]
[g unsigned-8]
[b unsigned-8]
[a unsigned-8]))
(define-ftype Rectangle
(struct
[x float]
[y float]
[width float]
[height float]))
(define (rect-x r)
(ftype-ref Rectangle (x) r))
(define (rect-y r)
(ftype-ref Rectangle (y) r))
(define (rect-width r)
(ftype-ref Rectangle (width) r))
(define (rect-height r)
(ftype-ref Rectangle (height) r))
(define-ftype Image
(struct
[data void*]
[width int]
[height int]
[mipmaps int]
[format int]))
(define-ftype Texture
(struct
[id unsigned-int]
[width int]
[height int]
[mipmaps int]
[format int]))
(define-ftype Texture2D Texture)
(define-ftype TextureCubemap Texture)
(define-ftype RenderTexture
(struct
[id unsigned-int]
[texture Texture]
[depth Texture]))
(define-ftype RenderTexture2D RenderTexture)
(define-ftype NPatchInfo
(struct
[source Rectangle]
[left int]
[top int]
[right int]
[bottom int]
[layout int]))
(define-ftype GlyphInfo
(struct
[value int]
[offsetX int]
[offsetY int]
[advanceX int]
[image Image]))
(define-ftype Font
(struct
[baseSize int]
[glyphCount int]
[glyphPadding int]
[texture Texture2D]
[recs (* Rectangle)]
[glyphs (* GlyphInfo)]))
(define-ftype Camera3D
(struct
[position Vector3]
[target Vector3]
[up Vector3]
[fovy float]
[projection int]))
(define-ftype Camera Camera3D)
(define-ftype Camera2D
(struct
[offset Vector2]
[target Vector2]
[rotation float]
[zoom float]))
(define (make-camera2d offset target rotation zoom)
(let* ((c (make-ftype-pointer Camera2D (foreign-alloc (ftype-sizeof Camera2D))))
(offset-x (ftype-&ref Camera2D (offset x) c))
(offset-y (ftype-&ref Camera2D (offset y) c))
(target-x (ftype-&ref Camera2D (target x) c))
(target-y (ftype-&ref Camera2D (target y) c)))
(ftype-set! float () offset-x (ftype-ref Vector2 (x) offset))
(ftype-set! float () offset-y (ftype-ref Vector2 (y) target))
(ftype-set! float () target-x (ftype-ref Vector2 (x) offset))
(ftype-set! float () target-y (ftype-ref Vector2 (y) offset))
(ftype-set! Camera2D (rotation) c (inexact rotation))
(ftype-set! Camera2D (zoom) c (inexact zoom))
(register-object c finalizer)
c))
(define (camera2d-target-set! c x y)
(ftype-set! Camera2D (target x) c (inexact x))
(ftype-set! Camera2D (target y) c (inexact y)))
(define (camera2d-rotation-set! c r)
(ftype-set! Camera2D (rotation) c (inexact r)))
(define (camera2d-zoom-set! c z)
(ftype-set! Camera2D (zoom) c (inexact z)))
(define (camera2d-rotation c)
(ftype-ref Camera2D (rotation) c))
(define (camera2d-zoom c)
(ftype-ref Camera2D (zoom) c))
(define (camera2d-target-x c)
(ftype-ref Camera2D (target x) c))
(define (camera2d-target-y c)
(ftype-ref Camera2D (target y) c))
(define (camera2d-offet-x c)
(ftype-ref Camera2D (offset x) c))
(define (camera2d-offset-y c)
(ftype-ref Camera2D (offset y) c))
(define-ftype Mesh
(struct
[vertexCount int]
[triangleCount int]
[vertices (* float)]
[texcoords (* float)]
[texcoords2 (* float)]
[normals (* float)]
[tangents (* float)]
[colors (* unsigned-8)]
[indices (* unsigned-16)]
[animVertices (* float)]
[animNormals (* float)]
[boneIds (* unsigned-8)]
[boneWeights (* float)]
[vaoId unsigned-int]
[vboId (* unsigned-int)]))
(define-ftype Shader
(struct
[id unsigned-int]
[locs (* int)]))
(define-ftype MaterialMap
(struct
[texture Texture2D]
[color Color]
[value float]))
(define-ftype Material
(struct
[shader Shader]
[maps (* MaterialMap)]
[params (array 4 float)]))
(define-ftype Transform
(struct
[translation Vector3]
[rotation Quaternion]
[scale Vector3]))
;; BoneInfo
(define-ftype BoneInfo
(struct
[name (array 32 char)]
[parent int]))
;; Model
(define-ftype Model
(struct
[transform Matrix]
[meshCount int]
[materialCount int]
[meshes (* Mesh)]
[materials (* Material)]
[meshMaterial (* int)]
[boneCount int]
[bones (* BoneInfo)]
[bindPose (* Transform)]))
;; ModelAnimation
(define-ftype ModelAnimation
(struct
[boneCount int]
[frameCount int]
[bones (* BoneInfo)]
[framePoses (* (* Transform))]
[name (array 32 char)]))
;; Ray
(define-ftype rAudioBuffer void*)
(define-ftype rAudioProcessor void*)
(define-ftype Ray
(struct
[position Vector3]
[direction Vector3]))
;; RayCollision
(define-ftype RayCollision
(struct
[hit boolean]
[distance float]
[point Vector3]
[normal Vector3]))
;; BoundingBox
(define-ftype BoundingBox
(struct
[min Vector3]
[max Vector3]))
;; Wave
(define-ftype Wave
(struct
[frameCount unsigned-int]
[sampleRate unsigned-int]
[sampleSize unsigned-int]
[channels unsigned-int]
[data void*]))
;; AudioStream
(define-ftype AudioStream
(struct
[buffer rAudioBuffer]
[processor rAudioProcessor]
[sampleRate unsigned-int]
[sampleSize unsigned-int]
[channels unsigned-int]))
;; Sound
(define-ftype Sound
(struct
[stream AudioStream]
[frameCount unsigned-int]))
;; Music
(define-ftype Music
(struct
[stream AudioStream]
[frameCount unsigned-int]
[looping boolean]
[ctxType int]
[ctxData void*]))
;; VrDeviceInfo
(define-ftype VrDeviceInfo
(struct
[hResolution int]
[vResolution int]
[hScreenSize float]
[vScreenSize float]
[vScreenCenter float]
[eyeToScreenDistance float]
[lensSeparationDistance float]
[interpupillaryDistance float]
[lensDistortionValues (array 4 float)]
[chromaAbCorrection (array 4 float)]))
;; VrStereoConfig
(define-ftype VrStereoConfig
(struct
[projection (array 2 Matrix)]
[viewOffset (array 2 Matrix)]
[leftLensCenter (array 2 float)]
[rightLensCenter (array 2 float)]
[leftScreenCenter (array 2 float)]
[rightScreenCenter (array 2 float)]
[scale (array 2 float)]
[scaleIn (array 2 float)]))
;; FilePathList
(define-ftype FilePathList
(struct
[capacity unsigned-int]
[count unsigned-int]
[paths (* (* char))]))
;; AutomationEvent
(define-ftype AutomationEvent
(struct
[frame unsigned-int]
[type unsigned-int]
[params (array 4 int)]))
;; AutomationEventList
(define-ftype AutomationEventList
(struct
[capacity unsigned-int]
[count unsigned-int]
[events (* AutomationEvent)]))
;; Constructors
;; Vector2 constructor
(define (make-vector2 x y)
(let ((v (make-ftype-pointer Vector2 (foreign-alloc (ftype-sizeof Vector2)))))
(ftype-set! Vector2 (x) v (inexact x))
(ftype-set! Vector2 (y) v (inexact y))
(register-object v finalizer)
v))
;; Vector3 constructor
(define (make-vector3 x y z)
(let ((v (make-ftype-pointer Vector3 (foreign-alloc (ftype-sizeof Vector3)))))
(ftype-set! Vector3 (x) v x)
(ftype-set! Vector3 (y) v y)
(ftype-set! Vector3 (z) v z)
(register-object v finalizer)
v))
;; Vector4 constructor
(define (make-vector4 x y z w)
(let ((v (make-ftype-pointer Vector4 (foreign-alloc (ftype-sizeof Vector4)))))
(ftype-set! Vector4 (x) v x)
(ftype-set! Vector4 (y) v y)
(ftype-set! Vector4 (z) v z)
(ftype-set! Vector4 (w) v w)
(register-object v finalizer)
v))
;; Quaternion constructor (same as Vector4)
(define make-quaternion make-vector4)
;; Matrix constructor
(define (make-matrix m0 m4 m8 m12 m1 m5 m9 m13 m2 m6 m10 m14 m3 m7 m11 m15)
(let ((m (make-ftype-pointer Matrix (foreign-alloc (ftype-sizeof Matrix)))))
(ftype-set! Matrix (m0) m m0)
(ftype-set! Matrix (m4) m m4)
(ftype-set! Matrix (m8) m m8)
(ftype-set! Matrix (m12) m m12)
(ftype-set! Matrix (m1) m m1)
(ftype-set! Matrix (m5) m m5)
(ftype-set! Matrix (m9) m m9)
(ftype-set! Matrix (m13) m m13)
(ftype-set! Matrix (m2) m m2)
(ftype-set! Matrix (m6) m m6)
(ftype-set! Matrix (m10) m m10)
(ftype-set! Matrix (m14) m m14)
(ftype-set! Matrix (m3) m m3)
(ftype-set! Matrix (m7) m m7)
(ftype-set! Matrix (m11) m m11)
(ftype-set! Matrix (m15) m m15)
(register-object m finalizer)
m))
;; Rectangle constructor
(define (make-rectangle x y width height)
(let ((r (make-ftype-pointer Rectangle (foreign-alloc (ftype-sizeof Rectangle)))))
(ftype-set! Rectangle (x) r x)
(ftype-set! Rectangle (y) r y)
(ftype-set! Rectangle (width) r width)
(ftype-set! Rectangle (height) r height)
(register-object r finalizer)
r))
;; Image constructor
(define (make-image data width height mipmaps format)
(let ((i (make-ftype-pointer Image (foreign-alloc (ftype-sizeof Image)))))
(ftype-set! Image (data) i data)
(ftype-set! Image (width) i width)
(ftype-set! Image (height) i height)
(ftype-set! Image (mipmaps) i mipmaps)
(ftype-set! Image (format) i format)
(register-object i finalizer)
i))
;; Texture constructor
(define (make-texture id width height mipmaps format)
(let ((t (make-ftype-pointer Texture (foreign-alloc (ftype-sizeof Texture)))))
(ftype-set! Texture (id) t id)
(ftype-set! Texture (width) t width)
(ftype-set! Texture (height) t height)
(ftype-set! Texture (mipmaps) t mipmaps)
(ftype-set! Texture (format) t format)
(register-object t finalizer)
t))
;; Texture2D constructor (same as Texture)
(define make-texture2d make-texture)
;; TextureCubemap constructor (same as Texture)
(define make-texture-cubemap make-texture)
;; RenderTexture constructor
;; (define (make-render-texture id texture depth)
;; (let ((rt (make-ftype-pointer RenderTexture (foreign-alloc (ftype-sizeof RenderTexture)))))
;; (ftype-set! RenderTexture (id) rt id)
;; (ftype-set! RenderTexture (texture) rt texture)
;; (ftype-set! RenderTexture (depth) rt depth)
;; (register-object rt finalizer)
;; rt))
;; RenderTexture2D constructor (same as RenderTexture)
;;(define make-render-texture2d make-render-texture)
;; NPatchInfo constructor
;; (define (make-npatch-info source left top right bottom layout)
;; (let ((np (make-ftype-pointer NPatchInfo (foreign-alloc (ftype-sizeof NPatchInfo)))))
;; (ftype-set! NPatchInfo (source) np source)
;; (ftype-set! NPatchInfo (left) np left)
;; (ftype-set! NPatchInfo (top) np top)
;; (ftype-set! NPatchInfo (right) np right)
;; (ftype-set! NPatchInfo (bottom) np bottom)
;; (ftype-set! NPatchInfo (layout) np layout)
;; (register-object np finalizer)
;; np))
;; ;; GlyphInfo constructor
;; (define (make-glyph-info value offsetX offsetY advanceX image)
;; (let ((gi (make-ftype-pointer GlyphInfo (foreign-alloc (ftype-sizeof GlyphInfo)))))
;; (ftype-set! GlyphInfo (value) gi value)
;; (ftype-set! GlyphInfo (offsetX) gi offsetX)
;; (ftype-set! GlyphInfo (offsetY) gi offsetY)
;; (ftype-set! GlyphInfo (advanceX) gi advanceX)
;; (ftype-set! GlyphInfo (image) gi image)
;; (register-object gi finalizer)
;; gi))
;; ;; Font constructor
;; (define (make-font baseSize glyphCount glyphPadding texture recs glyphs)
;; (let ((f (make-ftype-pointer Font (foreign-alloc (ftype-sizeof Font)))))
;; (ftype-set! Font (baseSize) f baseSize)
;; (ftype-set! Font (glyphCount) f glyphCount)
;; (ftype-set! Font (glyphPadding) f glyphPadding)
;; (ftype-set! Font (texture) f texture)
;; (ftype-set! Font (recs) f recs)
;; (ftype-set! Font (glyphs) f glyphs)
;; (register-object f finalizer)
;; f))
;; ;; Camera3D constructor
;; (define (make-camera3d position target up fovy projection)
;; (let ((c (make-ftype-pointer Camera3D (foreign-alloc (ftype-sizeof Camera3D)))))
;; (ftype-set! Camera3D (position) c position)
;; (ftype-set! Camera3D (target) c target)
;; (ftype-set! Camera3D (up) c up)
;; (ftype-set! Camera3D (fovy) c fovy)
;; (ftype-set! Camera3D (projection) c projection)
;; (register-object c finalizer)
;; c))
;; ;; Camera constructor (same as Camera3D)
;; (define make-camera make-camera3d)
;; ;; Camera2D constructor
;; ;; Color constructor
(define (make-color r g b a)
(let ((c (make-ftype-pointer Color (foreign-alloc (ftype-sizeof Color)))))
(ftype-set! Color (r) c r)
(ftype-set! Color (g) c g)
(ftype-set! Color (b) c b)
(ftype-set! Color (a) c a)
(register-object c finalizer)
c))
;; ;; Mesh constructor
;; (define (make-mesh vertexCount triangleCount vertices texcoords texcoords2 normals tangents colors indices animVertices animNormals boneIds boneWeights vaoId vboId)
;; (let ((m (make-ftype-pointer Mesh (foreign-alloc (ftype-sizeof Mesh)))))
;; (ftype-set! Mesh (vertexCount) m vertexCount)
;; (ftype-set! Mesh (triangleCount) m triangleCount)
;; (ftype-set! Mesh (vertices) m vertices)
;; (ftype-set! Mesh (texcoords) m texcoords)
;; (ftype-set! Mesh (texcoords2) m texcoords2)
;; (ftype-set! Mesh (normals) m normals)
;; (ftype-set! Mesh (tangents) m tangents)
;; (ftype-set! Mesh (colors) m colors)
;; (ftype-set! Mesh (indices) m indices)
;; (ftype-set! Mesh (animVertices) m animVertices)
;; (ftype-set! Mesh (animNormals) m animNormals)
;; (ftype-set! Mesh (boneIds) m boneIds)
;; (ftype-set! Mesh (boneWeights) m boneWeights)
;; (ftype-set! Mesh (vaoId) m vaoId)
;; (ftype-set! Mesh (vboId) m vboId)
;; (register-object m finalizer)
;; m))
;; ;; Shader constructor
;; (define (make-shader id locs)
;; (let ((s (make-ftype-pointer Shader (foreign-alloc (ftype-sizeof Shader)))))
;; (ftype-set! Shader (id) s id)
;; (ftype-set! Shader (locs) s locs)
;; (register-object s finalizer)
;; s))
;; ;; MaterialMap constructor
;; (define (make-material-map texture color value)
;; (let ((mm (make-ftype-pointer MaterialMap (foreign-alloc (ftype-sizeof MaterialMap)))))
;; (ftype-set! MaterialMap (texture) mm texture)
;; (ftype-set! MaterialMap (color) mm color)
;; (ftype-set! MaterialMap (value) mm value)
;; (register-object mm finalizer)
;; mm))
;; ;; Material constructor
;; (define (make-material shader maps params)
;; (let ((m (make-ftype-pointer Material (foreign-alloc (ftype-sizeof Material)))))
;; (ftype-set! Material (shader) m shader)
;; (ftype-set! Material (maps) m maps)
;; (ftype-set! Material (params) m params)
;; (register-object m finalizer)
;; m))
;; ;; Transform constructor
;; (define (make-transform translation rotation scale)
;; (let ((t (make-ftype-pointer Transform (foreign-alloc (ftype-sizeof Transform)))))
;; (ftype-set! Transform (translation) t translation)
;; (ftype-set! Transform (rotation) t rotation)
;; (ftype-set! Transform (scale) t scale)
;; (register-object t finalizer)
;; t))
;; ;; BoneInfo constructor
;; (define (make-bone-info name parent)
;; (let ((bi (make-ftype-pointer BoneInfo (foreign-alloc (ftype-sizeof BoneInfo)))))
;; (ftype-set! BoneInfo (name) bi name)
;; (ftype-set! BoneInfo (parent) bi parent)
;; (register-object bi finalizer)
;; bi))
;; ;; Model constructor
;; (define (make-model transform meshCount materialCount meshes materials meshMaterial boneCount bones bindPose)
;; (let ((m (make-ftype-pointer Model (foreign-alloc (ftype-sizeof Model)))))
;; (ftype-set! Model (transform) m transform)
;; (ftype-set! Model (meshCount) m meshCount)
;; (ftype-set! Model (materialCount) m materialCount)
;; (ftype-set! Model (meshes) m meshes)
;; (ftype-set! Model (materials) m materials)
;; (ftype-set! Model (meshMaterial) m meshMaterial)
;; (ftype-set! Model (boneCount) m boneCount)
;; (ftype-set! Model (bones) m bones)
;; (ftype-set! Model (bindPose) m bindPose)
;; (register-object m finalizer)
;; m))
;; ;; ModelAnimation constructor
;; (define (make-model-animation boneCount frameCount bones framePoses name)
;; (let ((ma (make-ftype-pointer ModelAnimation (foreign-alloc (ftype-sizeof ModelAnimation)))))
;; (ftype-set! ModelAnimation (boneCount) ma boneCount)
;; (ftype-set! ModelAnimation (frameCount) ma frameCount)
;; (ftype-set! ModelAnimation (bones) ma bones)
;; (ftype-set! ModelAnimation (framePoses) ma framePoses)
;; (ftype-set! ModelAnimation (name) ma name)
;; (register-object ma finalizer)
;; ma))
;; ;; Ray constructor
;; (define (make-ray position direction)
;; (let ((r (make-ftype-pointer Ray (foreign-alloc (ftype-sizeof Ray)))))
;; (ftype-set! Ray (position) r position)
;; (ftype-set! Ray (direction) r direction)
;; (register-object r finalizer)
;; r))
;; ;; RayCollision constructor
;; (define (make-ray-collision hit distance point normal)
;; (let ((rc (make-ftype-pointer RayCollision (foreign-alloc (ftype-sizeof RayCollision)))))
;; (ftype-set! RayCollision (hit) rc hit)
;; (ftype-set! RayCollision (distance) rc distance)
;; (ftype-set! RayCollision (point) rc point)
;; (ftype-set! RayCollision (normal) rc normal)
;; (register-object rc finalizer)
;; rc))
;; ;; BoundingBox constructor
;; (define (make-bounding-box min max)
;; (let ((bb (make-ftype-pointer BoundingBox (foreign-alloc (ftype-sizeof BoundingBox)))))
;; (ftype-set! BoundingBox (min) bb min)
;; (ftype-set! BoundingBox (max) bb max)
;; (register-object bb finalizer)
;; bb))
;; ;; Wave constructor
;; (define (make-wave frameCount sampleRate sampleSize channels data)
;; (let ((w (make-ftype-pointer Wave (foreign-alloc (ftype-sizeof Wave)))))
;; (ftype-set! Wave (frameCount) w frameCount)
;; (ftype-set! Wave (sampleRate) w sampleRate)
;; (ftype-set! Wave (sampleSize) w sampleSize)
;; (ftype-set! Wave (channels) w channels)
;; (ftype-set! Wave (data) w data)
;; (register-object w finalizer)
;; w))
;; ;; AudioStream constructor
;; (define (make-audio-stream buffer processor sampleRate sampleSize channels)
;; (let ((as (make-ftype-pointer AudioStream (foreign-alloc (ftype-sizeof AudioStream)))))
;; (ftype-set! AudioStream (buffer) as buffer)
;; (ftype-set! AudioStream (processor) as processor)
;; (ftype-set! AudioStream (sampleRate) as sampleRate)
;; (ftype-set! AudioStream (sampleSize) as sampleSize)
;; (ftype-set! AudioStream (channels) as channels)
;; (register-object as finalizer)
;; as))
;; ;; Sound constructor
;; (define (make-sound stream frameCount)
;; (let ((s (make-ftype-pointer Sound (foreign-alloc (ftype-sizeof Sound)))))
;; (ftype-set! Sound (stream) s stream)
;; (ftype-set! Sound (frameCount) s frameCount)
;; (register-object s finalizer)
;; s))
;; ;; Music constructor
;; (define (make-music stream frameCount looping ctxType ctxData)
;; (let ((m (make-ftype-pointer Music (foreign-alloc (ftype-sizeof Music)))))
;; (ftype-set! Music (stream) m stream)
;; (ftype-set! Music (frameCount) m frameCount)
;; (ftype-set! Music (looping) m looping)
;; (ftype-set! Music (ctxType) m ctxType)
;; (ftype-set! Music (ctxData) m ctxData)
;; (register-object m finalizer)
;; m))
;; ;; VrDeviceInfo constructor
;; (define (make-vr-device-info hResolution vResolution hScreenSize vScreenSize vScreenCenter eyeToScreenDistance lensSeparationDistance interpupillaryDistance lensDistortionValues chromaAbCorrection)
;; (let ((vdi (make-ftype-pointer VrDeviceInfo (foreign-alloc (ftype-sizeof VrDeviceInfo)))))
;; (ftype-set! VrDeviceInfo (hResolution) vdi hResolution)
;; (ftype-set! VrDeviceInfo (vResolution) vdi vResolution)
;; (ftype-set! VrDeviceInfo (hScreenSize) vdi hScreenSize)
;; (ftype-set! VrDeviceInfo (vScreenSize) vdi vScreenSize)
;; (ftype-set! VrDeviceInfo (vScreenCenter) vdi vScreenCenter)
;; (ftype-set! VrDeviceInfo (eyeToScreenDistance) vdi eyeToScreenDistance)
;; (ftype-set! VrDeviceInfo (lensSeparationDistance) vdi lensSeparationDistance)
;; (ftype-set! VrDeviceInfo (interpupillaryDistance) vdi interpupillaryDistance)
;; (ftype-set! VrDeviceInfo (lensDistortionValues) vdi lensDistortionValues)
;; (ftype-set! VrDeviceInfo (chromaAbCorrection) vdi chromaAbCorrection)
;; (register-object vdi finalizer)
;; vdi))
;; ;; VrStereoConfig constructor
;; (define (make-vr-stereo-config projection viewOffset leftLensCenter rightLensCenter leftScreenCenter rightScreenCenter scale scaleIn)
;; (let ((vsc (make-ftype-pointer VrStereoConfig (foreign-alloc (ftype-sizeof VrStereoConfig)))))
;; (ftype-set! VrStereoConfig (projection) vsc projection)
;; (ftype-set! VrStereoConfig (viewOffset) vsc viewOffset)
;; (ftype-set! VrStereoConfig (leftLensCenter) vsc leftLensCenter)
;; (ftype-set! VrStereoConfig (rightLensCenter) vsc rightLensCenter)
;; (ftype-set! VrStereoConfig (leftScreenCenter) vsc leftScreenCenter)
;; (ftype-set! VrStereoConfig (rightScreenCenter) vsc rightScreenCenter)
;; (ftype-set! VrStereoConfig (scale) vsc scale)
;; (ftype-set! VrStereoConfig (scaleIn) vsc scaleIn)
;; (register-object vsc finalizer)
;; vsc))
;; ;; FilePathList constructor
;; (define (make-file-path-list capacity count paths)
;; (let ((fpl (make-ftype-pointer FilePathList (foreign-alloc (ftype-sizeof FilePathList)))))
;; (ftype-set! FilePathList (capacity) fpl capacity)
;; (ftype-set! FilePathList (count) fpl count)
;; (ftype-set! FilePathList (paths) fpl paths)
;; (register-object fpl finalizer)
;; fpl))
;; ;; AutomationEvent constructor
;; (define (make-automation-event frame type params)
;; (let ((ae (make-ftype-pointer AutomationEvent (foreign-alloc (ftype-sizeof AutomationEvent)))))
;; (ftype-set! AutomationEvent (frame) ae frame)
;; (ftype-set! AutomationEvent (type) ae type)
;; (ftype-set! AutomationEvent (params) ae params)
;; (register-object ae finalizer)
;; ae))
;; ;; AutomationEventList constructor
;; (define (make-automation-event-list capacity count events)
;; (let ((ael (make-ftype-pointer AutomationEventList (foreign-alloc (ftype-sizeof AutomationEventList)))))
;; (ftype-set! AutomationEventList (capacity) ael capacity)
;; (ftype-set! AutomationEventList (count) ael count)
;; (ftype-set! AutomationEventList (events) ael events)
;; (register-object ael finalizer)
;; ael))
;; Sequences
(define-syntax make-fvec
(lambda (stx)
(syntax-case stx ()
((_ type num-elements)
#'(let ((fptr (make-ftype-pointer type (foreign-alloc (* num-elements (ftype-sizeof type))))))
(register-object fptr finalizer)
fptr)))))
(define-syntax fvec-at
(lambda (stx)
(syntax-case stx ()
((_ ftype v idx)
#'(make-ftype-pointer ftype (+ (ftype-pointer-address v) (* idx (ftype-sizeof ftype))))))))
(define init-window
(foreign-procedure "InitWindow" (int int string) void))
(define close-window
(foreign-procedure "CloseWindow" () void))
(define window-should-close
(foreign-procedure "WindowShouldClose" () boolean))