ruby-miyako 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +275 -20
- data/extern.h +21 -1
- data/install_miyako.rb +5 -3
- data/lib/Miyako/API/audio.rb +11 -6
- data/lib/Miyako/API/basic_data.rb +0 -985
- data/lib/Miyako/API/bitmap.rb +19 -22
- data/lib/Miyako/API/choices.rb +203 -69
- data/lib/Miyako/API/collision.rb +451 -9
- data/lib/Miyako/API/color.rb +177 -0
- data/lib/Miyako/API/diagram.rb +18 -20
- data/lib/Miyako/API/fixedmap.rb +207 -73
- data/lib/Miyako/API/font.rb +111 -18
- data/lib/Miyako/API/i_yuki.rb +1201 -0
- data/lib/Miyako/API/input.rb +65 -0
- data/lib/Miyako/API/layout.rb +41 -29
- data/lib/Miyako/API/map.rb +202 -157
- data/lib/Miyako/API/map_event.rb +86 -19
- data/lib/Miyako/API/map_struct.rb +268 -0
- data/lib/Miyako/API/modules.rb +136 -37
- data/lib/Miyako/API/movie.rb +8 -8
- data/lib/Miyako/API/parts.rb +63 -20
- data/lib/Miyako/API/plane.rb +4 -4
- data/lib/Miyako/API/screen.rb +16 -8
- data/lib/Miyako/API/sprite.rb +290 -23
- data/lib/Miyako/API/sprite_animation.rb +23 -11
- data/lib/Miyako/API/sprite_list.rb +406 -183
- data/lib/Miyako/API/story.rb +4 -65
- data/lib/Miyako/API/struct_point.rb +157 -0
- data/lib/Miyako/API/struct_rect.rb +233 -0
- data/lib/Miyako/API/struct_segment.rb +641 -0
- data/lib/Miyako/API/struct_size.rb +158 -0
- data/lib/Miyako/API/struct_square.rb +253 -0
- data/lib/Miyako/API/textbox.rb +49 -35
- data/lib/Miyako/API/viewport.rb +5 -5
- data/lib/Miyako/API/wait_counter.rb +350 -0
- data/lib/Miyako/API/yuki.rb +95 -60
- data/lib/Miyako/EXT/raster_scroll.rb +30 -8
- data/lib/Miyako/EXT/slides.rb +6 -6
- data/lib/Miyako/miyako.rb +25 -11
- data/lib/miyako.rb +28 -0
- data/lib/miyako_require_only.rb +35 -0
- data/miyako_basicdata.c +201 -17
- data/miyako_collision.c +315 -6
- data/miyako_diagram.c +331 -0
- data/miyako_drawing.c +26 -7
- data/miyako_font.c +259 -129
- data/miyako_input_audio.c +24 -14
- data/miyako_layout.c +106 -8
- data/miyako_no_katana.c +398 -171
- data/miyako_sprite2.c +275 -38
- data/miyako_transform.c +113 -107
- data/miyako_utility.c +34 -48
- data/miyako_yuki.c +241 -0
- data/sample/Diagram_sample/diagram_sample_yuki2.rb +30 -30
- data/sample/Room3/blue.rb +19 -19
- data/sample/Room3/green.rb +9 -9
- data/sample/Room3/main.rb +12 -12
- data/sample/Room3/red.rb +12 -12
- data/sample/Room3/title.rb +15 -10
- data/sample/collision_test2.rb +2 -1
- data/sample/fixed_map_test/fixed_map_sample.rb +7 -6
- data/sample/map_test/main_scene.rb +12 -10
- data/sample/map_test/map_manager.rb +14 -13
- data/sample/rasterscroll.rb +5 -5
- data/sample/takahashi.rb +3 -3
- data/sample/textbox_sample.rb +7 -6
- data/sample/transform.rb +2 -1
- data/uninstall_miyako.rb +4 -1
- data/win/miyako_no_katana.so +0 -0
- metadata +15 -4
- data/lib/Miyako/EXT/miyako_cairo.rb +0 -62
- data/sample/cairo_sample.rb +0 -25
data/miyako_no_katana.c
CHANGED
@@ -32,6 +32,10 @@ License:: LGPL2.1
|
|
32
32
|
static VALUE mSDL = Qnil;
|
33
33
|
static VALUE mMiyako = Qnil;
|
34
34
|
static VALUE mScreen = Qnil;
|
35
|
+
static VALUE mAudio = Qnil;
|
36
|
+
static VALUE mInput = Qnil;
|
37
|
+
static VALUE mSpriteBase = Qnil;
|
38
|
+
static VALUE mAnimation = Qnil;
|
35
39
|
static VALUE mDiagram = Qnil;
|
36
40
|
static VALUE cSurface = Qnil;
|
37
41
|
static VALUE cGL = Qnil;
|
@@ -40,22 +44,37 @@ static VALUE cThread = Qnil;
|
|
40
44
|
static VALUE cSprite = Qnil;
|
41
45
|
static VALUE cSpriteAnimation = Qnil;
|
42
46
|
static VALUE cPlane = Qnil;
|
43
|
-
#if 0
|
44
|
-
static VALUE cParts = Qnil;
|
45
|
-
#endif
|
46
47
|
static VALUE cMap = Qnil;
|
47
48
|
static VALUE cMapLayer = Qnil;
|
48
49
|
static VALUE cFixedMap = Qnil;
|
49
50
|
static VALUE cFixedMapLayer = Qnil;
|
50
|
-
static VALUE
|
51
|
+
static VALUE cTextbox = Qnil;
|
51
52
|
static VALUE nZero = Qnil;
|
52
53
|
static VALUE nOne = Qnil;
|
53
|
-
static volatile ID id_update
|
54
|
-
static volatile ID id_kakko
|
55
|
-
static volatile ID
|
56
|
-
static volatile ID
|
57
|
-
static volatile
|
58
|
-
static volatile
|
54
|
+
static volatile ID id_update = Qnil;
|
55
|
+
static volatile ID id_kakko = Qnil;
|
56
|
+
static volatile ID id_kakko_eq = Qnil;
|
57
|
+
static volatile ID id_render = Qnil;
|
58
|
+
static volatile ID id_render_to = Qnil;
|
59
|
+
static volatile ID id_to_a = Qnil;
|
60
|
+
static volatile ID id_move = Qnil;
|
61
|
+
static volatile ID id_move_to = Qnil;
|
62
|
+
static volatile ID id_defined = Qnil;
|
63
|
+
static volatile ID id_pos = Qnil;
|
64
|
+
static volatile ID id_ua = Qnil;
|
65
|
+
static volatile ID id_start = Qnil;
|
66
|
+
static volatile ID id_stop = Qnil;
|
67
|
+
static volatile ID id_reset = Qnil;
|
68
|
+
static volatile int zero = Qnil;
|
69
|
+
static volatile int one = Qnil;
|
70
|
+
static const char *str_visible = "@visible";
|
71
|
+
static const char *str_textarea = "@textarea";
|
72
|
+
static const char *str_waiting = "@waiting";
|
73
|
+
static const char *str_wait_cursor = "@wait_cursor";
|
74
|
+
static const char *str_selecting = "@selecting";
|
75
|
+
static const char *str_select_cursor = "@select_cursor";
|
76
|
+
static const char *str_choices = "@choices";
|
77
|
+
static const char *str_ahash = "@@anim_hash";
|
59
78
|
|
60
79
|
// from rubysdl_video.c
|
61
80
|
static GLOBAL_DEFINE_GET_STRUCT(Surface, GetSurface, cSurface, "SDL::Surface");
|
@@ -73,6 +92,32 @@ extern void Init_miyako_font();
|
|
73
92
|
extern void Init_miyako_utility();
|
74
93
|
extern void Init_miyako_sprite2();
|
75
94
|
extern void Init_miyako_input_audio();
|
95
|
+
extern void Init_miyako_diagram();
|
96
|
+
extern void Init_miyako_yuki();
|
97
|
+
|
98
|
+
static VALUE anim_m_update(VALUE self);
|
99
|
+
|
100
|
+
static VALUE miyako_main_loop(int argc, VALUE *argv, VALUE self)
|
101
|
+
{
|
102
|
+
VALUE clear = Qnil;
|
103
|
+
int is_clear = 0;
|
104
|
+
if(argc == 0){ is_clear = 1; }
|
105
|
+
rb_scan_args(argc, argv, "01", &clear);
|
106
|
+
if(clear != Qnil && clear != Qfalse){ is_clear = 1; }
|
107
|
+
rb_need_block();
|
108
|
+
for(;;)
|
109
|
+
{
|
110
|
+
_miyako_audio_update();
|
111
|
+
_miyako_input_update();
|
112
|
+
_miyako_counter_update();
|
113
|
+
if(is_clear){ _miyako_screen_clear(); }
|
114
|
+
rb_yield(Qnil);
|
115
|
+
_miyako_counter_post_update();
|
116
|
+
anim_m_update(mAnimation);
|
117
|
+
_miyako_screen_render();
|
118
|
+
}
|
119
|
+
return Qnil;
|
120
|
+
}
|
76
121
|
|
77
122
|
/*
|
78
123
|
===内部用レンダメソッド
|
@@ -80,13 +125,13 @@ extern void Init_miyako_input_audio();
|
|
80
125
|
static void render_to_inner(MiyakoBitmap *sb, MiyakoBitmap *db)
|
81
126
|
{
|
82
127
|
if(sb->ptr == db->ptr){ return; }
|
83
|
-
|
128
|
+
|
84
129
|
MiyakoSize size;
|
85
130
|
if(_miyako_init_rect(sb, db, &size) == 0) return;
|
86
|
-
|
131
|
+
|
87
132
|
SDL_LockSurface(sb->surface);
|
88
133
|
SDL_LockSurface(db->surface);
|
89
|
-
|
134
|
+
|
90
135
|
int x, y;
|
91
136
|
for(y = 0; y < size.h; y++)
|
92
137
|
{
|
@@ -158,13 +203,55 @@ static void render_inner(MiyakoBitmap *sb, MiyakoBitmap *db)
|
|
158
203
|
SDL_BlitSurface(sb->surface, &(sb->rect), db->surface, &(db->rect));
|
159
204
|
}
|
160
205
|
|
206
|
+
/*
|
207
|
+
インスタンスの内容を画面に描画する
|
208
|
+
*/
|
209
|
+
static VALUE sprite_b_render_xy(VALUE self, VALUE vx, VALUE vy)
|
210
|
+
{
|
211
|
+
if(rb_iv_get(self, str_visible) == Qfalse) return self;
|
212
|
+
VALUE cls = rb_obj_class(self);
|
213
|
+
if(rb_funcall(cls, id_defined, ID2SYM(id_move_to)) == Qfalse ||
|
214
|
+
rb_funcall(cls, id_defined, ID2SYM(id_pos)) == Qfalse ){
|
215
|
+
rb_funcall(self, id_render, 0);
|
216
|
+
return self;
|
217
|
+
}
|
218
|
+
VALUE *p_pos = RSTRUCT_PTR(_miyako_layout_pos(self));
|
219
|
+
VALUE x = *(p_pos + 0);
|
220
|
+
VALUE y = *(p_pos + 1);
|
221
|
+
_miyako_layout_move_to(self, vx, vy);
|
222
|
+
rb_funcall(self, id_render, 0);
|
223
|
+
_miyako_layout_move_to(self, x, y);
|
224
|
+
return self;
|
225
|
+
}
|
226
|
+
|
227
|
+
/*
|
228
|
+
インスタンスの内容を別のインスタンスに描画する
|
229
|
+
*/
|
230
|
+
static VALUE sprite_b_render_xy_to_sprite(VALUE self, VALUE vdst, VALUE vx, VALUE vy)
|
231
|
+
{
|
232
|
+
if(rb_iv_get(self, str_visible) == Qfalse) return self;
|
233
|
+
VALUE cls = rb_obj_class(self);
|
234
|
+
if(rb_funcall(cls, id_defined, ID2SYM(id_move_to)) == Qfalse ||
|
235
|
+
rb_funcall(cls, id_defined, ID2SYM(id_pos)) == Qfalse ){
|
236
|
+
rb_funcall(self, id_render_to, 1, vdst);
|
237
|
+
return self;
|
238
|
+
}
|
239
|
+
VALUE *p_pos = RSTRUCT_PTR(_miyako_layout_pos(self));
|
240
|
+
VALUE x = *(p_pos + 0);
|
241
|
+
VALUE y = *(p_pos + 1);
|
242
|
+
_miyako_layout_move_to(self, vx, vy);
|
243
|
+
rb_funcall(self, id_render_to, 1, vdst);
|
244
|
+
_miyako_layout_move_to(self, x, y);
|
245
|
+
return self;
|
246
|
+
}
|
247
|
+
|
161
248
|
/*
|
162
249
|
インスタンスの内容を別のインスタンスに描画する
|
163
250
|
*/
|
164
251
|
static VALUE sprite_c_render_to_sprite(VALUE self, VALUE vsrc, VALUE vdst)
|
165
252
|
{
|
166
|
-
|
167
|
-
|
253
|
+
MiyakoBitmap src, dst;
|
254
|
+
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
168
255
|
_miyako_setup_unit_2(vsrc, vdst, scr, &src, &dst, Qnil, Qnil, 1);
|
169
256
|
render_to_inner(&src, &dst);
|
170
257
|
return self;
|
@@ -175,25 +262,98 @@ static VALUE sprite_c_render_to_sprite(VALUE self, VALUE vsrc, VALUE vdst)
|
|
175
262
|
*/
|
176
263
|
static VALUE sprite_render(VALUE self)
|
177
264
|
{
|
178
|
-
|
179
|
-
|
265
|
+
if(rb_iv_get(self, str_visible) == Qfalse) return self;
|
266
|
+
|
267
|
+
VALUE src_unit = rb_iv_get(self, "@unit");
|
268
|
+
VALUE dst_unit = rb_iv_get(mScreen, "@@unit");
|
269
|
+
|
270
|
+
SDL_Surface *src = GetSurface(*(RSTRUCT_PTR(src_unit)+0))->surface;
|
271
|
+
SDL_Surface *dst = GetSurface(*(RSTRUCT_PTR(dst_unit)+0))->surface;
|
272
|
+
|
273
|
+
SDL_Rect srect, drect;
|
274
|
+
|
275
|
+
VALUE *s_p = RSTRUCT_PTR(src_unit);
|
276
|
+
srect.x = NUM2INT(*(s_p + 1));
|
277
|
+
srect.y = NUM2INT(*(s_p + 2));
|
278
|
+
srect.w = NUM2INT(*(s_p + 3));
|
279
|
+
srect.h = NUM2INT(*(s_p + 4));
|
280
|
+
|
281
|
+
VALUE *d_p = RSTRUCT_PTR(dst_unit);
|
282
|
+
drect.x = NUM2INT(*(d_p + 1)) + NUM2INT(*(s_p + 5));
|
283
|
+
drect.y = NUM2INT(*(d_p + 2)) + NUM2INT(*(s_p + 6));
|
284
|
+
drect.w = NUM2INT(*(d_p + 3));
|
285
|
+
drect.h = NUM2INT(*(d_p + 4));
|
286
|
+
|
287
|
+
SDL_BlitSurface(src, &srect, dst, &drect);
|
288
|
+
return self;
|
289
|
+
}
|
290
|
+
|
291
|
+
VALUE _miyako_sprite_render(VALUE sprite)
|
292
|
+
{
|
293
|
+
return sprite_render(sprite);
|
294
|
+
}
|
295
|
+
|
296
|
+
/*
|
297
|
+
インスタンスの内容を別のインスタンスに描画する
|
298
|
+
*/
|
299
|
+
static VALUE sprite_render_to_sprite(VALUE self, VALUE vdst)
|
300
|
+
{
|
301
|
+
if(rb_iv_get(self, str_visible) == Qfalse) return self;
|
180
302
|
MiyakoBitmap src, dst;
|
181
303
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
182
|
-
_miyako_setup_unit_2(self,
|
183
|
-
|
304
|
+
_miyako_setup_unit_2(self, vdst, scr, &src, &dst, Qnil, Qnil, 1);
|
305
|
+
render_to_inner(&src, &dst);
|
184
306
|
return self;
|
185
307
|
}
|
186
308
|
|
309
|
+
/*
|
310
|
+
インスタンスの内容を画面に描画する
|
311
|
+
*/
|
312
|
+
static VALUE sprite_render_xy(VALUE self, VALUE vx, VALUE vy)
|
313
|
+
{
|
314
|
+
if(rb_iv_get(self, str_visible) == Qfalse) return self;
|
315
|
+
|
316
|
+
VALUE src_unit = rb_iv_get(self, "@unit");
|
317
|
+
VALUE dst_unit = rb_iv_get(mScreen, "@@unit");
|
318
|
+
|
319
|
+
SDL_Surface *src = GetSurface(*(RSTRUCT_PTR(src_unit)+0))->surface;
|
320
|
+
SDL_Surface *dst = GetSurface(*(RSTRUCT_PTR(dst_unit)+0))->surface;
|
321
|
+
|
322
|
+
SDL_Rect srect, drect;
|
323
|
+
|
324
|
+
VALUE *s_p = RSTRUCT_PTR(src_unit);
|
325
|
+
srect.x = NUM2INT(*(s_p + 1));
|
326
|
+
srect.y = NUM2INT(*(s_p + 2));
|
327
|
+
srect.w = NUM2INT(*(s_p + 3));
|
328
|
+
srect.h = NUM2INT(*(s_p + 4));
|
329
|
+
|
330
|
+
VALUE *d_p = RSTRUCT_PTR(dst_unit);
|
331
|
+
drect.x = NUM2INT(*(d_p + 1)) + NUM2INT(vx);
|
332
|
+
drect.y = NUM2INT(*(d_p + 2)) + NUM2INT(vy);
|
333
|
+
drect.w = NUM2INT(*(d_p + 3));
|
334
|
+
drect.h = NUM2INT(*(d_p + 4));
|
335
|
+
|
336
|
+
SDL_BlitSurface(src, &srect, dst, &drect);
|
337
|
+
return self;
|
338
|
+
}
|
339
|
+
|
340
|
+
VALUE _miyako_sprite_render_xy(VALUE sprite, VALUE x, VALUE y)
|
341
|
+
{
|
342
|
+
return sprite_render_xy(sprite, x, y);
|
343
|
+
}
|
344
|
+
|
187
345
|
/*
|
188
346
|
インスタンスの内容を別のインスタンスに描画する
|
189
347
|
*/
|
190
|
-
static VALUE
|
348
|
+
static VALUE sprite_render_xy_to_sprite(VALUE self, VALUE vdst, VALUE vx, VALUE vy)
|
191
349
|
{
|
192
|
-
VALUE visible = rb_iv_get(self,
|
350
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
193
351
|
if(visible == Qfalse) return self;
|
194
352
|
MiyakoBitmap src, dst;
|
195
353
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
196
354
|
_miyako_setup_unit_2(self, vdst, scr, &src, &dst, Qnil, Qnil, 1);
|
355
|
+
src.x = NUM2INT(vx);
|
356
|
+
src.y = NUM2INT(vy);
|
197
357
|
render_to_inner(&src, &dst);
|
198
358
|
return self;
|
199
359
|
}
|
@@ -203,9 +363,9 @@ static VALUE sprite_render_to_sprite(VALUE self, VALUE vdst)
|
|
203
363
|
*/
|
204
364
|
static VALUE screen_update_tick(VALUE self)
|
205
365
|
{
|
206
|
-
|
207
|
-
|
208
|
-
|
366
|
+
Uint32 t = SDL_GetTicks();
|
367
|
+
Uint32 tt = NUM2INT(rb_iv_get(mScreen, "@@t"));
|
368
|
+
Uint32 interval = t - tt;
|
209
369
|
int fps_cnt = NUM2INT(rb_iv_get(mScreen, "@@fpscnt"));
|
210
370
|
|
211
371
|
while(interval < fps_cnt){
|
@@ -219,36 +379,9 @@ static VALUE screen_update_tick(VALUE self)
|
|
219
379
|
return Qnil;
|
220
380
|
}
|
221
381
|
|
222
|
-
|
223
|
-
:nodoc:
|
224
|
-
*/
|
225
|
-
static VALUE render_auto_render_array(VALUE array)
|
382
|
+
void _miyako_screen_update_tick()
|
226
383
|
{
|
227
|
-
|
228
|
-
if(len == 0){ return Qnil; }
|
229
|
-
VALUE *ptr = RARRAY_PTR(array);
|
230
|
-
|
231
|
-
int i;
|
232
|
-
for(i=0; i<len; i++)
|
233
|
-
{
|
234
|
-
VALUE v = *ptr;
|
235
|
-
if(v == Qnil)
|
236
|
-
{
|
237
|
-
ptr++;
|
238
|
-
continue;
|
239
|
-
}
|
240
|
-
else if(TYPE(v) == T_ARRAY)
|
241
|
-
{
|
242
|
-
render_auto_render_array(v);
|
243
|
-
}
|
244
|
-
else
|
245
|
-
{
|
246
|
-
rb_funcall(v, id_render, 0);
|
247
|
-
}
|
248
|
-
ptr++;
|
249
|
-
}
|
250
|
-
|
251
|
-
return Qnil;
|
384
|
+
screen_update_tick(mScreen);
|
252
385
|
}
|
253
386
|
|
254
387
|
/*
|
@@ -256,14 +389,15 @@ static VALUE render_auto_render_array(VALUE array)
|
|
256
389
|
*/
|
257
390
|
static VALUE screen_pre_render(VALUE self)
|
258
391
|
{
|
259
|
-
|
260
|
-
if(RARRAY_LEN(pre_render_array) > 0)
|
261
|
-
{
|
262
|
-
render_auto_render_array(pre_render_array);
|
263
|
-
}
|
392
|
+
_miyako_sprite_list_render(rb_iv_get(mScreen, "@@pre_render_array"));
|
264
393
|
return Qnil;
|
265
394
|
}
|
266
395
|
|
396
|
+
void _miyako_screen_pre_render()
|
397
|
+
{
|
398
|
+
screen_pre_render(mScreen);
|
399
|
+
}
|
400
|
+
|
267
401
|
/*
|
268
402
|
画面を更新する
|
269
403
|
*/
|
@@ -272,13 +406,11 @@ static VALUE screen_render(VALUE self)
|
|
272
406
|
VALUE dst = rb_iv_get(mScreen, "@@unit");
|
273
407
|
SDL_Surface *pdst = GetSurface(*(RSTRUCT_PTR(dst)))->surface;
|
274
408
|
VALUE fps_view = rb_iv_get(mScreen, "@@fpsView");
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
}
|
281
|
-
|
409
|
+
|
410
|
+
_miyako_sprite_list_render(rb_iv_get(cSprite, "@@sprites"));
|
411
|
+
|
412
|
+
_miyako_sprite_list_render(rb_iv_get(mScreen, "@@auto_render_array"));
|
413
|
+
|
282
414
|
if(fps_view == Qtrue){
|
283
415
|
char str[256];
|
284
416
|
int interval = NUM2INT(rb_iv_get(mScreen, "@@interval"));
|
@@ -290,7 +422,7 @@ static VALUE screen_render(VALUE self)
|
|
290
422
|
|
291
423
|
sprintf(str, "%d fps", fps_max / interval);
|
292
424
|
VALUE fps_str = rb_str_new2((const char *)str);
|
293
|
-
|
425
|
+
|
294
426
|
fps_sprite = rb_funcall(fps_str, rb_intern("to_sprite"), 1, sans_serif);
|
295
427
|
sprite_render(fps_sprite);
|
296
428
|
}
|
@@ -303,10 +435,15 @@ static VALUE screen_render(VALUE self)
|
|
303
435
|
return Qnil;
|
304
436
|
}
|
305
437
|
rb_funcall(cGL, rb_intern("swap_buffers"), 0);
|
306
|
-
|
438
|
+
|
307
439
|
return Qnil;
|
308
440
|
}
|
309
441
|
|
442
|
+
void _miyako_screen_render()
|
443
|
+
{
|
444
|
+
screen_render(mScreen);
|
445
|
+
}
|
446
|
+
|
310
447
|
/*
|
311
448
|
インスタンスの内容を画面に描画する
|
312
449
|
*/
|
@@ -319,6 +456,74 @@ static VALUE screen_render_screen(VALUE self, VALUE vsrc)
|
|
319
456
|
return self;
|
320
457
|
}
|
321
458
|
|
459
|
+
void _miyako_screen_render_screen(VALUE src)
|
460
|
+
{
|
461
|
+
screen_render_screen(mScreen, src);
|
462
|
+
}
|
463
|
+
|
464
|
+
static int anim_m_hash_start(VALUE key, VALUE val)
|
465
|
+
{
|
466
|
+
if(val == Qnil){ return 0; }
|
467
|
+
rb_funcall(val, id_start, 0);
|
468
|
+
return 0;
|
469
|
+
}
|
470
|
+
|
471
|
+
static int anim_m_hash_stop(VALUE key, VALUE val)
|
472
|
+
{
|
473
|
+
if(val == Qnil){ return 0; }
|
474
|
+
rb_funcall(val, id_stop, 0);
|
475
|
+
return 0;
|
476
|
+
}
|
477
|
+
|
478
|
+
static int anim_m_hash_reset(VALUE key, VALUE val)
|
479
|
+
{
|
480
|
+
if(val == Qnil){ return 0; }
|
481
|
+
rb_funcall(val, id_reset, 0);
|
482
|
+
return 0;
|
483
|
+
}
|
484
|
+
|
485
|
+
static int anim_m_hash_update(VALUE key, VALUE val)
|
486
|
+
{
|
487
|
+
if(val == Qnil){ return 0; }
|
488
|
+
rb_funcall(val, id_ua, 0);
|
489
|
+
return 0;
|
490
|
+
}
|
491
|
+
|
492
|
+
/*
|
493
|
+
:nodoc:
|
494
|
+
*/
|
495
|
+
static VALUE anim_m_start(VALUE self)
|
496
|
+
{
|
497
|
+
rb_hash_foreach(rb_iv_get(self, str_ahash), anim_m_hash_start, Qnil);
|
498
|
+
return Qnil;
|
499
|
+
}
|
500
|
+
|
501
|
+
/*
|
502
|
+
:nodoc:
|
503
|
+
*/
|
504
|
+
static VALUE anim_m_stop(VALUE self)
|
505
|
+
{
|
506
|
+
rb_hash_foreach(rb_iv_get(self, str_ahash), anim_m_hash_stop, Qnil);
|
507
|
+
return Qnil;
|
508
|
+
}
|
509
|
+
|
510
|
+
/*
|
511
|
+
:nodoc:
|
512
|
+
*/
|
513
|
+
static VALUE anim_m_reset(VALUE self)
|
514
|
+
{
|
515
|
+
rb_hash_foreach(rb_iv_get(self, str_ahash), anim_m_hash_reset, Qnil);
|
516
|
+
return Qnil;
|
517
|
+
}
|
518
|
+
|
519
|
+
/*
|
520
|
+
:nodoc:
|
521
|
+
*/
|
522
|
+
static VALUE anim_m_update(VALUE self)
|
523
|
+
{
|
524
|
+
rb_hash_foreach(rb_iv_get(self, str_ahash), anim_m_hash_update, Qnil);
|
525
|
+
return Qnil;
|
526
|
+
}
|
322
527
|
|
323
528
|
/*
|
324
529
|
===マップレイヤー転送インナーメソッド
|
@@ -349,7 +554,7 @@ static void maplayer_render_inner(VALUE self, MiyakoBitmap *dst)
|
|
349
554
|
|
350
555
|
VALUE munits = rb_iv_get(self, "@mapchip_units");
|
351
556
|
VALUE mapdat = rb_iv_get(self, "@mapdat");
|
352
|
-
|
557
|
+
|
353
558
|
if(pos_x < 0){ pos_x = real_size_w + (pos_x % real_size_w); }
|
354
559
|
if(pos_y < 0){ pos_y = real_size_h + (pos_y % real_size_h); }
|
355
560
|
if(pos_x >= real_size_w){ pos_x %= real_size_w; }
|
@@ -362,10 +567,10 @@ static void maplayer_render_inner(VALUE self, MiyakoBitmap *dst)
|
|
362
567
|
|
363
568
|
MiyakoBitmap src;
|
364
569
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
365
|
-
|
570
|
+
|
366
571
|
int bx = dst->rect.x;
|
367
572
|
int by = dst->rect.y;
|
368
|
-
|
573
|
+
|
369
574
|
int x, y, idx1, idx2;
|
370
575
|
for(y = 0; y < ch; y++){
|
371
576
|
idx1 = (y + dy) % size_h;
|
@@ -377,7 +582,7 @@ static void maplayer_render_inner(VALUE self, MiyakoBitmap *dst)
|
|
377
582
|
_miyako_setup_unit(
|
378
583
|
rb_funcall(*(RARRAY_PTR(munits) + code),
|
379
584
|
rb_intern("to_unit"), 0),
|
380
|
-
scr, &src,
|
585
|
+
scr, &src,
|
381
586
|
INT2NUM(x * ow - mx), INT2NUM(y * oh - my), 0);
|
382
587
|
render_inner(&src, dst);
|
383
588
|
dst->rect.x = bx;
|
@@ -409,10 +614,10 @@ static void fixedmaplayer_render_inner(VALUE self, MiyakoBitmap *dst)
|
|
409
614
|
|
410
615
|
MiyakoBitmap src;
|
411
616
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
412
|
-
|
617
|
+
|
413
618
|
int bx = dst->rect.x;
|
414
619
|
int by = dst->rect.y;
|
415
|
-
|
620
|
+
|
416
621
|
int x, y, idx1, idx2;
|
417
622
|
for(y = 0; y < ch; y++){
|
418
623
|
idx1 = y % size_h;
|
@@ -459,7 +664,7 @@ static void maplayer_render_to_inner(VALUE self, MiyakoBitmap *dst)
|
|
459
664
|
|
460
665
|
VALUE munits = rb_iv_get(self, "@mapchip_units");
|
461
666
|
VALUE mapdat = rb_iv_get(self, "@mapdat");
|
462
|
-
|
667
|
+
|
463
668
|
if(pos_x < 0){ pos_x = real_size_w + (pos_x % real_size_w); }
|
464
669
|
if(pos_y < 0){ pos_y = real_size_h + (pos_y % real_size_h); }
|
465
670
|
if(pos_x >= real_size_w){ pos_x %= real_size_w; }
|
@@ -472,10 +677,10 @@ static void maplayer_render_to_inner(VALUE self, MiyakoBitmap *dst)
|
|
472
677
|
|
473
678
|
MiyakoBitmap src;
|
474
679
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
475
|
-
|
680
|
+
|
476
681
|
int bx = dst->rect.x;
|
477
682
|
int by = dst->rect.y;
|
478
|
-
|
683
|
+
|
479
684
|
int x, y, idx1, idx2;
|
480
685
|
for(y = 0; y < ch; y++){
|
481
686
|
idx1 = (y + dy) % size_h;
|
@@ -516,10 +721,10 @@ static void fixedmaplayer_render_to_inner(VALUE self, MiyakoBitmap *dst)
|
|
516
721
|
|
517
722
|
MiyakoBitmap src;
|
518
723
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
519
|
-
|
724
|
+
|
520
725
|
int bx = dst->rect.x;
|
521
726
|
int by = dst->rect.y;
|
522
|
-
|
727
|
+
|
523
728
|
int x, y, idx1, idx2;
|
524
729
|
for(y = 0; y < ch; y++){
|
525
730
|
idx1 = y % size_h;
|
@@ -542,7 +747,7 @@ static void fixedmaplayer_render_to_inner(VALUE self, MiyakoBitmap *dst)
|
|
542
747
|
*/
|
543
748
|
static VALUE maplayer_render(VALUE self)
|
544
749
|
{
|
545
|
-
VALUE visible = rb_iv_get(self,
|
750
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
546
751
|
if(visible == Qfalse) return self;
|
547
752
|
MiyakoBitmap dst;
|
548
753
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
@@ -556,7 +761,7 @@ static VALUE maplayer_render(VALUE self)
|
|
556
761
|
*/
|
557
762
|
static VALUE fixedmaplayer_render(VALUE self)
|
558
763
|
{
|
559
|
-
VALUE visible = rb_iv_get(self,
|
764
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
560
765
|
if(visible == Qfalse) return self;
|
561
766
|
MiyakoBitmap dst;
|
562
767
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
@@ -570,7 +775,7 @@ static VALUE fixedmaplayer_render(VALUE self)
|
|
570
775
|
*/
|
571
776
|
static VALUE maplayer_render_to_sprite(VALUE self, VALUE vdst)
|
572
777
|
{
|
573
|
-
VALUE visible = rb_iv_get(self,
|
778
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
574
779
|
if(visible == Qfalse) return self;
|
575
780
|
MiyakoBitmap dst;
|
576
781
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
@@ -584,7 +789,7 @@ static VALUE maplayer_render_to_sprite(VALUE self, VALUE vdst)
|
|
584
789
|
*/
|
585
790
|
static VALUE fixedmaplayer_render_to_sprite(VALUE self, VALUE vdst)
|
586
791
|
{
|
587
|
-
VALUE visible = rb_iv_get(self,
|
792
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
588
793
|
if(visible == Qfalse) return self;
|
589
794
|
MiyakoBitmap dst;
|
590
795
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
@@ -598,7 +803,7 @@ static VALUE fixedmaplayer_render_to_sprite(VALUE self, VALUE vdst)
|
|
598
803
|
*/
|
599
804
|
static VALUE map_render(VALUE self)
|
600
805
|
{
|
601
|
-
VALUE visible = rb_iv_get(self,
|
806
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
602
807
|
if(visible == Qfalse) return self;
|
603
808
|
MiyakoBitmap dst;
|
604
809
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
@@ -608,7 +813,7 @@ static VALUE map_render(VALUE self)
|
|
608
813
|
for(i=0; i<RARRAY_LEN(map_layers); i++){
|
609
814
|
maplayer_render_inner(*(RARRAY_PTR(map_layers) + i), &dst);
|
610
815
|
}
|
611
|
-
|
816
|
+
|
612
817
|
return self;
|
613
818
|
}
|
614
819
|
|
@@ -617,7 +822,7 @@ static VALUE map_render(VALUE self)
|
|
617
822
|
*/
|
618
823
|
static VALUE fixedmap_render(VALUE self)
|
619
824
|
{
|
620
|
-
VALUE visible = rb_iv_get(self,
|
825
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
621
826
|
if(visible == Qfalse) return self;
|
622
827
|
MiyakoBitmap dst;
|
623
828
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
@@ -636,7 +841,7 @@ static VALUE fixedmap_render(VALUE self)
|
|
636
841
|
*/
|
637
842
|
static VALUE map_render_to_sprite(VALUE self, VALUE vdst)
|
638
843
|
{
|
639
|
-
VALUE visible = rb_iv_get(self,
|
844
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
640
845
|
if(visible == Qfalse) return self;
|
641
846
|
MiyakoBitmap dst;
|
642
847
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
@@ -656,7 +861,7 @@ static VALUE map_render_to_sprite(VALUE self, VALUE vdst)
|
|
656
861
|
*/
|
657
862
|
static VALUE fixedmap_render_to_sprite(VALUE self, VALUE vdst)
|
658
863
|
{
|
659
|
-
VALUE visible = rb_iv_get(self,
|
864
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
660
865
|
if(visible == Qfalse) return self;
|
661
866
|
MiyakoBitmap dst;
|
662
867
|
SDL_Surface *scr = GetSurface(rb_iv_get(mScreen, "@@screen"))->surface;
|
@@ -727,16 +932,16 @@ static VALUE sa_update_wait_counter(VALUE self)
|
|
727
932
|
VALUE waiting = rb_funcall(cnt, rb_intern("waiting?"), 0);
|
728
933
|
|
729
934
|
if(waiting == Qtrue) return Qfalse;
|
730
|
-
|
935
|
+
|
731
936
|
VALUE num = rb_iv_get(self, "@pnum");
|
732
937
|
VALUE loop = rb_iv_get(self, "@loop");
|
733
938
|
|
734
939
|
int pnum = NUM2INT(num);
|
735
940
|
int pats = NUM2INT(rb_iv_get(self, "@pats"));
|
736
941
|
pnum = (pnum + 1) % pats;
|
737
|
-
|
942
|
+
|
738
943
|
rb_iv_set(self, "@pnum", INT2NUM(pnum));
|
739
|
-
|
944
|
+
|
740
945
|
if(loop == Qfalse && pnum == 0){
|
741
946
|
rb_funcall(self, rb_intern("stop"), 0);
|
742
947
|
return Qfalse;
|
@@ -764,7 +969,7 @@ static VALUE sa_update(VALUE self)
|
|
764
969
|
is_change = sa_update_frame(self);
|
765
970
|
else
|
766
971
|
is_change = sa_update_wait_counter(self);
|
767
|
-
|
972
|
+
|
768
973
|
return is_change;
|
769
974
|
}
|
770
975
|
|
@@ -773,13 +978,13 @@ static VALUE sa_update(VALUE self)
|
|
773
978
|
*/
|
774
979
|
static VALUE sa_render(VALUE self)
|
775
980
|
{
|
776
|
-
VALUE visible = rb_iv_get(self,
|
981
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
777
982
|
if(visible == Qfalse) return self;
|
778
983
|
VALUE vsrc = rb_iv_get(self, "@now");
|
779
984
|
VALUE *runit = RSTRUCT_PTR(vsrc);
|
780
985
|
VALUE polist = rb_iv_get(self, "@pos_offset");
|
781
986
|
VALUE dir = rb_iv_get(self, "@dir");
|
782
|
-
|
987
|
+
|
783
988
|
int num = NUM2INT(rb_iv_get(self, "@pnum"));
|
784
989
|
|
785
990
|
VALUE *move_off = RARRAY_PTR(rb_funcall(*(RARRAY_PTR(rb_iv_get(self, "@move_offset")) + num), id_to_a, 0));
|
@@ -787,7 +992,7 @@ static VALUE sa_render(VALUE self)
|
|
787
992
|
int pos_off = NUM2INT(*(RARRAY_PTR(polist) + num));
|
788
993
|
|
789
994
|
int didx = (rb_to_id(dir) == rb_intern("h") ? 2 : 1);
|
790
|
-
|
995
|
+
|
791
996
|
VALUE tmp_oxy = *(runit + didx);
|
792
997
|
VALUE tmp_x = *(runit + 5);
|
793
998
|
VALUE tmp_y = *(runit + 6);
|
@@ -813,13 +1018,13 @@ static VALUE sa_render(VALUE self)
|
|
813
1018
|
*/
|
814
1019
|
static VALUE sa_render_to_sprite(VALUE self, VALUE vdst)
|
815
1020
|
{
|
816
|
-
VALUE visible = rb_iv_get(self,
|
1021
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
817
1022
|
if(visible == Qfalse) return self;
|
818
1023
|
VALUE vsrc = rb_iv_get(self, "@now");
|
819
1024
|
VALUE *runit = RSTRUCT_PTR(vsrc);
|
820
1025
|
VALUE polist = rb_iv_get(self, "@pos_offset");
|
821
1026
|
VALUE dir = rb_iv_get(self, "@dir");
|
822
|
-
|
1027
|
+
|
823
1028
|
int num = NUM2INT(rb_iv_get(self, "@pnum"));
|
824
1029
|
|
825
1030
|
int pos_off = NUM2INT(*(RARRAY_PTR(polist) + num));
|
@@ -828,7 +1033,7 @@ static VALUE sa_render_to_sprite(VALUE self, VALUE vdst)
|
|
828
1033
|
VALUE move_off = *(RARRAY_PTR(molist) + num);
|
829
1034
|
|
830
1035
|
int didx = (rb_to_id(dir) == rb_intern("h") ? 3 : 2);
|
831
|
-
|
1036
|
+
|
832
1037
|
VALUE tmp_oxy = *(runit + didx);
|
833
1038
|
VALUE tmp_x = *(runit + 5);
|
834
1039
|
VALUE tmp_y = *(runit + 6);
|
@@ -854,7 +1059,7 @@ static VALUE sa_render_to_sprite(VALUE self, VALUE vdst)
|
|
854
1059
|
*/
|
855
1060
|
static VALUE plane_render(VALUE self)
|
856
1061
|
{
|
857
|
-
VALUE visible = rb_iv_get(self,
|
1062
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
858
1063
|
if(visible == Qfalse) return self;
|
859
1064
|
VALUE sprite = rb_iv_get(self, "@sprite");
|
860
1065
|
|
@@ -886,7 +1091,7 @@ static VALUE plane_render(VALUE self)
|
|
886
1091
|
}
|
887
1092
|
}
|
888
1093
|
}
|
889
|
-
|
1094
|
+
|
890
1095
|
return Qnil;
|
891
1096
|
}
|
892
1097
|
|
@@ -895,7 +1100,7 @@ static VALUE plane_render(VALUE self)
|
|
895
1100
|
*/
|
896
1101
|
static VALUE plane_render_to_sprite(VALUE self, VALUE vdst)
|
897
1102
|
{
|
898
|
-
VALUE visible = rb_iv_get(self,
|
1103
|
+
VALUE visible = rb_iv_get(self, str_visible);
|
899
1104
|
if(visible == Qfalse) return self;
|
900
1105
|
VALUE sprite = rb_iv_get(self, "@sprite");
|
901
1106
|
|
@@ -927,79 +1132,66 @@ static VALUE plane_render_to_sprite(VALUE self, VALUE vdst)
|
|
927
1132
|
}
|
928
1133
|
}
|
929
1134
|
}
|
930
|
-
|
1135
|
+
|
931
1136
|
return Qnil;
|
932
1137
|
}
|
933
1138
|
|
934
|
-
#if 0
|
935
1139
|
/*
|
936
|
-
|
1140
|
+
:nodoc:
|
937
1141
|
*/
|
938
|
-
static VALUE
|
1142
|
+
static VALUE textbox_render(VALUE self)
|
939
1143
|
{
|
940
|
-
|
941
|
-
|
942
|
-
VALUE
|
943
|
-
|
1144
|
+
if(rb_iv_get(self, str_visible) == Qfalse){ return self; }
|
1145
|
+
sprite_render(rb_iv_get(self, str_textarea));
|
1146
|
+
VALUE wait_cursor = rb_iv_get(self, str_wait_cursor);
|
1147
|
+
if(wait_cursor != Qnil)
|
1148
|
+
{
|
1149
|
+
VALUE waiting = rb_iv_get(self, str_waiting);
|
1150
|
+
if(waiting == Qtrue)
|
1151
|
+
{
|
1152
|
+
rb_funcall(wait_cursor, id_render, 0);
|
1153
|
+
}
|
1154
|
+
}
|
944
1155
|
|
945
|
-
|
946
|
-
for(i=0; i<RARRAY_LEN(parts_list); i++)
|
1156
|
+
if(rb_iv_get(self, str_selecting) == Qtrue)
|
947
1157
|
{
|
948
|
-
|
949
|
-
|
1158
|
+
rb_funcall(rb_iv_get(self, str_choices), id_render, 0);
|
1159
|
+
VALUE select_cursor = rb_iv_get(self, str_select_cursor);
|
1160
|
+
if(select_cursor != Qnil)
|
1161
|
+
{
|
1162
|
+
rb_funcall(select_cursor, id_render, 0);
|
1163
|
+
}
|
950
1164
|
}
|
951
|
-
|
952
|
-
return Qnil;
|
1165
|
+
return self;
|
953
1166
|
}
|
954
1167
|
|
955
1168
|
/*
|
956
|
-
|
1169
|
+
:nodoc:
|
957
1170
|
*/
|
958
|
-
static VALUE
|
1171
|
+
static VALUE textbox_render_to(VALUE self, VALUE dst)
|
959
1172
|
{
|
960
|
-
VALUE visible = rb_iv_get(self, "@visible");
|
961
|
-
if(visible == Qfalse) return self;
|
962
|
-
VALUE parts_list = rb_iv_get(self, "@parts_list");
|
963
|
-
VALUE parts_hash = rb_iv_get(self, "@parts");
|
964
1173
|
|
965
|
-
|
966
|
-
|
1174
|
+
if(rb_iv_get(self, str_visible) == Qfalse){ return self; }
|
1175
|
+
sprite_render_to_sprite(rb_iv_get(self, str_textarea), dst);
|
1176
|
+
VALUE wait_cursor = rb_iv_get(self, str_wait_cursor);
|
1177
|
+
if(wait_cursor != Qnil)
|
967
1178
|
{
|
968
|
-
VALUE
|
969
|
-
|
1179
|
+
VALUE waiting = rb_iv_get(self, str_waiting);
|
1180
|
+
if(waiting == Qtrue)
|
1181
|
+
{
|
1182
|
+
rb_funcall(wait_cursor, id_render_to, 1, dst);
|
1183
|
+
}
|
970
1184
|
}
|
971
|
-
|
972
|
-
return Qnil;
|
973
|
-
}
|
974
|
-
#endif
|
975
1185
|
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
VALUE mutex = rb_iv_get(self, "@mutex");
|
984
|
-
VALUE str_execute = rb_str_new2("execute");
|
985
|
-
VALUE sym_execute = rb_funcall(str_execute, rb_intern("to_sym"), 0);
|
986
|
-
VALUE str_pause = rb_str_new2("pause");
|
987
|
-
VALUE sym_pause = rb_funcall(str_pause, rb_intern("to_sym"), 0);
|
988
|
-
rb_funcall(diagram, rb_intern("start"), 0);
|
989
|
-
VALUE executing = rb_funcall(states, id_kakko, 1, sym_execute);
|
990
|
-
while(executing == Qtrue){
|
991
|
-
VALUE pausing = rb_funcall(states, id_kakko, 1, sym_pause);
|
992
|
-
if(pausing == Qfalse){
|
993
|
-
rb_funcall(mutex, rb_intern("lock"), 0);
|
994
|
-
rb_funcall(diagram, id_update, 0);
|
995
|
-
rb_funcall(mutex, rb_intern("unlock"), 0);
|
996
|
-
rb_funcall(cThread, rb_intern("pass"), 0);
|
997
|
-
VALUE is_finish = rb_funcall(diagram, rb_intern("finish?"), 0);
|
998
|
-
if(is_finish == Qtrue){ rb_funcall(states, rb_intern("[]="), 2, sym_execute, Qfalse); }
|
1186
|
+
if(rb_iv_get(self, str_selecting) == Qtrue)
|
1187
|
+
{
|
1188
|
+
rb_funcall(rb_iv_get(self, str_choices), id_render_to, 1, dst);
|
1189
|
+
VALUE select_cursor = rb_iv_get(self, str_select_cursor);
|
1190
|
+
if(select_cursor != Qnil)
|
1191
|
+
{
|
1192
|
+
rb_funcall(select_cursor, id_render_to, 1, dst);
|
999
1193
|
}
|
1000
|
-
executing = rb_funcall(states, id_kakko, 1, sym_execute);
|
1001
1194
|
}
|
1002
|
-
rb_funcall(diagram, rb_intern("stop"), 0);
|
1003
1195
|
return self;
|
1004
1196
|
}
|
1005
1197
|
|
@@ -1008,6 +1200,10 @@ void Init_miyako_no_katana()
|
|
1008
1200
|
mSDL = rb_define_module("SDL");
|
1009
1201
|
mMiyako = rb_define_module("Miyako");
|
1010
1202
|
mScreen = rb_define_module_under(mMiyako, "Screen");
|
1203
|
+
mAudio = rb_define_module_under(mMiyako, "Audio");
|
1204
|
+
mInput = rb_define_module_under(mMiyako, "Input");
|
1205
|
+
mSpriteBase = rb_define_module_under(mMiyako, "SpriteBase");
|
1206
|
+
mAnimation = rb_define_module_under(mMiyako, "Animation");
|
1011
1207
|
mDiagram = rb_define_module_under(mMiyako, "Diagram");
|
1012
1208
|
cSurface = rb_define_class_under(mSDL, "Surface", rb_cObject);
|
1013
1209
|
cGL = rb_define_module_under(mSDL, "GL");
|
@@ -1016,30 +1212,59 @@ void Init_miyako_no_katana()
|
|
1016
1212
|
cSprite = rb_define_class_under(mMiyako, "Sprite", rb_cObject);
|
1017
1213
|
cSpriteAnimation = rb_define_class_under(mMiyako, "SpriteAnimation", rb_cObject);
|
1018
1214
|
cPlane = rb_define_class_under(mMiyako, "Plane", rb_cObject);
|
1019
|
-
#if 0
|
1020
|
-
cParts = rb_define_class_under(mMiyako, "Parts", rb_cObject);
|
1021
|
-
#endif
|
1022
1215
|
cMap = rb_define_class_under(mMiyako, "Map", rb_cObject);
|
1023
1216
|
cMapLayer = rb_define_class_under(cMap, "MapLayer", rb_cObject);
|
1024
1217
|
cFixedMap = rb_define_class_under(mMiyako, "FixedMap", rb_cObject);
|
1025
1218
|
cFixedMapLayer = rb_define_class_under(cFixedMap, "FixedMapLayer", rb_cObject);
|
1026
|
-
|
1027
|
-
|
1028
|
-
id_update
|
1029
|
-
id_kakko
|
1030
|
-
|
1031
|
-
|
1219
|
+
cTextbox = rb_define_class_under(mMiyako, "TextBox", rb_cObject);
|
1220
|
+
|
1221
|
+
id_update = rb_intern("update");
|
1222
|
+
id_kakko = rb_intern("[]");
|
1223
|
+
id_kakko_eq = rb_intern("[]=");
|
1224
|
+
id_render = rb_intern("render");
|
1225
|
+
id_render_to = rb_intern("render_to");
|
1226
|
+
id_to_a = rb_intern("to_a");
|
1227
|
+
id_move = rb_intern("move!");
|
1228
|
+
id_move_to = rb_intern("move_to!");
|
1229
|
+
id_defined = rb_intern("method_defined?");
|
1230
|
+
id_pos = rb_intern("pos");
|
1231
|
+
id_start = rb_intern("start");
|
1232
|
+
id_stop = rb_intern("stop");
|
1233
|
+
id_reset = rb_intern("reset");
|
1234
|
+
id_ua = rb_intern("update_animation");
|
1032
1235
|
|
1033
1236
|
zero = 0;
|
1034
1237
|
nZero = INT2NUM(zero);
|
1035
1238
|
one = 1;
|
1036
1239
|
nOne = INT2NUM(one);
|
1037
|
-
|
1240
|
+
|
1241
|
+
#if 1
|
1242
|
+
rb_define_singleton_method(mMiyako, "main_loop", miyako_main_loop, -1);
|
1243
|
+
|
1244
|
+
rb_define_singleton_method(mScreen, "update_tick", screen_update_tick, 0);
|
1245
|
+
rb_define_singleton_method(mScreen, "pre_render", screen_pre_render, 0);
|
1246
|
+
rb_define_singleton_method(mScreen, "render", screen_render, 0);
|
1247
|
+
rb_define_singleton_method(mScreen, "render_screen", screen_render_screen, 1);
|
1248
|
+
|
1249
|
+
rb_define_singleton_method(mAnimation, "start", anim_m_start, 0);
|
1250
|
+
rb_define_singleton_method(mAnimation, "stop", anim_m_stop, 0);
|
1251
|
+
rb_define_singleton_method(mAnimation, "reset", anim_m_reset, 0);
|
1252
|
+
rb_define_singleton_method(mAnimation, "update", anim_m_update, 0);
|
1253
|
+
rb_define_singleton_method(mAnimation, "update_animation", anim_m_update, 0);
|
1254
|
+
#else
|
1255
|
+
rb_define_module_function(mMiyako, "main_loop", miyako_main_loop, -1);
|
1256
|
+
|
1038
1257
|
rb_define_module_function(mScreen, "update_tick", screen_update_tick, 0);
|
1039
1258
|
rb_define_module_function(mScreen, "pre_render", screen_pre_render, 0);
|
1040
1259
|
rb_define_module_function(mScreen, "render", screen_render, 0);
|
1041
1260
|
rb_define_module_function(mScreen, "render_screen", screen_render_screen, 1);
|
1042
1261
|
|
1262
|
+
rb_define_module_function(mAnimation, "start", anim_m_start, 0);
|
1263
|
+
rb_define_module_function(mAnimation, "stop", anim_m_stop, 0);
|
1264
|
+
rb_define_module_function(mAnimation, "reset", anim_m_reset, 0);
|
1265
|
+
rb_define_module_function(mAnimation, "update", anim_m_update, 0);
|
1266
|
+
rb_define_module_function(mAnimation, "update_animation", anim_m_update, 0);
|
1267
|
+
#endif
|
1043
1268
|
rb_define_method(cSpriteAnimation, "update_animation", sa_update, 0);
|
1044
1269
|
rb_define_method(cSpriteAnimation, "update_frame", sa_update_frame, 0);
|
1045
1270
|
rb_define_method(cSpriteAnimation, "update_wait_counter", sa_update_wait_counter, 0);
|
@@ -1047,20 +1272,17 @@ void Init_miyako_no_katana()
|
|
1047
1272
|
rb_define_method(cSpriteAnimation, "render", sa_render, 0);
|
1048
1273
|
rb_define_method(cSpriteAnimation, "render_to", sa_render_to_sprite, 1);
|
1049
1274
|
|
1275
|
+
rb_define_method(mSpriteBase, "render_xy", sprite_b_render_xy, 2);
|
1276
|
+
rb_define_method(mSpriteBase, "render_xy_to", sprite_b_render_xy_to_sprite, 3);
|
1050
1277
|
rb_define_singleton_method(cSprite, "render_to", sprite_c_render_to_sprite, 2);
|
1051
1278
|
rb_define_method(cSprite, "render", sprite_render, 0);
|
1052
1279
|
rb_define_method(cSprite, "render_to", sprite_render_to_sprite, 1);
|
1280
|
+
rb_define_method(cSprite, "render_xy", sprite_render_xy, 2);
|
1281
|
+
rb_define_method(cSprite, "render_xy_to", sprite_render_xy_to_sprite, 3);
|
1053
1282
|
|
1054
1283
|
rb_define_method(cPlane, "render", plane_render, 0);
|
1055
1284
|
rb_define_method(cPlane, "render_to", plane_render_to_sprite, 1);
|
1056
1285
|
|
1057
|
-
#if 0
|
1058
|
-
rb_define_method(cParts, "render", parts_render, 0);
|
1059
|
-
rb_define_method(cParts, "render_to", parts_render_to_sprite, 1);
|
1060
|
-
#endif
|
1061
|
-
|
1062
|
-
rb_define_method(cProcessor, "main_loop", processor_mainloop, 0);
|
1063
|
-
|
1064
1286
|
rb_define_method(cMapLayer, "render", maplayer_render, 0);
|
1065
1287
|
rb_define_method(cFixedMapLayer, "render", fixedmaplayer_render, 0);
|
1066
1288
|
rb_define_method(cMap, "render", map_render, 0);
|
@@ -1070,8 +1292,11 @@ void Init_miyako_no_katana()
|
|
1070
1292
|
rb_define_method(cMapLayer, "render_to", maplayer_render_to_sprite, 1);
|
1071
1293
|
rb_define_method(cFixedMapLayer, "render_to", fixedmaplayer_render_to_sprite, 1);
|
1072
1294
|
|
1295
|
+
rb_define_method(cTextbox, "render", textbox_render, 0);
|
1296
|
+
rb_define_method(cTextbox, "render_to", textbox_render_to, 1);
|
1297
|
+
|
1073
1298
|
use_opengl = rb_gv_get("$miyako_use_opengl");
|
1074
|
-
|
1299
|
+
|
1075
1300
|
Init_miyako_bitmap();
|
1076
1301
|
Init_miyako_transform();
|
1077
1302
|
Init_miyako_hsv();
|
@@ -1083,4 +1308,6 @@ void Init_miyako_no_katana()
|
|
1083
1308
|
Init_miyako_font();
|
1084
1309
|
Init_miyako_utility();
|
1085
1310
|
Init_miyako_input_audio();
|
1311
|
+
Init_miyako_diagram();
|
1312
|
+
Init_miyako_yuki();
|
1086
1313
|
}
|