diff options
author | Henrique Alves <henrique.alves@itsjungle.xyz> | 2024-04-25 23:51:58 +0300 |
---|---|---|
committer | Henrique Alves <henrique.alves@itsjungle.xyz> | 2024-04-25 23:51:58 +0300 |
commit | a7cc19f9e254d0ee391b2b65ef6da6e471da803c (patch) | |
tree | 5ef2d2c1974c4500942f78e38eccc06b38fafecb /sources/text.h | |
parent | 3f382e6e0a494baaf3d4d104c1af0630fb3817a9 (diff) | |
download | gamejam-slgj-2024-a7cc19f9e254d0ee391b2b65ef6da6e471da803c.tar.gz gamejam-slgj-2024-a7cc19f9e254d0ee391b2b65ef6da6e471da803c.tar.bz2 gamejam-slgj-2024-a7cc19f9e254d0ee391b2b65ef6da6e471da803c.zip |
Adding more API
Diffstat (limited to 'sources/text.h')
-rw-r--r-- | sources/text.h | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/sources/text.h b/sources/text.h index fed7181..a0e3497 100644 --- a/sources/text.h +++ b/sources/text.h @@ -3,38 +3,12 @@ #include <stdio.h> #include <stdlib.h> -int texture_2d_tag; - -static s7_pointer free_texture_2d(s7_scheme *s7, s7_pointer obj) { - Texture2D *texture = (Texture2D *) s7_c_object_value(obj); - UnloadTexture(*texture); - free(texture); - return(NULL); -} - static s7_pointer rl_draw_text(s7_scheme *s7, s7_pointer args) { + printf("%s\n", s7_string(s7_car(args))); DrawText(s7_string(s7_car(args)), 200, 80, 20, RED); return(NULL); } -static s7_pointer rl_draw_texture(s7_scheme *s7, s7_pointer args) { - Texture2D *texture = (Texture2D *) s7_c_object_value(s7_car(args)); - DrawTexture(*texture, 100, 100, WHITE); - return(NULL); -} - -static s7_pointer rl_load_texture(s7_scheme *s7, s7_pointer args) { - Texture2D texture = LoadTexture("./assets/test.png"); - Texture2D *texture_ptr = (Texture2D *) malloc(sizeof(Texture2D)); - *texture_ptr = texture; - return (s7_make_c_object(s7, texture_2d_tag, (void *) texture_ptr)); -} - static void rl_text_define_methods(s7_scheme *s7) { - s7_define_safe_function(s7, "rl-draw-text", rl_draw_text, 1, 0, false, "test"); - s7_define_safe_function(s7, "rl-load-texture", rl_load_texture, 0, 0, false, "test"); - s7_define_safe_function(s7, "rl-draw-texture", rl_draw_texture, 1, 0, false, "test"); - - texture_2d_tag = s7_make_c_type(s7, "texture-2d"); - s7_c_type_set_gc_free(s7, texture_2d_tag, free_texture_2d); + s7_define_function(s7, "rl-draw-text", rl_draw_text, 1, 0, false, "test"); } |