;;; ------- ;;; structs ;;; ------- ;; Color, 4 components, R8G8B8A8 (32bit) (c-define-type color (struct "Color")) ;; color constructor (define make-color (c-lambda (unsigned-int8 unsigned-int8 unsigned-int8 unsigned-int8) color #<< c-lambda Color col = (Color){___arg1, ___arg2, ___arg3, ___arg4 }; ___return(col); c-lambda )) ;; color getters (define color-red (c-lambda (color) unsigned-int8 #<< c-lambda ___return(___arg1.r); c-lambda )) (define color-blue (c-lambda (color) unsigned-int8 #<< c-lambda ___return(___arg1.b); c-lambda )) (define color-green (c-lambda (color) unsigned-int8 #<< c-lambda ___return(___arg1.g); c-lambda )) (define color-alpha (c-lambda (color) unsigned-int8 #<< c-lambda ___return(___arg1.a); c-lambda )) ;; color setters (define color-red-set! (c-lambda (color unsigned-int8) void #<< c-lambda ___arg1.r = ___arg2; c-lambda )) (define color-blue-set! (c-lambda (color unsigned-int8) void #<< c-lambda ___arg1.b = ___arg2; c-lambda )) (define color-green-set! (c-lambda (color unsigned-int8) void #<< c-lambda ___arg1.g = ___arg2; c-lambda )) (define color-alpha-set! (c-lambda (color unsigned-int8) void #<< c-lambda ___arg1.a = ___arg2; c-lambda )) ;; vector2, 2 float components, x32y32 (64 bits) (c-define-type vec2 (struct "Vector2")) ;; vec2 constructor (define make-vec2 (c-lambda (float float) vec2 #<< c-lambda Vector2 v = (Vector2){___arg1, ___arg2}; ___return(v); c-lambda )) ;; vec2 getters (define vec2-x (c-lambda (vec2) float "___return(___arg1.x);")) (define vec2-y (c-lambda (vec2) float "___return(___arg1.y);")) ;; vec2 setters (define vec2-x-set! (c-lambda (vec2 float) void "___arg1.x = ___arg2;")) (define vec2-y-set! (c-lambda (vec2 float) void "___arg1.y = ___arg2;")) ;; Rectangle, 4 float components, x32y32w32h32 (128 bits) (c-define-type rec (struct "Rectangle")) ;; vec2 constructor (define make-rec (c-lambda (float float float float) rec #<< c-lambda Rectangle r = (Rectangle){___arg1, ___arg2, ___arg3, ___arg4}; ___return(r); c-lambda )) ;; vec2 getters (define rec-x (c-lambda (rec) float "___return(___arg1.x);")) (define rec-y (c-lambda (rec) float "___return(___arg1.y);")) (define rec-width (c-lambda (rec) float "___return(___arg1.width);")) (define rec-height (c-lambda (rec) float "___return(___arg1.height);")) ;; vec2 setters (define rec-x-set! (c-lambda (rec float) void "___arg1.x = ___arg2;")) (define rec-y-set! (c-lambda (rec float) void "___arg1.y = ___arg2;")) (define rec-width-set! (c-lambda (rec float) void "___arg1.width = ___arg2;")) (define rec-height-set! (c-lambda (rec float) void "___arg1.height = ___arg2;")) ;; texture, 5 components, id32w32h32mipmaps32format32 (160bit) (c-define-type texture (struct "Texture")) ;; RenderTexture, 3 components: uint id, Texture tex, Texture depth (c-define-type render-texture (struct "RenderTexture")) (define render-texture-id (c-lambda (render-texture) int "___return(___arg1.id);")) (define render-texture-tex (c-lambda (render-texture) texture "___return(___arg1.texture);")) (define render-texture-depth (c-lambda (render-texture) texture "___return(___arg1.depth);")) (define load-render-texture (c-lambda (int int) render-texture "LoadRenderTexture")) (define render-texture-ready? (c-lambda (render-texture) bool "IsRenderTextureReady")) (define unload-render-texture (c-lambda (render-texture) void "UnloadRenderTexture"))