summaryrefslogtreecommitdiffhomepage
path: root/src/types.c
blob: c1b3e3432faa37fd63573caa1ce9cf3e9dcd8941 (plain)
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
#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
};