From 363a6f056a95f1329d2ab6043b9246703ae30632 Mon Sep 17 00:00:00 2001 From: realtradam Date: Fri, 21 Jan 2022 19:15:04 -0500 Subject: textures free correctly --- src/raylib.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/raylib.c b/src/raylib.c index 376ec50..0215fae 100644 --- a/src/raylib.c +++ b/src/raylib.c @@ -12,6 +12,7 @@ #if defined(PLATFORM_WEB) void execute_emscripten_block(void*); #endif +void helper_texture_free(mrb_state*, void*); bool check_collision_circle_rec(mrb_state* mrb, mrb_value circle_obj, mrb_value rect_obj); @@ -20,9 +21,16 @@ static const struct mrb_data_type Color_type = { }; static const struct mrb_data_type Texture_type = { - "Texture", mrb_free + "Texture", helper_texture_free }; +void +helper_texture_free(mrb_state* mrb, void*ptr) { + Texture *texture = (Texture*)ptr; + UnloadTexture(*texture); + mrb_free(mrb, ptr); +} + static const struct mrb_data_type Sound_type = { "Sound", mrb_free }; -- cgit v1.2.3