ruby2d 0.9.5 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/include/SDL2/SDL.h +4 -1
- data/assets/include/SDL2/SDL_assert.h +3 -1
- data/assets/include/SDL2/SDL_atomic.h +1 -1
- data/assets/include/SDL2/SDL_audio.h +1 -1
- data/assets/include/SDL2/SDL_bits.h +1 -1
- data/assets/include/SDL2/SDL_blendmode.h +4 -1
- data/assets/include/SDL2/SDL_clipboard.h +1 -1
- data/assets/include/SDL2/SDL_config.h +1 -1
- data/assets/include/SDL2/SDL_config_android.h +7 -3
- data/assets/include/SDL2/SDL_config_iphoneos.h +16 -10
- data/assets/include/SDL2/SDL_config_macosx.h +40 -14
- data/assets/include/SDL2/SDL_config_minimal.h +1 -1
- data/assets/include/SDL2/SDL_config_os2.h +26 -8
- data/assets/include/SDL2/SDL_config_pandora.h +4 -2
- data/assets/include/SDL2/SDL_config_psp.h +2 -1
- data/assets/include/SDL2/SDL_config_windows.h +40 -9
- data/assets/include/SDL2/SDL_config_winrt.h +5 -2
- data/assets/include/SDL2/SDL_config_wiz.h +5 -2
- data/assets/include/SDL2/SDL_copying.h +1 -1
- data/assets/include/SDL2/SDL_cpuinfo.h +32 -3
- data/assets/include/SDL2/SDL_egl.h +4 -1
- data/assets/include/SDL2/SDL_endian.h +6 -3
- data/assets/include/SDL2/SDL_error.h +38 -2
- data/assets/include/SDL2/SDL_events.h +64 -28
- data/assets/include/SDL2/SDL_filesystem.h +1 -1
- data/assets/include/SDL2/SDL_gamecontroller.h +160 -9
- data/assets/include/SDL2/SDL_gesture.h +1 -1
- data/assets/include/SDL2/SDL_haptic.h +10 -1
- data/assets/include/SDL2/SDL_hints.h +316 -4
- data/assets/include/SDL2/SDL_joystick.h +115 -24
- data/assets/include/SDL2/SDL_keyboard.h +1 -1
- data/assets/include/SDL2/SDL_keycode.h +11 -9
- data/assets/include/SDL2/SDL_loadso.h +1 -1
- data/assets/include/SDL2/SDL_locale.h +101 -0
- data/assets/include/SDL2/SDL_log.h +3 -3
- data/assets/include/SDL2/SDL_main.h +1 -1
- data/assets/include/SDL2/SDL_messagebox.h +6 -4
- data/assets/include/SDL2/SDL_metal.h +117 -0
- data/assets/include/SDL2/SDL_misc.h +75 -0
- data/assets/include/SDL2/SDL_mouse.h +1 -1
- data/assets/include/SDL2/SDL_mutex.h +1 -1
- data/assets/include/SDL2/SDL_name.h +1 -1
- data/assets/include/SDL2/SDL_opengl.h +1 -1
- data/assets/include/SDL2/SDL_opengl_glext.h +3 -0
- data/assets/include/SDL2/SDL_opengles.h +1 -1
- data/assets/include/SDL2/SDL_opengles2.h +1 -1
- data/assets/include/SDL2/SDL_pixels.h +25 -16
- data/assets/include/SDL2/SDL_platform.h +1 -1
- data/assets/include/SDL2/SDL_power.h +1 -1
- data/assets/include/SDL2/SDL_quit.h +1 -1
- data/assets/include/SDL2/SDL_rect.h +1 -1
- data/assets/include/SDL2/SDL_render.h +63 -3
- data/assets/include/SDL2/SDL_revision.h +2 -2
- data/assets/include/SDL2/SDL_rwops.h +2 -10
- data/assets/include/SDL2/SDL_scancode.h +1 -1
- data/assets/include/SDL2/SDL_sensor.h +25 -9
- data/assets/include/SDL2/SDL_shape.h +1 -1
- data/assets/include/SDL2/SDL_stdinc.h +44 -4
- data/assets/include/SDL2/SDL_surface.h +11 -2
- data/assets/include/SDL2/SDL_system.h +50 -4
- data/assets/include/SDL2/SDL_syswm.h +29 -2
- data/assets/include/SDL2/SDL_test.h +1 -1
- data/assets/include/SDL2/SDL_test_assert.h +1 -1
- data/assets/include/SDL2/SDL_test_common.h +14 -1
- data/assets/include/SDL2/SDL_test_compare.h +1 -1
- data/assets/include/SDL2/SDL_test_crc32.h +1 -1
- data/assets/include/SDL2/SDL_test_font.h +1 -1
- data/assets/include/SDL2/SDL_test_fuzzer.h +1 -1
- data/assets/include/SDL2/SDL_test_harness.h +1 -1
- data/assets/include/SDL2/SDL_test_images.h +1 -1
- data/assets/include/SDL2/SDL_test_log.h +1 -1
- data/assets/include/SDL2/SDL_test_md5.h +1 -1
- data/assets/include/SDL2/SDL_test_memory.h +1 -1
- data/assets/include/SDL2/SDL_test_random.h +1 -1
- data/assets/include/SDL2/SDL_thread.h +34 -11
- data/assets/include/SDL2/SDL_timer.h +1 -1
- data/assets/include/SDL2/SDL_touch.h +1 -1
- data/assets/include/SDL2/SDL_types.h +1 -1
- data/assets/include/SDL2/SDL_version.h +2 -2
- data/assets/include/SDL2/SDL_video.h +11 -5
- data/assets/include/SDL2/SDL_vulkan.h +6 -8
- data/assets/include/SDL2/begin_code.h +5 -9
- data/assets/include/SDL2/close_code.h +1 -1
- data/assets/macos/lib/libFLAC.a +0 -0
- data/assets/macos/lib/libSDL2.a +0 -0
- data/assets/macos/lib/libSDL2_image.a +0 -0
- data/assets/macos/lib/libSDL2_mixer.a +0 -0
- data/assets/macos/lib/libSDL2_ttf.a +0 -0
- data/assets/macos/lib/libfreetype.a +0 -0
- data/assets/macos/lib/libjpeg.a +0 -0
- data/assets/macos/lib/libmpg123.a +0 -0
- data/assets/macos/lib/libogg.a +0 -0
- data/assets/macos/lib/libpng16.a +0 -0
- data/assets/macos/lib/libtiff.a +0 -0
- data/assets/macos/lib/libvorbis.a +0 -0
- data/assets/macos/lib/libvorbisfile.a +0 -0
- data/assets/macos/lib/libwebp.a +0 -0
- data/assets/mingw/bin/SDL2.dll +0 -0
- data/assets/mingw/lib/libSDL2.a +0 -0
- data/assets/mingw/lib/libSDL2.dll.a +0 -0
- data/assets/mingw/lib/libSDL2_test.a +0 -0
- data/assets/mingw/lib/libSDL2main.a +0 -0
- data/ext/ruby2d/extconf.rb +1 -1
- data/ext/ruby2d/gl.c +17 -0
- data/ext/ruby2d/gl2.c +15 -0
- data/ext/ruby2d/gl3.c +15 -0
- data/ext/ruby2d/gles.c +15 -0
- data/ext/ruby2d/music.c +13 -0
- data/ext/ruby2d/ruby2d.c +306 -168
- data/ext/ruby2d/ruby2d.h +32 -0
- data/ext/ruby2d/sound.c +25 -0
- data/ext/ruby2d/tileset.c +30 -0
- data/lib/ruby2d.rb +4 -1
- data/lib/ruby2d/circle.rb +18 -2
- data/lib/ruby2d/dsl.rb +16 -9
- data/lib/ruby2d/entity.rb +17 -0
- data/lib/ruby2d/font.rb +4 -3
- data/lib/ruby2d/image.rb +24 -1
- data/lib/ruby2d/line.rb +20 -0
- data/lib/ruby2d/music.rb +5 -0
- data/lib/ruby2d/pixel.rb +17 -0
- data/lib/ruby2d/quad.rb +18 -0
- data/lib/ruby2d/rectangle.rb +11 -2
- data/lib/ruby2d/renderable.rb +4 -8
- data/lib/ruby2d/sound.rb +5 -0
- data/lib/ruby2d/sprite.rb +35 -3
- data/lib/ruby2d/square.rb +9 -0
- data/lib/ruby2d/text.rb +22 -1
- data/lib/ruby2d/tileset.rb +69 -0
- data/lib/ruby2d/triangle.rb +16 -0
- data/lib/ruby2d/version.rb +1 -1
- data/lib/ruby2d/window.rb +249 -22
- metadata +10 -3
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
Simple DirectMedia Layer
|
3
|
-
Copyright (C) 1997-
|
3
|
+
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
4
4
|
|
5
5
|
This software is provided 'as-is', without any express or implied
|
6
6
|
warranty. In no event will the authors be held liable for any damages
|
data/assets/macos/lib/libFLAC.a
CHANGED
Binary file
|
data/assets/macos/lib/libSDL2.a
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/assets/macos/lib/libjpeg.a
CHANGED
Binary file
|
Binary file
|
data/assets/macos/lib/libogg.a
CHANGED
Binary file
|
data/assets/macos/lib/libpng16.a
CHANGED
Binary file
|
data/assets/macos/lib/libtiff.a
CHANGED
Binary file
|
Binary file
|
Binary file
|
data/assets/macos/lib/libwebp.a
CHANGED
Binary file
|
data/assets/mingw/bin/SDL2.dll
CHANGED
Binary file
|
data/assets/mingw/lib/libSDL2.a
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/ext/ruby2d/extconf.rb
CHANGED
@@ -113,7 +113,7 @@ else
|
|
113
113
|
add_flags(:ld, "#{ldir}/libjpeg.a #{ldir}/libpng16.a #{ldir}/libtiff.a #{ldir}/libwebp.a")
|
114
114
|
add_flags(:ld, "#{ldir}/libmpg123.a #{ldir}/libogg.a #{ldir}/libFLAC.a #{ldir}/libvorbis.a #{ldir}/libvorbisfile.a")
|
115
115
|
add_flags(:ld, "#{ldir}/libfreetype.a")
|
116
|
-
add_flags(:ld, "-Wl,-framework,Cocoa -Wl,-framework,ForceFeedback")
|
116
|
+
add_flags(:ld, "-Wl,-framework,Cocoa -Wl,-framework,GameController -Wl,-framework,ForceFeedback")
|
117
117
|
|
118
118
|
when :linux, :linux_rpi
|
119
119
|
check_sdl_linux
|
data/ext/ruby2d/gl.c
CHANGED
@@ -392,6 +392,23 @@ void R2D_GL_DrawSprite(R2D_Sprite *spr) {
|
|
392
392
|
}
|
393
393
|
|
394
394
|
|
395
|
+
/*
|
396
|
+
* Draw a tile
|
397
|
+
*/
|
398
|
+
void R2D_GL_DrawTile(R2D_Image *img, int x, int y, int tw, int th, GLfloat tx1, GLfloat ty1, GLfloat tx2,
|
399
|
+
GLfloat ty2, GLfloat tx3, GLfloat ty3, GLfloat tx4, GLfloat ty4) {
|
400
|
+
#if GLES
|
401
|
+
R2D_GLES_DrawTile(img, x, y, tw, th, tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4);
|
402
|
+
#else
|
403
|
+
if (R2D_GL2) {
|
404
|
+
R2D_GL2_DrawTile(img, x, y, tw, th, tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4);
|
405
|
+
} else {
|
406
|
+
R2D_GL3_DrawTile(img, x, y, tw, th, tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4);
|
407
|
+
}
|
408
|
+
#endif
|
409
|
+
}
|
410
|
+
|
411
|
+
|
395
412
|
/*
|
396
413
|
* Draw text
|
397
414
|
*/
|
data/ext/ruby2d/gl2.c
CHANGED
@@ -130,6 +130,21 @@ void R2D_GL2_DrawSprite(R2D_Sprite *spr) {
|
|
130
130
|
}
|
131
131
|
|
132
132
|
|
133
|
+
/*
|
134
|
+
* Draw a tile
|
135
|
+
*/
|
136
|
+
void R2D_GL2_DrawTile(R2D_Image *img, int x, int y, int tw, int th, GLfloat tx1, GLfloat ty1, GLfloat tx2,
|
137
|
+
GLfloat ty2, GLfloat tx3, GLfloat ty3, GLfloat tx4, GLfloat ty4) {
|
138
|
+
R2D_GL2_DrawTexture(
|
139
|
+
x, y, tw, th,
|
140
|
+
img->rotate, img->rx, img->ry,
|
141
|
+
img->color.r, img->color.g, img->color.b, img->color.a,
|
142
|
+
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4,
|
143
|
+
img->texture_id
|
144
|
+
);
|
145
|
+
}
|
146
|
+
|
147
|
+
|
133
148
|
/*
|
134
149
|
* Draw text
|
135
150
|
*/
|
data/ext/ruby2d/gl3.c
CHANGED
@@ -332,6 +332,21 @@ void R2D_GL3_DrawSprite(R2D_Sprite *spr) {
|
|
332
332
|
}
|
333
333
|
|
334
334
|
|
335
|
+
/*
|
336
|
+
* Draw a tile
|
337
|
+
*/
|
338
|
+
void R2D_GL3_DrawTile(R2D_Image *img, int x, int y, int tw, int th, GLfloat tx1, GLfloat ty1, GLfloat tx2,
|
339
|
+
GLfloat ty2, GLfloat tx3, GLfloat ty3, GLfloat tx4, GLfloat ty4) {
|
340
|
+
R2D_GL3_DrawTexture(
|
341
|
+
x, y, tw, th,
|
342
|
+
img->rotate, img->rx, img->ry,
|
343
|
+
img->color.r, img->color.g, img->color.b, img->color.a,
|
344
|
+
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4,
|
345
|
+
img->texture_id
|
346
|
+
);
|
347
|
+
}
|
348
|
+
|
349
|
+
|
335
350
|
/*
|
336
351
|
* Draw text
|
337
352
|
*/
|
data/ext/ruby2d/gles.c
CHANGED
@@ -292,6 +292,21 @@ void R2D_GLES_DrawSprite(R2D_Sprite *spr) {
|
|
292
292
|
}
|
293
293
|
|
294
294
|
|
295
|
+
/*
|
296
|
+
* Draw a tile
|
297
|
+
*/
|
298
|
+
void R2D_GLES_DrawTile(R2D_Image *img, int x, int y, int tw, int th, GLfloat tx1, GLfloat ty1, GLfloat tx2,
|
299
|
+
GLfloat ty2, GLfloat tx3, GLfloat ty3, GLfloat tx4, GLfloat ty4) {
|
300
|
+
R2D_GLES_DrawTexture(
|
301
|
+
x, y, tw, th,
|
302
|
+
img->rotate, img->rx, img->ry,
|
303
|
+
img->color.r, img->color.g, img->color.b, img->color.a,
|
304
|
+
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4,
|
305
|
+
img->texture_id
|
306
|
+
);
|
307
|
+
}
|
308
|
+
|
309
|
+
|
295
310
|
/*
|
296
311
|
* Draw text
|
297
312
|
*/
|
data/ext/ruby2d/music.c
CHANGED
@@ -33,6 +33,11 @@ R2D_Music *R2D_CreateMusic(const char *path) {
|
|
33
33
|
// Initialize values
|
34
34
|
mus->path = path;
|
35
35
|
|
36
|
+
// Calculate the length of music by creating a temporary R2D_Sound object
|
37
|
+
R2D_Sound *snd = R2D_CreateSound(path);
|
38
|
+
mus->length = R2D_GetSoundLength(snd);
|
39
|
+
R2D_FreeSound(snd);
|
40
|
+
|
36
41
|
return mus;
|
37
42
|
}
|
38
43
|
|
@@ -104,6 +109,14 @@ void R2D_FadeOutMusic(int ms) {
|
|
104
109
|
}
|
105
110
|
|
106
111
|
|
112
|
+
/*
|
113
|
+
* Get the length of the music in seconds
|
114
|
+
*/
|
115
|
+
int R2D_GetMusicLength(R2D_Music *mus) {
|
116
|
+
return mus->length;
|
117
|
+
}
|
118
|
+
|
119
|
+
|
107
120
|
/*
|
108
121
|
* Free the music
|
109
122
|
*/
|
data/ext/ruby2d/ruby2d.c
CHANGED
@@ -166,38 +166,84 @@ static R_VAL ruby2d_ext_base_path(R_VAL self) {
|
|
166
166
|
|
167
167
|
|
168
168
|
/*
|
169
|
-
* Ruby2D::
|
169
|
+
* Ruby2D::Pixel#self.ext_draw
|
170
170
|
*/
|
171
171
|
#if MRUBY
|
172
|
-
static R_VAL
|
172
|
+
static R_VAL ruby2d_pixel_ext_draw(mrb_state* mrb, R_VAL self) {
|
173
|
+
mrb_value a;
|
174
|
+
mrb_get_args(mrb, "o", &a);
|
173
175
|
#else
|
174
|
-
static R_VAL
|
176
|
+
static R_VAL ruby2d_pixel_ext_draw(R_VAL self, R_VAL a) {
|
175
177
|
#endif
|
176
|
-
|
177
|
-
|
178
|
-
|
178
|
+
// `a` is the array representing the pixel
|
179
|
+
|
180
|
+
R2D_DrawQuad(
|
181
|
+
NUM2DBL(r_ary_entry(a, 0)), // x1
|
182
|
+
NUM2DBL(r_ary_entry(a, 1)), // y1
|
183
|
+
NUM2DBL(r_ary_entry(a, 8)), // color
|
184
|
+
NUM2DBL(r_ary_entry(a, 9)), // color
|
185
|
+
NUM2DBL(r_ary_entry(a, 10)), // color
|
186
|
+
NUM2DBL(r_ary_entry(a, 11)), // color
|
187
|
+
|
188
|
+
NUM2DBL(r_ary_entry(a, 2)), // x2
|
189
|
+
NUM2DBL(r_ary_entry(a, 3)), // y2
|
190
|
+
NUM2DBL(r_ary_entry(a, 8)), // color
|
191
|
+
NUM2DBL(r_ary_entry(a, 9)), // color
|
192
|
+
NUM2DBL(r_ary_entry(a, 10)), // color
|
193
|
+
NUM2DBL(r_ary_entry(a, 11)), // color
|
194
|
+
|
195
|
+
NUM2DBL(r_ary_entry(a, 4)), // x3
|
196
|
+
NUM2DBL(r_ary_entry(a, 5)), // y3
|
197
|
+
NUM2DBL(r_ary_entry(a, 8)), // color
|
198
|
+
NUM2DBL(r_ary_entry(a, 9)), // color
|
199
|
+
NUM2DBL(r_ary_entry(a, 10)), // color
|
200
|
+
NUM2DBL(r_ary_entry(a, 11)), // color
|
201
|
+
|
202
|
+
NUM2DBL(r_ary_entry(a, 6)), // x4
|
203
|
+
NUM2DBL(r_ary_entry(a, 7)), // y4
|
204
|
+
NUM2DBL(r_ary_entry(a, 8)), // color
|
205
|
+
NUM2DBL(r_ary_entry(a, 9)), // color
|
206
|
+
NUM2DBL(r_ary_entry(a, 10)), // color
|
207
|
+
NUM2DBL(r_ary_entry(a, 11)) // color
|
208
|
+
);
|
209
|
+
|
210
|
+
return R_NIL;
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
/*
|
215
|
+
* Ruby2D::Triangle#self.ext_draw
|
216
|
+
*/
|
217
|
+
#if MRUBY
|
218
|
+
static R_VAL ruby2d_triangle_ext_draw(mrb_state* mrb, R_VAL self) {
|
219
|
+
mrb_value a;
|
220
|
+
mrb_get_args(mrb, "o", &a);
|
221
|
+
#else
|
222
|
+
static R_VAL ruby2d_triangle_ext_draw(R_VAL self, R_VAL a) {
|
223
|
+
#endif
|
224
|
+
// `a` is the array representing the triangle
|
179
225
|
|
180
226
|
R2D_DrawTriangle(
|
181
|
-
NUM2DBL(
|
182
|
-
NUM2DBL(
|
183
|
-
NUM2DBL(
|
184
|
-
NUM2DBL(
|
185
|
-
NUM2DBL(
|
186
|
-
NUM2DBL(
|
187
|
-
|
188
|
-
NUM2DBL(
|
189
|
-
NUM2DBL(
|
190
|
-
NUM2DBL(
|
191
|
-
NUM2DBL(
|
192
|
-
NUM2DBL(
|
193
|
-
NUM2DBL(
|
194
|
-
|
195
|
-
NUM2DBL(
|
196
|
-
NUM2DBL(
|
197
|
-
NUM2DBL(
|
198
|
-
NUM2DBL(
|
199
|
-
NUM2DBL(
|
200
|
-
NUM2DBL(
|
227
|
+
NUM2DBL(r_ary_entry(a, 0)), // x1
|
228
|
+
NUM2DBL(r_ary_entry(a, 1)), // y1
|
229
|
+
NUM2DBL(r_ary_entry(a, 2)), // c1 red
|
230
|
+
NUM2DBL(r_ary_entry(a, 3)), // c1 green
|
231
|
+
NUM2DBL(r_ary_entry(a, 4)), // c1 blue
|
232
|
+
NUM2DBL(r_ary_entry(a, 5)), // c1 alpha
|
233
|
+
|
234
|
+
NUM2DBL(r_ary_entry(a, 6)), // x2
|
235
|
+
NUM2DBL(r_ary_entry(a, 7)), // y2
|
236
|
+
NUM2DBL(r_ary_entry(a, 8)), // c2 red
|
237
|
+
NUM2DBL(r_ary_entry(a, 9)), // c2 green
|
238
|
+
NUM2DBL(r_ary_entry(a, 10)), // c2 blue
|
239
|
+
NUM2DBL(r_ary_entry(a, 11)), // c2 alpha
|
240
|
+
|
241
|
+
NUM2DBL(r_ary_entry(a, 12)), // x3
|
242
|
+
NUM2DBL(r_ary_entry(a, 13)), // y3
|
243
|
+
NUM2DBL(r_ary_entry(a, 14)), // c3 red
|
244
|
+
NUM2DBL(r_ary_entry(a, 15)), // c3 green
|
245
|
+
NUM2DBL(r_ary_entry(a, 16)), // c3 blue
|
246
|
+
NUM2DBL(r_ary_entry(a, 17)) // c3 alpha
|
201
247
|
);
|
202
248
|
|
203
249
|
return R_NIL;
|
@@ -205,46 +251,45 @@ static R_VAL ruby2d_triangle_ext_render(R_VAL self) {
|
|
205
251
|
|
206
252
|
|
207
253
|
/*
|
208
|
-
* Ruby2D::Quad#
|
254
|
+
* Ruby2D::Quad#self.ext_draw
|
209
255
|
*/
|
210
256
|
#if MRUBY
|
211
|
-
static R_VAL
|
257
|
+
static R_VAL ruby2d_quad_ext_draw(mrb_state* mrb, R_VAL self) {
|
258
|
+
mrb_value a;
|
259
|
+
mrb_get_args(mrb, "o", &a);
|
212
260
|
#else
|
213
|
-
static R_VAL
|
261
|
+
static R_VAL ruby2d_quad_ext_draw(R_VAL self, R_VAL a) {
|
214
262
|
#endif
|
215
|
-
|
216
|
-
R_VAL c2 = r_iv_get(self, "@c2");
|
217
|
-
R_VAL c3 = r_iv_get(self, "@c3");
|
218
|
-
R_VAL c4 = r_iv_get(self, "@c4");
|
263
|
+
// `a` is the array representing the quad
|
219
264
|
|
220
265
|
R2D_DrawQuad(
|
221
|
-
NUM2DBL(
|
222
|
-
NUM2DBL(
|
223
|
-
NUM2DBL(
|
224
|
-
NUM2DBL(
|
225
|
-
NUM2DBL(
|
226
|
-
NUM2DBL(
|
227
|
-
|
228
|
-
NUM2DBL(
|
229
|
-
NUM2DBL(
|
230
|
-
NUM2DBL(
|
231
|
-
NUM2DBL(
|
232
|
-
NUM2DBL(
|
233
|
-
NUM2DBL(
|
234
|
-
|
235
|
-
NUM2DBL(
|
236
|
-
NUM2DBL(
|
237
|
-
NUM2DBL(
|
238
|
-
NUM2DBL(
|
239
|
-
NUM2DBL(
|
240
|
-
NUM2DBL(
|
241
|
-
|
242
|
-
NUM2DBL(
|
243
|
-
NUM2DBL(
|
244
|
-
NUM2DBL(
|
245
|
-
NUM2DBL(
|
246
|
-
NUM2DBL(
|
247
|
-
NUM2DBL(
|
266
|
+
NUM2DBL(r_ary_entry(a, 0)), // x1
|
267
|
+
NUM2DBL(r_ary_entry(a, 1)), // y1
|
268
|
+
NUM2DBL(r_ary_entry(a, 2)), // c1 red
|
269
|
+
NUM2DBL(r_ary_entry(a, 3)), // c1 green
|
270
|
+
NUM2DBL(r_ary_entry(a, 4)), // c1 blue
|
271
|
+
NUM2DBL(r_ary_entry(a, 5)), // c1 alpha
|
272
|
+
|
273
|
+
NUM2DBL(r_ary_entry(a, 6)), // x2
|
274
|
+
NUM2DBL(r_ary_entry(a, 7)), // y2
|
275
|
+
NUM2DBL(r_ary_entry(a, 8)), // c2 red
|
276
|
+
NUM2DBL(r_ary_entry(a, 9)), // c2 green
|
277
|
+
NUM2DBL(r_ary_entry(a, 10)), // c2 blue
|
278
|
+
NUM2DBL(r_ary_entry(a, 11)), // c2 alpha
|
279
|
+
|
280
|
+
NUM2DBL(r_ary_entry(a, 12)), // x3
|
281
|
+
NUM2DBL(r_ary_entry(a, 13)), // y3
|
282
|
+
NUM2DBL(r_ary_entry(a, 14)), // c3 red
|
283
|
+
NUM2DBL(r_ary_entry(a, 15)), // c3 green
|
284
|
+
NUM2DBL(r_ary_entry(a, 16)), // c3 blue
|
285
|
+
NUM2DBL(r_ary_entry(a, 17)), // c3 alpha
|
286
|
+
|
287
|
+
NUM2DBL(r_ary_entry(a, 18)), // x4
|
288
|
+
NUM2DBL(r_ary_entry(a, 19)), // y4
|
289
|
+
NUM2DBL(r_ary_entry(a, 20)), // c4 red
|
290
|
+
NUM2DBL(r_ary_entry(a, 21)), // c4 green
|
291
|
+
NUM2DBL(r_ary_entry(a, 22)), // c4 blue
|
292
|
+
NUM2DBL(r_ary_entry(a, 23)) // c4 alpha
|
248
293
|
);
|
249
294
|
|
250
295
|
return R_NIL;
|
@@ -252,44 +297,43 @@ static R_VAL ruby2d_quad_ext_render(R_VAL self) {
|
|
252
297
|
|
253
298
|
|
254
299
|
/*
|
255
|
-
* Ruby2D::Line#
|
300
|
+
* Ruby2D::Line#self.ext_draw
|
256
301
|
*/
|
257
302
|
#if MRUBY
|
258
|
-
static R_VAL
|
303
|
+
static R_VAL ruby2d_line_ext_draw(mrb_state* mrb, R_VAL self) {
|
304
|
+
mrb_value a;
|
305
|
+
mrb_get_args(mrb, "o", &a);
|
259
306
|
#else
|
260
|
-
static R_VAL
|
307
|
+
static R_VAL ruby2d_line_ext_draw(R_VAL self, R_VAL a) {
|
261
308
|
#endif
|
262
|
-
|
263
|
-
R_VAL c2 = r_iv_get(self, "@c2");
|
264
|
-
R_VAL c3 = r_iv_get(self, "@c3");
|
265
|
-
R_VAL c4 = r_iv_get(self, "@c4");
|
309
|
+
// `a` is the array representing the line
|
266
310
|
|
267
311
|
R2D_DrawLine(
|
268
|
-
NUM2DBL(
|
269
|
-
NUM2DBL(
|
270
|
-
NUM2DBL(
|
271
|
-
NUM2DBL(
|
272
|
-
NUM2DBL(
|
273
|
-
|
274
|
-
NUM2DBL(
|
275
|
-
NUM2DBL(
|
276
|
-
NUM2DBL(
|
277
|
-
NUM2DBL(
|
278
|
-
|
279
|
-
NUM2DBL(
|
280
|
-
NUM2DBL(
|
281
|
-
NUM2DBL(
|
282
|
-
NUM2DBL(
|
283
|
-
|
284
|
-
NUM2DBL(
|
285
|
-
NUM2DBL(
|
286
|
-
NUM2DBL(
|
287
|
-
NUM2DBL(
|
288
|
-
|
289
|
-
NUM2DBL(
|
290
|
-
NUM2DBL(
|
291
|
-
NUM2DBL(
|
292
|
-
NUM2DBL(
|
312
|
+
NUM2DBL(r_ary_entry(a, 0)), // x1
|
313
|
+
NUM2DBL(r_ary_entry(a, 1)), // y1
|
314
|
+
NUM2DBL(r_ary_entry(a, 2)), // x2
|
315
|
+
NUM2DBL(r_ary_entry(a, 3)), // y2
|
316
|
+
NUM2DBL(r_ary_entry(a, 4)), // width
|
317
|
+
|
318
|
+
NUM2DBL(r_ary_entry(a, 5)), // c1 red
|
319
|
+
NUM2DBL(r_ary_entry(a, 6)), // c1 green
|
320
|
+
NUM2DBL(r_ary_entry(a, 7)), // c1 blue
|
321
|
+
NUM2DBL(r_ary_entry(a, 8)), // c1 alpha
|
322
|
+
|
323
|
+
NUM2DBL(r_ary_entry(a, 9)), // c2 red
|
324
|
+
NUM2DBL(r_ary_entry(a, 10)), // c2 green
|
325
|
+
NUM2DBL(r_ary_entry(a, 11)), // c2 blue
|
326
|
+
NUM2DBL(r_ary_entry(a, 12)), // c2 alpha
|
327
|
+
|
328
|
+
NUM2DBL(r_ary_entry(a, 13)), // c3 red
|
329
|
+
NUM2DBL(r_ary_entry(a, 14)), // c3 green
|
330
|
+
NUM2DBL(r_ary_entry(a, 15)), // c3 blue
|
331
|
+
NUM2DBL(r_ary_entry(a, 16)), // c3 alpha
|
332
|
+
|
333
|
+
NUM2DBL(r_ary_entry(a, 17)), // c4 red
|
334
|
+
NUM2DBL(r_ary_entry(a, 18)), // c4 green
|
335
|
+
NUM2DBL(r_ary_entry(a, 19)), // c4 blue
|
336
|
+
NUM2DBL(r_ary_entry(a, 20)) // c4 alpha
|
293
337
|
);
|
294
338
|
|
295
339
|
return R_NIL;
|
@@ -297,24 +341,26 @@ static R_VAL ruby2d_line_ext_render(R_VAL self) {
|
|
297
341
|
|
298
342
|
|
299
343
|
/*
|
300
|
-
* Ruby2D::Circle#
|
344
|
+
* Ruby2D::Circle#self.ext_draw
|
301
345
|
*/
|
302
346
|
#if MRUBY
|
303
|
-
static R_VAL
|
347
|
+
static R_VAL ruby2d_circle_ext_draw(mrb_state* mrb, R_VAL self) {
|
348
|
+
mrb_value a;
|
349
|
+
mrb_get_args(mrb, "o", &a);
|
304
350
|
#else
|
305
|
-
static R_VAL
|
351
|
+
static R_VAL ruby2d_circle_ext_draw(R_VAL self, R_VAL a) {
|
306
352
|
#endif
|
307
|
-
|
353
|
+
// `a` is the array representing the circle
|
308
354
|
|
309
355
|
R2D_DrawCircle(
|
310
|
-
NUM2DBL(
|
311
|
-
NUM2DBL(
|
312
|
-
NUM2DBL(
|
313
|
-
NUM2DBL(
|
314
|
-
NUM2DBL(
|
315
|
-
NUM2DBL(
|
316
|
-
NUM2DBL(
|
317
|
-
NUM2DBL(
|
356
|
+
NUM2DBL(r_ary_entry(a, 0)), // x
|
357
|
+
NUM2DBL(r_ary_entry(a, 1)), // y
|
358
|
+
NUM2DBL(r_ary_entry(a, 2)), // radius
|
359
|
+
NUM2DBL(r_ary_entry(a, 3)), // sectors
|
360
|
+
NUM2DBL(r_ary_entry(a, 4)), // red
|
361
|
+
NUM2DBL(r_ary_entry(a, 5)), // green
|
362
|
+
NUM2DBL(r_ary_entry(a, 6)), // blue
|
363
|
+
NUM2DBL(r_ary_entry(a, 7)) // alpha
|
318
364
|
);
|
319
365
|
|
320
366
|
return R_NIL;
|
@@ -348,34 +394,36 @@ static R_VAL ruby2d_image_ext_init(R_VAL self, R_VAL path) {
|
|
348
394
|
|
349
395
|
|
350
396
|
/*
|
351
|
-
* Ruby2D::Image#
|
397
|
+
* Ruby2D::Image#self.ext_draw
|
352
398
|
*/
|
353
399
|
#if MRUBY
|
354
|
-
static R_VAL
|
400
|
+
static R_VAL ruby2d_image_ext_draw(mrb_state* mrb, R_VAL self) {
|
401
|
+
mrb_value a;
|
402
|
+
mrb_get_args(mrb, "o", &a);
|
355
403
|
#else
|
356
|
-
static R_VAL
|
404
|
+
static R_VAL ruby2d_image_ext_draw(R_VAL self, R_VAL a) {
|
357
405
|
#endif
|
406
|
+
// `a` is the array representing the image
|
407
|
+
|
358
408
|
R2D_Image *img;
|
359
|
-
r_data_get_struct(
|
409
|
+
r_data_get_struct(r_ary_entry(a, 0), "@data", &image_data_type, R2D_Image, img);
|
360
410
|
|
361
|
-
img->x = NUM2DBL(
|
362
|
-
img->y = NUM2DBL(
|
411
|
+
img->x = NUM2DBL(r_ary_entry(a, 1));
|
412
|
+
img->y = NUM2DBL(r_ary_entry(a, 2));
|
363
413
|
|
364
|
-
R_VAL w =
|
365
|
-
R_VAL h =
|
414
|
+
R_VAL w = r_ary_entry(a, 3);
|
415
|
+
R_VAL h = r_ary_entry(a, 4);
|
366
416
|
if (r_test(w)) img->width = NUM2INT(w);
|
367
417
|
if (r_test(h)) img->height = NUM2INT(h);
|
368
418
|
|
369
|
-
R2D_RotateImage(img, NUM2DBL(
|
419
|
+
R2D_RotateImage(img, NUM2DBL(r_ary_entry(a, 5)), R2D_CENTER);
|
370
420
|
|
371
|
-
|
372
|
-
img->color.
|
373
|
-
img->color.
|
374
|
-
img->color.
|
375
|
-
img->color.a = NUM2DBL(r_iv_get(c, "@a"));
|
421
|
+
img->color.r = NUM2DBL(r_ary_entry(a, 6));
|
422
|
+
img->color.g = NUM2DBL(r_ary_entry(a, 7));
|
423
|
+
img->color.b = NUM2DBL(r_ary_entry(a, 8));
|
424
|
+
img->color.a = NUM2DBL(r_ary_entry(a, 9));
|
376
425
|
|
377
426
|
R2D_DrawImage(img);
|
378
|
-
|
379
427
|
return R_NIL;
|
380
428
|
}
|
381
429
|
|
@@ -416,45 +464,45 @@ static R_VAL ruby2d_sprite_ext_init(R_VAL self, R_VAL path) {
|
|
416
464
|
|
417
465
|
|
418
466
|
/*
|
419
|
-
* Ruby2D::Sprite#
|
467
|
+
* Ruby2D::Sprite#ext_draw
|
420
468
|
*/
|
421
469
|
#if MRUBY
|
422
|
-
static R_VAL
|
470
|
+
static R_VAL ruby2d_sprite_ext_draw(mrb_state* mrb, R_VAL self) {
|
471
|
+
mrb_value a;
|
472
|
+
mrb_get_args(mrb, "o", &a);
|
423
473
|
#else
|
424
|
-
static R_VAL
|
474
|
+
static R_VAL ruby2d_sprite_ext_draw(R_VAL self, R_VAL a) {
|
425
475
|
#endif
|
426
|
-
|
476
|
+
// `a` is the array representing the sprite
|
427
477
|
|
428
478
|
R2D_Sprite *spr;
|
429
|
-
r_data_get_struct(
|
479
|
+
r_data_get_struct(r_ary_entry(a, 0), "@data", &sprite_data_type, R2D_Sprite, spr);
|
430
480
|
|
431
|
-
spr->x = NUM2DBL(
|
432
|
-
spr->y = NUM2DBL(
|
481
|
+
spr->x = NUM2DBL(r_ary_entry(a, 1));
|
482
|
+
spr->y = NUM2DBL(r_ary_entry(a, 2));
|
433
483
|
|
434
|
-
R_VAL w =
|
484
|
+
R_VAL w = r_ary_entry(a, 3);
|
435
485
|
if (r_test(w)) spr->width = NUM2DBL(w);
|
436
486
|
|
437
|
-
R_VAL h =
|
487
|
+
R_VAL h = r_ary_entry(a, 4);
|
438
488
|
if (r_test(h)) spr->height = NUM2DBL(h);
|
439
489
|
|
440
|
-
R2D_RotateSprite(spr, NUM2DBL(
|
441
|
-
|
442
|
-
R_VAL c = r_iv_get(self, "@color");
|
443
|
-
spr->color.r = NUM2DBL(r_iv_get(c, "@r"));
|
444
|
-
spr->color.g = NUM2DBL(r_iv_get(c, "@g"));
|
445
|
-
spr->color.b = NUM2DBL(r_iv_get(c, "@b"));
|
446
|
-
spr->color.a = NUM2DBL(r_iv_get(c, "@a"));
|
490
|
+
R2D_RotateSprite(spr, NUM2DBL(r_ary_entry(a, 5)), R2D_CENTER);
|
447
491
|
|
448
492
|
R2D_ClipSprite(
|
449
493
|
spr,
|
450
|
-
NUM2INT(
|
451
|
-
NUM2INT(
|
452
|
-
NUM2INT(
|
453
|
-
NUM2INT(
|
494
|
+
NUM2INT(r_ary_entry(a, 6)),
|
495
|
+
NUM2INT(r_ary_entry(a, 7)),
|
496
|
+
NUM2INT(r_ary_entry(a, 8)),
|
497
|
+
NUM2INT(r_ary_entry(a, 9))
|
454
498
|
);
|
455
499
|
|
456
|
-
|
500
|
+
spr->color.r = NUM2DBL(r_ary_entry(a, 10));
|
501
|
+
spr->color.g = NUM2DBL(r_ary_entry(a, 11));
|
502
|
+
spr->color.b = NUM2DBL(r_ary_entry(a, 12));
|
503
|
+
spr->color.a = NUM2DBL(r_ary_entry(a, 13));
|
457
504
|
|
505
|
+
R2D_DrawSprite(spr);
|
458
506
|
return R_NIL;
|
459
507
|
}
|
460
508
|
|
@@ -472,6 +520,50 @@ static void free_sprite(R2D_Sprite *spr) {
|
|
472
520
|
}
|
473
521
|
|
474
522
|
|
523
|
+
/*
|
524
|
+
* Ruby2D::Tileset#ext_init
|
525
|
+
* Initialize tileset data
|
526
|
+
*/
|
527
|
+
static R_VAL ruby2d_tileset_ext_init(R_VAL self, R_VAL path) {
|
528
|
+
R2D_Image *img = R2D_CreateImage(RSTRING_PTR(path));
|
529
|
+
if (!img) return R_FALSE;
|
530
|
+
|
531
|
+
// Get width and height from Ruby class. If set, use it, else choose the
|
532
|
+
// native dimensions of the image.
|
533
|
+
R_VAL w = r_iv_get(self, "@width");
|
534
|
+
R_VAL h = r_iv_get(self, "@height");
|
535
|
+
r_iv_set(self, "@width" , r_test(w) ? w : INT2NUM(img->width));
|
536
|
+
r_iv_set(self, "@height", r_test(h) ? h : INT2NUM(img->height));
|
537
|
+
r_iv_set(self, "@data", r_data_wrap_struct(image, img));
|
538
|
+
|
539
|
+
return R_TRUE;
|
540
|
+
}
|
541
|
+
|
542
|
+
|
543
|
+
/*
|
544
|
+
* Ruby2D::Tileset#ext_draw
|
545
|
+
* Draws a single tile, will be called once per individual tile to draw
|
546
|
+
*/
|
547
|
+
static R_VAL ruby2d_tileset_ext_draw(R_VAL self, R_VAL a) {
|
548
|
+
// `a` is the array representing the tileset
|
549
|
+
|
550
|
+
R2D_Image *img;
|
551
|
+
r_data_get_struct(r_ary_entry(a, 0), "@data", &image_data_type, R2D_Image, img);
|
552
|
+
|
553
|
+
int tw = NUM2INT(r_ary_entry(a, 1));
|
554
|
+
int th = NUM2INT(r_ary_entry(a, 2));
|
555
|
+
int padding = NUM2INT(r_ary_entry(a, 3));
|
556
|
+
int spacing = NUM2INT(r_ary_entry(a, 4));
|
557
|
+
int tx = NUM2INT(r_ary_entry(a, 5));
|
558
|
+
int ty = NUM2INT(r_ary_entry(a, 6));
|
559
|
+
int x = NUM2INT(r_ary_entry(a, 7));
|
560
|
+
int y = NUM2INT(r_ary_entry(a, 8));
|
561
|
+
|
562
|
+
R2D_DrawTile(img, tw, th, padding, spacing, tx, ty, x, y);
|
563
|
+
return R_NIL;
|
564
|
+
}
|
565
|
+
|
566
|
+
|
475
567
|
/*
|
476
568
|
* Ruby2D::Text#ext_init
|
477
569
|
* Initialize text structure data
|
@@ -525,29 +617,31 @@ static R_VAL ruby2d_text_ext_set(R_VAL self, R_VAL text) {
|
|
525
617
|
|
526
618
|
|
527
619
|
/*
|
528
|
-
* Ruby2D::Text#
|
620
|
+
* Ruby2D::Text#self.ext_draw
|
529
621
|
*/
|
530
622
|
#if MRUBY
|
531
|
-
static R_VAL
|
623
|
+
static R_VAL ruby2d_text_ext_draw(mrb_state* mrb, R_VAL self) {
|
624
|
+
mrb_value a;
|
625
|
+
mrb_get_args(mrb, "o", &a);
|
532
626
|
#else
|
533
|
-
static R_VAL
|
627
|
+
static R_VAL ruby2d_text_ext_draw(R_VAL self, R_VAL a) {
|
534
628
|
#endif
|
629
|
+
// `a` is the array representing the text
|
630
|
+
|
535
631
|
R2D_Text *txt;
|
536
|
-
r_data_get_struct(
|
632
|
+
r_data_get_struct(r_ary_entry(a, 0), "@data", &text_data_type, R2D_Text, txt);
|
537
633
|
|
538
|
-
txt->x = NUM2DBL(
|
539
|
-
txt->y = NUM2DBL(
|
634
|
+
txt->x = NUM2DBL(r_ary_entry(a, 1));
|
635
|
+
txt->y = NUM2DBL(r_ary_entry(a, 2));
|
540
636
|
|
541
|
-
R2D_RotateText(txt, NUM2DBL(
|
637
|
+
R2D_RotateText(txt, NUM2DBL(r_ary_entry(a, 3)), R2D_CENTER);
|
542
638
|
|
543
|
-
|
544
|
-
txt->color.
|
545
|
-
txt->color.
|
546
|
-
txt->color.
|
547
|
-
txt->color.a = NUM2DBL(r_iv_get(c, "@a"));
|
639
|
+
txt->color.r = NUM2DBL(r_ary_entry(a, 4));
|
640
|
+
txt->color.g = NUM2DBL(r_ary_entry(a, 5));
|
641
|
+
txt->color.b = NUM2DBL(r_ary_entry(a, 6));
|
642
|
+
txt->color.a = NUM2DBL(r_ary_entry(a, 7));
|
548
643
|
|
549
644
|
R2D_DrawText(txt);
|
550
|
-
|
551
645
|
return R_NIL;
|
552
646
|
}
|
553
647
|
|
@@ -598,6 +692,16 @@ static R_VAL ruby2d_sound_ext_play(R_VAL self) {
|
|
598
692
|
}
|
599
693
|
|
600
694
|
|
695
|
+
/*
|
696
|
+
* Ruby2D::Sound#ext_length
|
697
|
+
*/
|
698
|
+
static R_VAL ruby2d_sound_ext_length(R_VAL self) {
|
699
|
+
R2D_Sound *snd;
|
700
|
+
r_data_get_struct(self, "@data", &sound_data_type, R2D_Sound, snd);
|
701
|
+
return INT2NUM(R2D_GetSoundLength(snd));
|
702
|
+
}
|
703
|
+
|
704
|
+
|
601
705
|
/*
|
602
706
|
* Free sound structure attached to Ruby 2D `Sound` class
|
603
707
|
*/
|
@@ -725,6 +829,16 @@ static R_VAL ruby2d_music_ext_fadeout(R_VAL self, R_VAL ms) {
|
|
725
829
|
}
|
726
830
|
|
727
831
|
|
832
|
+
/*
|
833
|
+
* Ruby2D::Music#ext_length
|
834
|
+
*/
|
835
|
+
static R_VAL ruby2d_music_ext_length(R_VAL self) {
|
836
|
+
R2D_Music *ms;
|
837
|
+
r_data_get_struct(self, "@data", &music_data_type, R2D_Music, ms);
|
838
|
+
return INT2NUM(R2D_GetMusicLength(ms));
|
839
|
+
}
|
840
|
+
|
841
|
+
|
728
842
|
/*
|
729
843
|
* Free music structure attached to Ruby 2D `Music` class
|
730
844
|
*/
|
@@ -951,8 +1065,11 @@ static void render() {
|
|
951
1065
|
// Switch on each object type
|
952
1066
|
for (int i = 0; i < num_objects; ++i) {
|
953
1067
|
R_VAL el = r_ary_entry(objects, i);
|
954
|
-
r_funcall(el, "
|
1068
|
+
r_funcall(el, "render", 0); // call the object's `render` function
|
955
1069
|
}
|
1070
|
+
|
1071
|
+
// Call render proc, `window.render`
|
1072
|
+
r_funcall(ruby2d_window, "render_callback", 0);
|
956
1073
|
}
|
957
1074
|
|
958
1075
|
|
@@ -1125,29 +1242,35 @@ void Init_ruby2d() {
|
|
1125
1242
|
// Ruby2D#self.ext_base_path
|
1126
1243
|
r_define_class_method(ruby2d_module, "ext_base_path", ruby2d_ext_base_path, r_args_none);
|
1127
1244
|
|
1245
|
+
// Ruby2D::Pixel
|
1246
|
+
R_CLASS ruby2d_pixel_class = r_define_class(ruby2d_module, "Pixel");
|
1247
|
+
|
1248
|
+
// Ruby2D::Pixel#self.ext_draw
|
1249
|
+
r_define_class_method(ruby2d_pixel_class, "ext_draw", ruby2d_pixel_ext_draw, r_args_req(1));
|
1250
|
+
|
1128
1251
|
// Ruby2D::Triangle
|
1129
1252
|
R_CLASS ruby2d_triangle_class = r_define_class(ruby2d_module, "Triangle");
|
1130
1253
|
|
1131
|
-
// Ruby2D::Triangle#
|
1132
|
-
|
1254
|
+
// Ruby2D::Triangle#self.ext_draw
|
1255
|
+
r_define_class_method(ruby2d_triangle_class, "ext_draw", ruby2d_triangle_ext_draw, r_args_req(1));
|
1133
1256
|
|
1134
1257
|
// Ruby2D::Quad
|
1135
1258
|
R_CLASS ruby2d_quad_class = r_define_class(ruby2d_module, "Quad");
|
1136
1259
|
|
1137
|
-
// Ruby2D::Quad#
|
1138
|
-
|
1260
|
+
// Ruby2D::Quad#self.ext_draw
|
1261
|
+
r_define_class_method(ruby2d_quad_class, "ext_draw", ruby2d_quad_ext_draw, r_args_req(1));
|
1139
1262
|
|
1140
1263
|
// Ruby2D::Line
|
1141
1264
|
R_CLASS ruby2d_line_class = r_define_class(ruby2d_module, "Line");
|
1142
1265
|
|
1143
|
-
// Ruby2D::Line#
|
1144
|
-
|
1266
|
+
// Ruby2D::Line#self.ext_draw
|
1267
|
+
r_define_class_method(ruby2d_line_class, "ext_draw", ruby2d_line_ext_draw, r_args_req(1));
|
1145
1268
|
|
1146
1269
|
// Ruby2D::Circle
|
1147
1270
|
R_CLASS ruby2d_circle_class = r_define_class(ruby2d_module, "Circle");
|
1148
1271
|
|
1149
|
-
// Ruby2D::Circle#
|
1150
|
-
|
1272
|
+
// Ruby2D::Circle#self.ext_draw
|
1273
|
+
r_define_class_method(ruby2d_circle_class, "ext_draw", ruby2d_circle_ext_draw, r_args_req(1));
|
1151
1274
|
|
1152
1275
|
// Ruby2D::Image
|
1153
1276
|
R_CLASS ruby2d_image_class = r_define_class(ruby2d_module, "Image");
|
@@ -1155,8 +1278,8 @@ void Init_ruby2d() {
|
|
1155
1278
|
// Ruby2D::Image#ext_init
|
1156
1279
|
r_define_method(ruby2d_image_class, "ext_init", ruby2d_image_ext_init, r_args_req(1));
|
1157
1280
|
|
1158
|
-
// Ruby2D::Image#
|
1159
|
-
|
1281
|
+
// Ruby2D::Image#self.ext_draw
|
1282
|
+
r_define_class_method(ruby2d_image_class, "ext_draw", ruby2d_image_ext_draw, r_args_req(1));
|
1160
1283
|
|
1161
1284
|
// Ruby2D::Sprite
|
1162
1285
|
R_CLASS ruby2d_sprite_class = r_define_class(ruby2d_module, "Sprite");
|
@@ -1164,8 +1287,17 @@ void Init_ruby2d() {
|
|
1164
1287
|
// Ruby2D::Sprite#ext_init
|
1165
1288
|
r_define_method(ruby2d_sprite_class, "ext_init", ruby2d_sprite_ext_init, r_args_req(1));
|
1166
1289
|
|
1167
|
-
// Ruby2D::Sprite#
|
1168
|
-
|
1290
|
+
// Ruby2D::Sprite#self.ext_draw
|
1291
|
+
r_define_class_method(ruby2d_sprite_class, "ext_draw", ruby2d_sprite_ext_draw, r_args_req(1));
|
1292
|
+
|
1293
|
+
// Ruby2D::Tileset
|
1294
|
+
R_CLASS ruby2d_tileset_class = r_define_class(ruby2d_module, "Tileset");
|
1295
|
+
|
1296
|
+
// Ruby2D::Tileset#ext_init
|
1297
|
+
r_define_method(ruby2d_tileset_class, "ext_init", ruby2d_tileset_ext_init, r_args_req(1));
|
1298
|
+
|
1299
|
+
// Ruby2D::Tileset#self.ext_draw
|
1300
|
+
r_define_class_method(ruby2d_tileset_class, "ext_draw", ruby2d_tileset_ext_draw, r_args_req(1));
|
1169
1301
|
|
1170
1302
|
// Ruby2D::Text
|
1171
1303
|
R_CLASS ruby2d_text_class = r_define_class(ruby2d_module, "Text");
|
@@ -1176,8 +1308,8 @@ void Init_ruby2d() {
|
|
1176
1308
|
// Ruby2D::Text#ext_set
|
1177
1309
|
r_define_method(ruby2d_text_class, "ext_set", ruby2d_text_ext_set, r_args_req(1));
|
1178
1310
|
|
1179
|
-
// Ruby2D::Text#
|
1180
|
-
|
1311
|
+
// Ruby2D::Text#self.ext_draw
|
1312
|
+
r_define_class_method(ruby2d_text_class, "ext_draw", ruby2d_text_ext_draw, r_args_req(1));
|
1181
1313
|
|
1182
1314
|
// Ruby2D::Sound
|
1183
1315
|
R_CLASS ruby2d_sound_class = r_define_class(ruby2d_module, "Sound");
|
@@ -1188,6 +1320,9 @@ void Init_ruby2d() {
|
|
1188
1320
|
// Ruby2D::Sound#ext_play
|
1189
1321
|
r_define_method(ruby2d_sound_class, "ext_play", ruby2d_sound_ext_play, r_args_none);
|
1190
1322
|
|
1323
|
+
// Ruby2D::Sound#ext_length
|
1324
|
+
r_define_method(ruby2d_sound_class, "ext_length", ruby2d_sound_ext_length, r_args_none);
|
1325
|
+
|
1191
1326
|
// Ruby2D::Music
|
1192
1327
|
R_CLASS ruby2d_music_class = r_define_class(ruby2d_module, "Music");
|
1193
1328
|
|
@@ -1215,6 +1350,9 @@ void Init_ruby2d() {
|
|
1215
1350
|
// Ruby2D::Music#ext_fadeout
|
1216
1351
|
r_define_method(ruby2d_music_class, "ext_fadeout", ruby2d_music_ext_fadeout, r_args_req(1));
|
1217
1352
|
|
1353
|
+
// Ruby2D::Music#ext_length
|
1354
|
+
r_define_method(ruby2d_music_class, "ext_length", ruby2d_music_ext_length, r_args_none);
|
1355
|
+
|
1218
1356
|
// Ruby2D::Window
|
1219
1357
|
R_CLASS ruby2d_window_class = r_define_class(ruby2d_module, "Window");
|
1220
1358
|
|