ruby-miyako 2.1.5 → 2.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  *******************************************************************************
2
2
  【 作者名 】 サイロス誠
3
3
  【 ソフト名 】 Interactive Media Authoring System "Miyako"
4
- 【 バージョン 】 2.1.5
4
+ 【 バージョン 】 2.1.6
5
5
  【 作成日 】 2010/01/01
6
6
  【 種別 】 フリーウェア
7
7
  【 開発言語 】 Ruby 1.9.1
@@ -1516,5 +1516,35 @@ v2.1.5(2010.01.01)
1516
1516
  ・TextBox#select_type/selct_type=
1517
1517
  ・InitiativeScenarioEngine#over_exec
1518
1518
 
1519
+ v2.1.6(2010.01.01)
1520
+ <バグ修正>
1521
+ ・InitiativeScenarioEngine#pre_process,post_processで一部機能の更新をしていなかったバグを修正
1522
+ ・InitiativeScenarioEngine#update_animationで一部機能の更新をしていなかったバグを修正
1523
+ ・InitiativeScenarioEngine#over_execの復活(処理の見直し)
1524
+ ・InitiativeScenarioEngine#over_execの復活(処理の見直し)
1525
+ <機能改善>
1526
+ <仕様変更>
1527
+ <ファイル追加>
1528
+ <ファイル削除>
1529
+ <グローバル変数追加>
1530
+ <定数追加>
1531
+ <定数削除>
1532
+ <構造体追加>
1533
+ <クラス追加>
1534
+ <モジュール追加>
1535
+ <mixin>
1536
+ <クラス・モジュールメソッド追加>
1537
+ <クラス・モジュールメソッド廃止>
1538
+ <モジュール関数追加>
1539
+ <モジュール関数廃止>
1540
+ ・InitiativeYukiTemplate#plot
1541
+ <インスタンスメソッド追加>
1542
+ ・InitiativeScenarioEngine#over_exec
1543
+ ・InitiativeScenarioEngine#over_engine
1544
+ ・InitiativeScenarioEngine#render_all
1545
+ ・InitiativeScenarioEngine#render_to_all
1546
+ ・InitiativeScenarioEngine#update_animation_all
1547
+ <インスタンスメソッド廃止>
1548
+
1519
1549
  *******************************************************************************
1520
1550
  このReadMeファイルは「れ~どめ~えじた~」によって作成されました。
data/extern.h CHANGED
@@ -27,6 +27,7 @@ extern void _miyako_setup_unit_2(VALUE unit_s, VALUE unit_d,
27
27
  extern int _miyako_init_rect(MiyakoBitmap *src, MiyakoBitmap *dst, MiyakoSize *size);
28
28
  extern void _miyako_yield_unit_1(MiyakoBitmap *src);
29
29
  extern void _miyako_yield_unit_2(MiyakoBitmap *src, MiyakoBitmap *dst);
30
+ extern void _miyako_animation_update();
30
31
  extern void _miyako_audio_update();
31
32
  extern void _miyako_input_update();
32
33
  extern void _miyako_counter_update();
@@ -57,9 +57,6 @@ module Miyako
57
57
 
58
58
  def waiting_inner(engine)
59
59
  end
60
-
61
- def plot
62
- end
63
60
  end
64
61
 
65
62
  InitiativeScenarioEngineTemplate = InitiativeYukiTemplate
@@ -154,6 +151,7 @@ module Miyako
154
151
  #_params_:: ブロックに渡す引数リスト(ただし、ブロックを渡しているときのみに有効)
155
152
  def initialize(*params, &proc)
156
153
  @base = nil
154
+ @over_yuki = nil
157
155
  @yuki = { }
158
156
  @text_box = nil
159
157
  @command_box = nil
@@ -225,50 +223,6 @@ module Miyako
225
223
  raise MiyakoCopyError.not_copy("Yuki")
226
224
  end
227
225
 
228
- def render_inner(yuki)
229
- @base.render_inner(yuki) if @base
230
- end
231
-
232
- def render_to_inner(yuki, dst)
233
- @base.render_to_inner(yuki, dst) if @base
234
- end
235
-
236
- def update_animation_inner(yuki)
237
- @base.update_animation_inner(yuki) if @base
238
- end
239
-
240
- def update_inner(yuki)
241
- @base.update_inner(yuki) if @base
242
- end
243
-
244
- def text_inner(yuki, ch)
245
- @base.text_inner(yuki, ch) if @base
246
- end
247
-
248
- def cr_inner(yuki)
249
- @base.cr_inner(yuki) if @base
250
- end
251
-
252
- def clear_inner(yuki)
253
- @base.clear_inner(yuki) if @base
254
- end
255
-
256
- def input_inner(yuki)
257
- @base.input_inner(yuki) if @base
258
- end
259
-
260
- def pausing_inner(yuki)
261
- @base.pausing_inner(yuki) if @base
262
- end
263
-
264
- def selecting_inner(yuki)
265
- @base.selecting_inner(yuki) if @base
266
- end
267
-
268
- def waiting_inner(yuki)
269
- @base.waiting_inner(yuki) if @base
270
- end
271
-
272
226
  #===マウスでの制御を可能にする
273
227
  #ゲームパッド・キーボードでのコマンド・ポーズ制御を行えるが、
274
228
  #それに加えて、マウスでもゲームパッド・キーボードでの制御が行える
@@ -296,21 +250,37 @@ module Miyako
296
250
  @mouse_enable
297
251
  end
298
252
 
253
+ def render_all
254
+ self.bgs.render
255
+ self.visibles.render
256
+ self.textbox_all.render
257
+ self.commandbox_all.render unless yuki.box_shared?
258
+ self.pre_visibles.render
259
+ end
260
+
299
261
  #===Yuki#showで表示指定した画像を描画する
300
262
  #描画順は、showメソッドで指定した順に描画される(先に指定した画像は後ろに表示される)
301
263
  #なお、visibleの値がfalseの時は描画されない。
302
264
  #返却値:: 自分自身を返す
303
265
  def render
304
- render_inner(self)
266
+ return @base.render_inner(self) if @base
305
267
  return self
306
268
  end
307
269
 
270
+ def render_to_all(dst)
271
+ self.bgs.render_to(dst)
272
+ self.visibles.render_to(dst)
273
+ self.textbox_all.render_to(dst)
274
+ self.commandbox_all.render_to(dst) unless yuki.box_shared?
275
+ self.pre_visibles.render_to(dst)
276
+ end
277
+
308
278
  #===Yuki#showで表示指定した画像を描画する
309
279
  #描画順は、showメソッドで指定した順に描画される(先に指定した画像は後ろに表示される)
310
280
  #なお、visibleの値がfalseの時は描画されない。
311
281
  #返却値:: 自分自身を返す
312
282
  def render_to(dst)
313
- render_to_inner(self, dst)
283
+ return @base.render_to_inner(self, dst) if @base
314
284
  return self
315
285
  end
316
286
 
@@ -318,7 +288,7 @@ module Miyako
318
288
  #ポーズ中、コマンド選択中、 Yuki#wait メソッドによるウェイトの状態確認を行う。
319
289
  #プロット処理の実行確認は出来ない
320
290
  def update
321
- update_inner(self)
291
+ @base.update_inner(self) if @base
322
292
  @pause_release = false
323
293
  @select_ok = false
324
294
  @select_cancel = false
@@ -326,11 +296,20 @@ module Miyako
326
296
  return nil
327
297
  end
328
298
 
299
+ def update_animation_all
300
+ self.bgs.update_animation
301
+ self.visibles.update_animation
302
+ self.textbox_all.update_animation
303
+ self.commandbox_all.update_animation unless self.box_shared?
304
+ self.pre_visibles.update_animation
305
+ end
306
+
329
307
  #===Yuki#showで表示指定した画像のアニメーションを更新する
330
308
  #showメソッドで指定した画像のupdate_animationメソッドを呼び出す
331
309
  #返却値:: 描く画像のupdate_spriteメソッドを呼び出した結果を配列で返す
332
310
  def update_animation
333
- update_animation_inner(self)
311
+ return @base.update_animation_inner(self) if @base
312
+ return false
334
313
  end
335
314
 
336
315
  #===変数を参照する
@@ -753,11 +732,9 @@ module Miyako
753
732
  #nameで指定した遷移図の処理が終了するまで、プロットを停止する
754
733
  #_name_: 遷移図名(シンボル)
755
734
  #返却値:: 自分自身を返す
756
- def wait_by_finish(name)
735
+ def wait_by_finish(name, is_clear = true)
757
736
  until @parts[name].finish?
758
- pre_process
759
- @update_inner.call(self)
760
- post_process
737
+ process(is_clear)
761
738
  end
762
739
  return self
763
740
  end
@@ -770,6 +747,7 @@ module Miyako
770
747
  def pre_process(is_clear = true)
771
748
  Audio.update
772
749
  Input.update
750
+ WaitCounter.update
773
751
  self.update_input
774
752
  self.update
775
753
  self.update_animation
@@ -778,6 +756,8 @@ module Miyako
778
756
 
779
757
  def post_process
780
758
  self.render
759
+ WaitCounter.post_update
760
+ Animation.update
781
761
  Screen.render
782
762
  end
783
763
 
@@ -827,7 +807,7 @@ module Miyako
827
807
  #
828
808
  #3)select_plotメソッドで登録したブロック(Procクラスのインスタンス)
829
809
  #
830
- #_base_:: プロットの実行部をインスタンス化したオブジェクト。省略時はnil(paramsを指定するときは必ず設定すること)
810
+ #_base_:: プロット
831
811
  #_plot_proc_:: プロットの実行部をインスタンス化したオブジェクト。省略時はnil(paramsを指定するときは必ず設定すること)
832
812
  #_params_:: プロットに引き渡す引数リスト
833
813
  #返却値:: 自分自身を返す
@@ -841,6 +821,27 @@ module Miyako
841
821
  return self
842
822
  end
843
823
 
824
+ def over_engine
825
+ @over_yuki
826
+ end
827
+
828
+ #===別のYukiエンジンを実行する
829
+ #[[Yukiスクリプトとして利用可能]]
830
+ #もう一つのYukiエンジンを実行させ、並行実行させることができる
831
+ #ウインドウの上にウインドウを表示したりするときに、このメソッドを使う
832
+ #renderメソッドで描画する際は、自分のインスタンスが描画した直後に描画される
833
+ #自分自身を実行しようとするとMiyakoValueError例外が発生する
834
+ #_yuki_:: 実行対象のYukiインスタンス(事前にsetupの呼び出しが必要)
835
+ #_plot_:: プロットインスタンス。すでにsetupなどで登録しているときはnilを渡す
836
+ #_params_:: プロット実行開始時に、プロットに渡す引数
837
+ #返却値:: 自分自身を返す
838
+ def over_exec(yuki, base, plot, *params)
839
+ raise MiyakoValueError, "This Yuki engine is same as self!" if yuki.eql?(self)
840
+ @over_yuki = yuki
841
+ @over_yuki.start_plot(base, plot, *params)
842
+ return self
843
+ end
844
+
844
845
  #===プロット用ブロックをYukiへ渡すためのインスタンスを作成する
845
846
  #プロット用に用意したブロック(ブロック引数無し)を、Yukiでの選択結果や移動先として利用できる
846
847
  #インスタンスに変換する
@@ -856,15 +857,14 @@ module Miyako
856
857
  #プロット処理の場合は、メインスレッドから明示的に呼び出す必要がある
857
858
  #返却値:: nil を返す
858
859
  def update_input
859
- input_inner(self)
860
+ @base.input_inner(self) if @base
860
861
  return nil
861
862
  end
862
863
 
863
864
  def plot_facade(plot_proc = nil, *params, &plot_block) #:nodoc:
864
865
  @plot_result = nil
865
866
  exec_plot = @exec_plot
866
- @plot_result = @base ? self.instance_exec(*params, &@base.plot) :
867
- plot_proc ? self.instance_exec(*params, &plot_proc) :
867
+ @plot_result = plot_proc ? self.instance_exec(*params, &plot_proc) :
868
868
  block_given? ? self.instance_exec(*params, &plot_block) :
869
869
  exec_plot ? self.instance_exec(*params, &exec_plot) :
870
870
  raise(MiyakoProcError, "Cannot find plot!")
@@ -1101,7 +1101,7 @@ module Miyako
1101
1101
  next nil
1102
1102
  end
1103
1103
  @text_box.draw_text(ch)
1104
- text_inner(self, ch)
1104
+ @base.text_inner(self, ch) if @base
1105
1105
  post_process
1106
1106
  }
1107
1107
  return self
@@ -1136,7 +1136,7 @@ module Miyako
1136
1136
  end
1137
1137
  @text_box.draw_text(tmp)
1138
1138
  self.cr if use_cr
1139
- text_inner(self, tmp)
1139
+ @base.text_inner(self, tmp) if @base
1140
1140
  use_cr = false
1141
1141
  post_process
1142
1142
  end
@@ -1224,7 +1224,7 @@ module Miyako
1224
1224
  def cr(tm = 1)
1225
1225
  tm.times{|n|
1226
1226
  @text_box.cr
1227
- cr_inner(self)
1227
+ @base.cr_inner(self) if @base
1228
1228
  }
1229
1229
  return self
1230
1230
  end
@@ -1235,7 +1235,7 @@ module Miyako
1235
1235
  #返却値:: 自分自身を返す
1236
1236
  def clear
1237
1237
  @text_box.clear
1238
- clear_inner(self)
1238
+ @base.clear_inner(self) if @base
1239
1239
  return self
1240
1240
  end
1241
1241
 
@@ -1256,7 +1256,7 @@ module Miyako
1256
1256
  pause_release = false
1257
1257
  until pause_release
1258
1258
  pre_process
1259
- pausing_inner(self)
1259
+ @base.pausing_inner(self) if @base
1260
1260
  pause_release = @release_checks.inject(false){|r, c| r |= c.call }
1261
1261
  post_process
1262
1262
  end
@@ -1310,7 +1310,7 @@ module Miyako
1310
1310
  reset_selecting
1311
1311
  while selecting
1312
1312
  pre_process
1313
- selecting_inner(self)
1313
+ @base.selecting_inner(self) if @base
1314
1314
  @select_ok = true if @ok_checks.inject(false){|r, c| r |= c.call }
1315
1315
  @select_cancel = true if @cancel_checks.inject(false){|r, c| r |= c.call }
1316
1316
  @select_amount = @key_amount_proc.call
@@ -1380,7 +1380,7 @@ module Miyako
1380
1380
  waiting = true
1381
1381
  while waiting
1382
1382
  pre_process
1383
- waiting_inner(self)
1383
+ @base.waiting_inner(self) if @base
1384
1384
  waiting = @waiting_timer.waiting?
1385
1385
  post_process
1386
1386
  end
data/miyako_no_katana.c CHANGED
@@ -425,7 +425,7 @@ static VALUE sprite_render_rect(VALUE self, VALUE vrect)
425
425
 
426
426
  src = GetSurface(*(RSTRUCT_PTR(src_unit)+0))->surface;
427
427
  dst = GetSurface(*(RSTRUCT_PTR(dst_unit)+0))->surface;
428
-
428
+
429
429
  s_p = RSTRUCT_PTR(src_unit);
430
430
  srect.x = NUM2INT(*(s_p + 1)) + rect[0];
431
431
  srect.y = NUM2INT(*(s_p + 2)) + rect[1];
@@ -471,7 +471,7 @@ static VALUE sprite_render_rect2(VALUE self, VALUE vrect)
471
471
  SDL_Surface *src, *dst;
472
472
  SDL_Rect srect, drect;
473
473
  int rect[4];
474
-
474
+
475
475
  if(rb_iv_get(self, str_visible) == Qfalse) return self;
476
476
 
477
477
  sprite_get_rect(vrect, &(rect[0]));
@@ -526,7 +526,7 @@ static VALUE sprite_render_rect_xy(VALUE self, VALUE vrect, VALUE vx, VALUE vy)
526
526
  SDL_Surface *src, *dst;
527
527
  SDL_Rect srect, drect;
528
528
  int rect[4];
529
-
529
+
530
530
  if(rb_iv_get(self, str_visible) == Qfalse) return self;
531
531
 
532
532
  sprite_get_rect(vrect, &(rect[0]));
@@ -616,7 +616,7 @@ static VALUE sprite_render_rect2_xy_to_sprite(VALUE self, VALUE vdst, VALUE vrec
616
616
  MiyakoBitmap src, dst;
617
617
  SDL_Surface *scr;
618
618
  int rect[4];
619
-
619
+
620
620
  VALUE visible = rb_iv_get(self, str_visible);
621
621
  if(visible == Qfalse) return self;
622
622
  sprite_get_rect(vrect, &(rect[0]));
@@ -798,6 +798,11 @@ static VALUE anim_m_update(VALUE self)
798
798
  return Qnil;
799
799
  }
800
800
 
801
+
802
+ void _miyako_animation_update(){
803
+ anim_m_update(mAnimation);
804
+ }
805
+
801
806
  /*
802
807
  */
803
808
  static void maplayer_render_inner(VALUE self, MiyakoBitmap *dst)
@@ -1272,7 +1277,7 @@ static VALUE sa_render(VALUE self)
1272
1277
  int num, pos_off, didx;
1273
1278
  MiyakoBitmap src, dst;
1274
1279
  SDL_Surface *scr;
1275
-
1280
+
1276
1281
  VALUE visible = rb_iv_get(self, str_visible);
1277
1282
  if(visible == Qfalse) return self;
1278
1283
  vsrc = rb_iv_get(self, "@now");
@@ -1315,7 +1320,7 @@ static VALUE sa_render_to_sprite(VALUE self, VALUE vdst)
1315
1320
  int num, pos_off, didx;
1316
1321
  MiyakoBitmap src, dst;
1317
1322
  SDL_Surface *scr;
1318
-
1323
+
1319
1324
  VALUE visible = rb_iv_get(self, str_visible);
1320
1325
  if(visible == Qfalse) return self;
1321
1326
  vsrc = rb_iv_get(self, "@now");
data/miyako_yuki.c CHANGED
@@ -59,6 +59,7 @@ static const char *str_visible = "@visible";
59
59
  static const char *str_visibles = "@visibles";
60
60
  static const char *str_o_yuki = "@over_yuki";
61
61
  static const char *str_executing = "@executing";
62
+ static const char *str_base = "@base";
62
63
 
63
64
  /*
64
65
  :nodoc:
@@ -120,14 +121,19 @@ static VALUE yuki_render_to(VALUE self, VALUE dst)
120
121
  /*
121
122
  :nodoc:
122
123
  */
123
- static VALUE iyuki_pre_process(VALUE self)
124
+ static VALUE iyuki_pre_process(int argc, VALUE *argv, VALUE self)
124
125
  {
126
+ VALUE is_clear = Qnil;
127
+ rb_scan_args(argc, argv, "01", &is_clear);
128
+ if(argc == 0){ is_clear = Qtrue; }
129
+
125
130
  _miyako_audio_update();
126
131
  _miyako_input_update();
132
+ _miyako_counter_update();
127
133
  rb_funcall(self, id_update_input, 0);
128
134
  rb_funcall(self, id_update, 0);
129
135
  rb_funcall(self, id_update_animation, 0);
130
- _miyako_screen_clear();
136
+ if(is_clear != Qnil && is_clear != Qfalse){ _miyako_screen_clear(); }
131
137
  return self;
132
138
  }
133
139
 
@@ -137,6 +143,8 @@ static VALUE iyuki_pre_process(VALUE self)
137
143
  static VALUE iyuki_post_process(VALUE self)
138
144
  {
139
145
  rb_funcall(self, id_render, 0);
146
+ _miyako_counter_post_update();
147
+ _miyako_animation_update();
140
148
  _miyako_screen_render();
141
149
  return self;
142
150
  }
@@ -146,58 +154,16 @@ static VALUE iyuki_post_process(VALUE self)
146
154
  */
147
155
  static VALUE iyuki_update(VALUE self)
148
156
  {
149
- VALUE amt;
150
- rb_funcall(self, id_update_inner, 1, self);
157
+ VALUE amt, base;
158
+ base = rb_iv_get(self, str_base);
159
+ if(base != Qnil){ rb_funcall(base, id_update_inner, 1, self); }
151
160
  rb_iv_set(self, "@pause_release", Qfalse);
152
161
  rb_iv_set(self, "@select_ok", Qfalse);
153
162
  rb_iv_set(self, "@select_cansel", Qfalse);
154
163
  amt = rb_iv_get(self, "@select_amount");
155
164
  *(RARRAY_PTR(amt)+0) = nZero;
156
165
  *(RARRAY_PTR(amt)+1) = nZero;
157
- return self;
158
- }
159
-
160
- /*
161
- :nodoc:
162
- */
163
- static VALUE iyuki_update_input(VALUE self)
164
- {
165
- rb_funcall(self, id_update_input_inner, 1, self);
166
- return self;
167
- }
168
-
169
- /*
170
- :nodoc:
171
- */
172
- static VALUE iyuki_ua(VALUE self)
173
- {
174
- rb_funcall(self, id_update_animation_inner, 1, self);
175
- _miyako_sprite_list_update_animation(rb_iv_get(self, str_visibles));
176
- return self;
177
- }
178
-
179
- /*
180
- :nodoc:
181
- */
182
- static VALUE iyuki_render(VALUE self)
183
- {
184
- if(rb_iv_get(self, str_visible) == Qtrue){
185
- _miyako_sprite_list_render(rb_iv_get(self, str_visibles));
186
- }
187
- rb_funcall(self, id_render_inner, 1, self);
188
- return self;
189
- }
190
-
191
- /*
192
- :nodoc:
193
- */
194
- static VALUE iyuki_render_to(VALUE self, VALUE dst)
195
- {
196
- if(rb_iv_get(self, str_visible) == Qtrue){
197
- _miyako_sprite_list_render_to(rb_iv_get(self, str_visibles), dst);
198
- }
199
- rb_funcall(self, id_render_to_inner, 2, self, dst);
200
- return self;
166
+ return Qnil;
201
167
  }
202
168
 
203
169
  void Init_miyako_yuki()
@@ -235,11 +201,7 @@ void Init_miyako_yuki()
235
201
  rb_define_method(cYuki, "update_animation", yuki_ua, 0);
236
202
  rb_define_method(cYuki, "render", yuki_render, 0);
237
203
  rb_define_method(cYuki, "render_to", yuki_render_to, 1);
238
- rb_define_method(cIYuki, "pre_process", iyuki_pre_process, 0);
204
+ rb_define_method(cIYuki, "pre_process", iyuki_pre_process, -1);
239
205
  rb_define_method(cIYuki, "post_process", iyuki_post_process, 0);
240
206
  rb_define_method(cIYuki, "update", iyuki_update, 0);
241
- rb_define_method(cIYuki, "update_input", iyuki_update_input, 0);
242
- rb_define_method(cIYuki, "update_animation", iyuki_ua, 0);
243
- rb_define_method(cIYuki, "render", iyuki_render, 0);
244
- rb_define_method(cIYuki, "render_to", iyuki_render_to, 1);
245
207
  }
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-miyako
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyross Makoto