diff options
| author | realtradam <[email protected]> | 2022-02-08 03:12:31 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-02-08 03:12:31 -0500 |
| commit | 864c710a510be8e318023e34565209f9a24a3ac7 (patch) | |
| tree | f42c172c290df6ba587042f978747dc4f88ba352 /src/types.c | |
| parent | 187cab9f77a6274ba4e5bb9c012fca5549c020fb (diff) | |
| download | mruby-raylib-864c710a510be8e318023e34565209f9a24a3ac7.tar.gz mruby-raylib-864c710a510be8e318023e34565209f9a24a3ac7.zip | |
move stuff to types.h
Diffstat (limited to 'src/types.c')
| -rw-r--r-- | src/types.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/types.c b/src/types.c new file mode 100644 index 0000000..c1b3e34 --- /dev/null +++ b/src/types.c @@ -0,0 +1,52 @@ +#include "mruby-raylib/types.h" +#include <raylib.h> + +const struct mrb_data_type Color_type = { + "Color", mrb_free +}; + +const struct mrb_data_type Rectangle_type = { + "Rectangle", mrb_free +}; + +const struct mrb_data_type Texture_type = { + "Texture", helper_texture_free +}; + +void +helper_texture_free(mrb_state* mrb, void*ptr) { + Texture *texture = (Texture*)ptr; + UnloadTexture(*texture); + mrb_free(mrb, ptr); +} + +const struct mrb_data_type Sound_type = { + "Sound", helper_sound_free +}; + +void +helper_sound_free(mrb_state* mrb, void*ptr) { + Sound *sound = (Sound*)ptr; + UnloadSound(*sound); + mrb_free(mrb, ptr); +} + +const struct mrb_data_type Music_type = { + "Music", helper_music_free +}; + +void +helper_music_free(mrb_state* mrb, void*ptr) { + Music *music = (Music*)ptr; + UnloadMusicStream(*music); + mrb_free(mrb, ptr); +} + +const struct mrb_data_type Vector2_type = { + "Vector2", mrb_free +}; + +const struct mrb_data_type NPatchInfo_type = { + "NPatchInfo", mrb_free +}; + |
