ruby-miyako-mswin32 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/README +1115 -0
  2. data/img/cursor.png +0 -0
  3. data/img/cursors.png +0 -0
  4. data/img/dice.png +0 -0
  5. data/img/wait_cursor.png +0 -0
  6. data/img/win_base.png +0 -0
  7. data/img/window.png +0 -0
  8. data/install_miyako.rb +87 -0
  9. data/lib/Miyako/API/audio.rb +584 -0
  10. data/lib/Miyako/API/basic_data.rb +1026 -0
  11. data/lib/Miyako/API/bitmap.rb +534 -0
  12. data/lib/Miyako/API/choices.rb +481 -0
  13. data/lib/Miyako/API/collision.rb +638 -0
  14. data/lib/Miyako/API/diagram.rb +586 -0
  15. data/lib/Miyako/API/drawing.rb +151 -0
  16. data/lib/Miyako/API/exceptions.rb +105 -0
  17. data/lib/Miyako/API/fixedmap.rb +462 -0
  18. data/lib/Miyako/API/font.rb +430 -0
  19. data/lib/Miyako/API/input.rb +456 -0
  20. data/lib/Miyako/API/layout.rb +644 -0
  21. data/lib/Miyako/API/map.rb +583 -0
  22. data/lib/Miyako/API/map_event.rb +222 -0
  23. data/lib/Miyako/API/modules.rb +357 -0
  24. data/lib/Miyako/API/movie.rb +166 -0
  25. data/lib/Miyako/API/parts.rb +188 -0
  26. data/lib/Miyako/API/plane.rb +205 -0
  27. data/lib/Miyako/API/screen.rb +341 -0
  28. data/lib/Miyako/API/shape.rb +443 -0
  29. data/lib/Miyako/API/sprite.rb +773 -0
  30. data/lib/Miyako/API/sprite_animation.rb +494 -0
  31. data/lib/Miyako/API/sprite_list.rb +1135 -0
  32. data/lib/Miyako/API/spriteunit.rb +168 -0
  33. data/lib/Miyako/API/story.rb +350 -0
  34. data/lib/Miyako/API/textbox.rb +773 -0
  35. data/lib/Miyako/API/utility.rb +419 -0
  36. data/lib/Miyako/API/viewport.rb +190 -0
  37. data/lib/Miyako/API/yuki.rb +1180 -0
  38. data/lib/Miyako/EXT/miyako_cairo.rb +62 -0
  39. data/lib/Miyako/EXT/raster_scroll.rb +138 -0
  40. data/lib/Miyako/EXT/slides.rb +157 -0
  41. data/lib/Miyako/miyako.rb +201 -0
  42. data/lib/Miyako/miyako_no_katana.so +0 -0
  43. data/lib/Miyako/miyako_require_only.rb +35 -0
  44. data/logo/EGSR_logo.png +0 -0
  45. data/logo/EGSR_logo_bg.png +0 -0
  46. data/logo/EGSR_logo_fg.png +0 -0
  47. data/logo/EGSR_title_banner.png +0 -0
  48. data/logo/EGSR_title_logo.png +0 -0
  49. data/logo/miyako.png +0 -0
  50. data/logo/miyako_banner.png +0 -0
  51. data/logo/space.png +0 -0
  52. data/sample/Animation1/m1ku.rb +68 -0
  53. data/sample/Animation1/m1ku_arm_0.png +0 -0
  54. data/sample/Animation1/m1ku_arm_1.png +0 -0
  55. data/sample/Animation1/m1ku_arm_2.png +0 -0
  56. data/sample/Animation1/m1ku_arm_3.png +0 -0
  57. data/sample/Animation1/m1ku_back.jpg +0 -0
  58. data/sample/Animation1/m1ku_body.png +0 -0
  59. data/sample/Animation1/m1ku_eye_0.png +0 -0
  60. data/sample/Animation1/m1ku_eye_1.png +0 -0
  61. data/sample/Animation1/m1ku_eye_2.png +0 -0
  62. data/sample/Animation1/m1ku_eye_3.png +0 -0
  63. data/sample/Animation1/m1ku_hair_front.png +0 -0
  64. data/sample/Animation1/m1ku_hair_rear.png +0 -0
  65. data/sample/Animation1/readme.txt +72 -0
  66. data/sample/Animation2/lex.rb +96 -0
  67. data/sample/Animation2/lex_back.png +0 -0
  68. data/sample/Animation2/lex_body.png +0 -0
  69. data/sample/Animation2/lex_roadroller.png +0 -0
  70. data/sample/Animation2/lex_wheel_0.png +0 -0
  71. data/sample/Animation2/lex_wheel_1.png +0 -0
  72. data/sample/Animation2/lex_wheel_2.png +0 -0
  73. data/sample/Animation2/readme.txt +72 -0
  74. data/sample/Animation2/song_title.png +0 -0
  75. data/sample/Diagram_sample/back.png +0 -0
  76. data/sample/Diagram_sample/chr01.png +0 -0
  77. data/sample/Diagram_sample/chr02.png +0 -0
  78. data/sample/Diagram_sample/cursor.png +0 -0
  79. data/sample/Diagram_sample/diagram_sample_yuki2.rb +329 -0
  80. data/sample/Diagram_sample/readme.txt +90 -0
  81. data/sample/Diagram_sample/wait_cursor.png +0 -0
  82. data/sample/Room3/blue.rb +297 -0
  83. data/sample/Room3/ending.rb +180 -0
  84. data/sample/Room3/green.rb +220 -0
  85. data/sample/Room3/image/akamatsu.png +0 -0
  86. data/sample/Room3/image/aoyama.png +0 -0
  87. data/sample/Room3/image/congra.png +0 -0
  88. data/sample/Room3/image/congratulation.png +0 -0
  89. data/sample/Room3/image/congratulation_bg.png +0 -0
  90. data/sample/Room3/image/cursor.png +0 -0
  91. data/sample/Room3/image/midori.png +0 -0
  92. data/sample/Room3/image/mittsu_no_oheya.png +0 -0
  93. data/sample/Room3/image/mittsu_no_oheya_logo.png +0 -0
  94. data/sample/Room3/image/room_blue.png +0 -0
  95. data/sample/Room3/image/room_green.png +0 -0
  96. data/sample/Room3/image/room_red.png +0 -0
  97. data/sample/Room3/image/start.png +0 -0
  98. data/sample/Room3/image/three_doors.png +0 -0
  99. data/sample/Room3/image/wait_cursor.png +0 -0
  100. data/sample/Room3/main.rb +120 -0
  101. data/sample/Room3/main_component.rb +59 -0
  102. data/sample/Room3/readme.txt +76 -0
  103. data/sample/Room3/red.rb +227 -0
  104. data/sample/Room3/room3.rb +25 -0
  105. data/sample/Room3/title.rb +184 -0
  106. data/sample/ball_action_sample.rb +204 -0
  107. data/sample/blit_rop.rb +70 -0
  108. data/sample/cairo_sample.rb +25 -0
  109. data/sample/circle_collision_test.rb +66 -0
  110. data/sample/collision_test.rb +33 -0
  111. data/sample/collision_test2.rb +108 -0
  112. data/sample/fixed_map_test/cursor.png +0 -0
  113. data/sample/fixed_map_test/fixed_map_sample.rb +140 -0
  114. data/sample/fixed_map_test/map.csv +19 -0
  115. data/sample/fixed_map_test/map_01.png +0 -0
  116. data/sample/fixed_map_test/mapchip.csv +23 -0
  117. data/sample/fixed_map_test/monster.png +0 -0
  118. data/sample/fixed_map_test/readme.txt +72 -0
  119. data/sample/map_test/chara.rb +58 -0
  120. data/sample/map_test/chr1.png +0 -0
  121. data/sample/map_test/cursor.png +0 -0
  122. data/sample/map_test/main_parts.rb +69 -0
  123. data/sample/map_test/main_scene.rb +153 -0
  124. data/sample/map_test/map.png +0 -0
  125. data/sample/map_test/map2.png +0 -0
  126. data/sample/map_test/map_layer.csv +127 -0
  127. data/sample/map_test/map_manager.rb +75 -0
  128. data/sample/map_test/map_test.rb +23 -0
  129. data/sample/map_test/mapchip.csv +21 -0
  130. data/sample/map_test/oasis.rb +71 -0
  131. data/sample/map_test/readme.txt +89 -0
  132. data/sample/map_test/route.rb +157 -0
  133. data/sample/map_test/sea.png +0 -0
  134. data/sample/map_test/town.rb +74 -0
  135. data/sample/map_test/wait_cursor.png +0 -0
  136. data/sample/map_test/window.png +0 -0
  137. data/sample/polygon_test.rb +35 -0
  138. data/sample/rasterscroll.rb +25 -0
  139. data/sample/takahashi.rb +42 -0
  140. data/sample/text.png +0 -0
  141. data/sample/textbox_sample.rb +190 -0
  142. data/sample/transform.rb +54 -0
  143. data/sample/utility_test.rb +73 -0
  144. data/sample/utility_test2.rb +61 -0
  145. data/sample/utility_test3.rb +64 -0
  146. data/sample/utility_test4.rb +73 -0
  147. data/uninstall_miyako.rb +19 -0
  148. metadata +199 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,72 @@
1
+ *******************************************************************************
2
+ �y ��Җ� �z�@�T�C���X��
3
+ �y �\�t�g�� �z�@Miyako v2.0�T���v��(�A�j���[�V�����P)
4
+ �y �o�[�W���� �z�@2.0
5
+ �y �쐬�� �z�@2009/04/13
6
+ �y ��� �z�@�t���[�E�F�A
7
+ �y �J������ �z�@Ruby 1.9.1-p0
8
+ �y �����^�C�� �z�@Miyako v2.0
9
+ �y �Ή��@�� �z�@Windows 2000/XP/Vista�ALinux
10
+ �y �Ĕz�z �z�@�C��BSD���C�Z���X�ɂ��
11
+ �y �]�� �z�@�C��BSD���C�Z���X�ɂ��
12
+ �y�z�[���y�[�W�z�@http://www.twin.ne.jp/~cyross/Miyako/
13
+ �y �A���� �z�@cyross@po.twin.ne.jp
14
+ *******************************************************************************
15
+
16
+ �E�T�v
17
+
18
+ �@���̃v���O�����́AMiyako v2.0�ȍ~�ɑΉ�����AMiyako�T���v���v���O�����ł��B
19
+ �@�ǂ����Ō������Ƃ���悤�Ȗ����悤�ȃL�����N�^�[���A����l�M��U���Ă��܂��B
20
+
21
+ �EMiyako�ɂ‚���
22
+
23
+ �@Miyako�Ɋւ��ẮA�ȉ���URL���Q�l�ɂ��Ă��������B
24
+ http://www.twin.ne.jp/~cyross/Miyako/
25
+
26
+ �@Miyako(Ruby�ARuby/SDL�܂�)�̃C���X�g�[���Ɋւ��܂��ẮA
27
+ ��LURL��H���ē�����A�[�J�C�u���ꂽMiyako���C�u������
28
+ �W�J����ƁAreadme.txt�������܂��̂ŁA����������Q�Ɖ������B
29
+
30
+ �@�{�T���v���ł́AMiyako��Windows��œ��삷�邱�Ƃ�O��ɂ��Ă��܂��B
31
+ �i�C���X�g�[������Ruby���s�‹���ActiveRuby�ł��邱�Ƃ��O���
32
+ �@���Ă��܂��j
33
+
34
+ �E�N�����@
35
+
36
+ �@�G�N�X�v���[���[���J���A�{�T���v���̃t�H���_���ŁA�um1ku.rb�v��
37
+ �_�u���N���b�N���܂��B
38
+ �@�������́A�R�}���h���C����œ������ꍇ�́A�{�T���v���̃f�B���N�g����
39
+ �ړ����āA�ȉ��̃R�}���h����͂��܂��B
40
+
41
+ �@ruby m1ku.rb
42
+
43
+ �E�Ɛӎ���
44
+
45
+ �@�{�T���v���͖��ۏ؂ł��B�����{�T���v�����g�p���邱�Ƃɂ��s��E�g���u��
46
+ ���N�������Ƃ��Ă��A�����Ȃ�g���u���ɑ΂���ӔC�𕉂�Ȃ����Ƃ��������������B
47
+
48
+ �@�{�T���v���́A�C��BSD���C�Z���X�Ɋ�Â����]�ځE�Ĕz�z�����‚��܂��B
49
+
50
+ �EBSD���C�Z���X��
51
+
52
+ Copyright (c) 2008, Cyross Makoto
53
+
54
+ All rights reserved.
55
+
56
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
57
+
58
+ �ERedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
59
+ �ERedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
60
+ �ENeither the name of the Cyross Makoto nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
61
+
62
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
63
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
64
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
65
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
66
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
67
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
68
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
69
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
70
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
71
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
72
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,96 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #! /usr/bin/ruby
3
+ # Lex sample for Miyako v2.0
4
+ # 2008.11.24 Cyross Makoto
5
+
6
+ require 'Miyako/miyako'
7
+
8
+ include Miyako
9
+
10
+ def create_wheel(num)
11
+ spr = Sprite.new({:file=>sprintf("lex_wheel_#{num}.png"), :type=>:ck})
12
+ spr.move_to!(317, 331)
13
+ return spr
14
+ end
15
+
16
+
17
+ back = Plane.new({:file=>sprintf("lex_back.png"), :type=>:as})
18
+ back_timer = WaitCounter.new(0.1)
19
+
20
+ title = Sprite.new({:file=>sprintf("song_title.png"), :type=>:ck})
21
+ pos = Screen.h
22
+ upper = 24
23
+ x = 24
24
+ title.move_to!(x, pos)
25
+ title_timer = WaitCounter.new(2)
26
+ interval = 8
27
+ mode = 0
28
+
29
+ len_body = Sprite.new({:file=>sprintf("lex_body.png"), :type=>:ck})
30
+ len_body.move_to!(425, 219)
31
+
32
+ len_anim_param = {
33
+ :sprite => len_body,
34
+ :wait => 0.1,
35
+ :move_offset => [[0,0], [0,-1], [0,0], [0,1]]
36
+ }
37
+ len_anim = SpriteAnimation.new(len_anim_param)
38
+ len_anim.start
39
+
40
+ road_roller = Sprite.new({:file=>sprintf("lex_roadroller.png"), :type=>:ck})
41
+ road_roller.move_to!(310, 180)
42
+
43
+ rr_anim_param = {
44
+ :sprite => road_roller,
45
+ :wait => 0.1,
46
+ :move_offset => [[0,0], [0,1], [0,0], [0,-1]]
47
+ }
48
+ rr_anim = SpriteAnimation.new(rr_anim_param)
49
+ rr_anim.start
50
+
51
+ wheels = Array.new
52
+ (0..2).each{|n| wheels.push(create_wheel(n)) }
53
+ wheel_anim_param = {
54
+ :sprite => wheels,
55
+ :wait => 0.1,
56
+ :pattern_list => [0, 1, 2, 1]
57
+ }
58
+ wheel_anim = SpriteAnimation.new(wheel_anim_param)
59
+ wheel_anim.start
60
+
61
+ back_timer.start
62
+ title_timer.start
63
+ Miyako.main_loop do
64
+ break if Input.quit_or_escape?
65
+ len_anim.update_animation
66
+ rr_anim.update_animation
67
+ wheel_anim.update_animation
68
+ if back_timer.finish?
69
+ back.move!(-2, 0)
70
+ back_timer.start
71
+ end
72
+ if title_timer.finish?
73
+ case mode
74
+ when 0
75
+ mode = 1
76
+ title_timer = WaitCounter.new(0.1)
77
+ title_timer.start
78
+ when 1
79
+ pos -= interval
80
+ if pos <= upper
81
+ pos = upper
82
+ mode = 2
83
+ else
84
+ title_timer.start
85
+ end
86
+ title.move_to!(x, pos)
87
+ when 2
88
+ # no operation
89
+ end
90
+ end
91
+ back.render
92
+ wheel_anim.render
93
+ len_anim.render
94
+ rr_anim.render
95
+ title.render if mode > 0
96
+ end
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,72 @@
1
+ *******************************************************************************
2
+ �y ��Җ� �z�@�T�C���X��
3
+ �y �\�t�g�� �z�@Miyako v2.0�T���v��(�A�j���[�V�����Q)
4
+ �y �o�[�W���� �z�@2.0
5
+ �y �쐬�� �z�@2009/04/13
6
+ �y ��� �z�@�t���[�E�F�A
7
+ �y �J������ �z�@Ruby 1.9.1-p0
8
+ �y �����^�C�� �z�@Miyako v2.0
9
+ �y �Ή��@�� �z�@Windows 2000/XP/Vista�ALinux
10
+ �y �Ĕz�z �z�@�C��BSD���C�Z���X�ɂ��
11
+ �y �]�� �z�@�C��BSD���C�Z���X�ɂ��
12
+ �y�z�[���y�[�W�z�@http://www.twin.ne.jp/~cyross/Miyako/
13
+ �y �A���� �z�@cyross@po.twin.ne.jp
14
+ *******************************************************************************
15
+
16
+ �E�T�v
17
+
18
+ �@���̃v���O�����́AMiyako v2.0�ȍ~�ɑΉ�����AMiyako�T���v���v���O�����ł��B
19
+ �@�ǂ����Ō������Ƃ���悤�Ȗ����悤�ȃL�����N�^�[���A���[�h���[���[���^�]���Ă��܂��B
20
+
21
+ �EMiyako�ɂ‚���
22
+
23
+ �@Miyako�Ɋւ��ẮA�ȉ���URL���Q�l�ɂ��Ă��������B
24
+ http://www.twin.ne.jp/~cyross/Miyako/
25
+
26
+ �@Miyako(Ruby�ARuby/SDL�܂�)�̃C���X�g�[���Ɋւ��܂��ẮA
27
+ ��LURL��H���ē�����A�[�J�C�u���ꂽMiyako���C�u������
28
+ �W�J����ƁAreadme.txt�������܂��̂ŁA����������Q�Ɖ������B
29
+
30
+ �@�{�T���v���ł́AMiyako��Windows��œ��삷�邱�Ƃ�O��ɂ��Ă��܂��B
31
+ �i�C���X�g�[������Ruby���s�‹���ActiveRuby�ł��邱�Ƃ��O���
32
+ �@���Ă��܂��j
33
+
34
+ �E�N�����@
35
+
36
+ �@�G�N�X�v���[���[���J���A�{�T���v���̃t�H���_���ŁA�um1ku.rb�v��
37
+ �_�u���N���b�N���܂��B
38
+ �@�������́A�R�}���h���C����œ������ꍇ�́A�{�T���v���̃f�B���N�g����
39
+ �ړ����āA�ȉ��̃R�}���h����͂��܂��B
40
+
41
+ �@ruby lex.rb
42
+
43
+ �E�Ɛӎ���
44
+
45
+ �@�{�T���v���͖��ۏ؂ł��B�����{�T���v�����g�p���邱�Ƃɂ��s��E�g���u��
46
+ ���N�������Ƃ��Ă��A�����Ȃ�g���u���ɑ΂���ӔC�𕉂�Ȃ����Ƃ��������������B
47
+
48
+ �@�{�T���v���́A�C��BSD���C�Z���X�Ɋ�Â����]�ځE�Ĕz�z�����‚��܂��B
49
+
50
+ �EBSD���C�Z���X��
51
+
52
+ Copyright (c) 2008, Cyross Makoto
53
+
54
+ All rights reserved.
55
+
56
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
57
+
58
+ �ERedistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
59
+ �ERedistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
60
+ �ENeither the name of the Cyross Makoto nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
61
+
62
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
63
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
64
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
65
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
66
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
67
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
68
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
69
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
70
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
71
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
72
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,329 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #! /usr/bin/ruby
3
+ # Diagram sample for Miyako v2.0
4
+ # 2009.1.16 Cyross Makoto
5
+
6
+ require 'Miyako/miyako'
7
+
8
+ include Miyako
9
+
10
+ # 移動が遅いスクロール
11
+ class MoveSlower
12
+ include Diagram::NodeBase
13
+
14
+ def initialize(spr)
15
+ @spr = spr
16
+ @finish = false # 終了フラグ
17
+ end
18
+
19
+ def start
20
+ @spr.move_to!(640, @spr.y) # 画面を出たところまで移動
21
+ end
22
+
23
+ def update
24
+ @finish = (@spr.x <= 320) # 所定の位置までスクロールさせたら終了
25
+ return if @finish
26
+ @spr.move!(-2,0)
27
+ end
28
+
29
+ def render
30
+ @spr.render
31
+ end
32
+
33
+ def finish?
34
+ return @finish
35
+ end
36
+ end
37
+
38
+ # 移動が速いスクロール
39
+ class MoveFaster
40
+ include Diagram::NodeBase
41
+
42
+ def initialize(spr)
43
+ @spr = spr
44
+ @finish = false # 終了フラグ
45
+ end
46
+
47
+ def start
48
+ @spr.move_to!(640, @spr.y) # 画面を出たところまで移動
49
+ end
50
+
51
+ def update
52
+ @finish = (@spr.x <= 40) # 所定の位置までスクロールさせたら終了
53
+ return if @finish
54
+ @spr.move!(-4,0)
55
+ end
56
+
57
+ def render
58
+ @spr.render
59
+ end
60
+
61
+ def finish?
62
+ return @finish
63
+ end
64
+ end
65
+
66
+ class WaitTrigger
67
+ include Diagram::TriggerBase
68
+
69
+ def initialize(wait=0.1)
70
+ @timer = WaitCounter.new(wait)
71
+ end
72
+
73
+ def pre_process
74
+ @timer.start
75
+ end
76
+
77
+ def update?
78
+ @timer.finish?
79
+ end
80
+
81
+ def post_update
82
+ @timer.start
83
+ end
84
+
85
+ def post_process
86
+ @timer.stop
87
+ end
88
+ end
89
+
90
+ # 移動アニメーションノード
91
+ class Moving
92
+ include Diagram::NodeBase
93
+
94
+ def initialize(parts, wait)
95
+ @parts = parts
96
+ @pr = {}
97
+ @pr[:fast] = Diagram::Processor.new{|dia|
98
+ dia.add :scroll, MoveFaster.new(@parts[:c1]), WaitTrigger.new(wait)
99
+ dia.add_arrow(:scroll, nil)
100
+ }
101
+
102
+ @pr[:slow] = Diagram::Processor.new{|dia|
103
+ dia.add :scroll, MoveSlower.new(@parts[:c2]), WaitTrigger.new(wait)
104
+ dia.add_arrow(:scroll, nil)
105
+ }
106
+
107
+ @finished = false
108
+ end
109
+
110
+ def start
111
+ @pr.keys.each{|k| @pr[k].start }
112
+ end
113
+
114
+ def update
115
+ @finished = @pr.keys.inject(true){|r, k|
116
+ @pr[k].update
117
+ r &= @pr[k].finish?
118
+ } # アニメーション処理が終了するまで繰り返し
119
+ end
120
+
121
+ def stop
122
+ @pr.keys.each{|k| @pr[k].stop }
123
+ end
124
+
125
+ def render
126
+ @parts[:bk].render
127
+ # 通常なら。@pr[:fast].render,@pr[:slow].renderが筋だが、
128
+ # @pr[:fast]が終了すると、renderを呼んでも描画されないため、元の画像を表示する
129
+ @parts[:c1].render
130
+ @parts[:c2].render
131
+ end
132
+
133
+ def finish?
134
+ return @finished
135
+ end
136
+ end
137
+
138
+ # Yukiプロット開始
139
+ class StartPlot
140
+ include Diagram::NodeBase
141
+
142
+ def initialize(manager, parts, imgs)
143
+ @manager = manager
144
+ @parts = parts
145
+ @imgs = imgs
146
+ @finished = false
147
+ end
148
+
149
+ def start
150
+ end
151
+
152
+ def update
153
+ @manager.start_plot
154
+ @parts.start
155
+ @finished = true
156
+ end
157
+
158
+ def stop
159
+ end
160
+
161
+ def render
162
+ @imgs[:bk].render
163
+ @imgs[:c1].render
164
+ @imgs[:c2].render
165
+ end
166
+
167
+ def finish?
168
+ return @finished
169
+ end
170
+ end
171
+
172
+ # Yukiプロット実行
173
+ class Plotting
174
+ include Diagram::NodeBase
175
+
176
+ def initialize(manager, parts, imgs, set_wait)
177
+ @manager = manager
178
+ @parts = parts
179
+ @imgs = imgs
180
+ @set = set_wait
181
+ @finished = false
182
+ end
183
+
184
+ def start
185
+ end
186
+
187
+ def update
188
+ @manager.update
189
+ @parts.update
190
+ @parts.update_animation
191
+ @finished = !(@manager.executing?)
192
+ end
193
+
194
+ def update_input
195
+ @set.call(0.0) if (Input.pushed_any?(:btn1) || Input.click?(:left)) # 1ボタンを押すor左クリックしたら、表示途中のメッセージをすべて表示
196
+ end
197
+
198
+ def render
199
+ @imgs[:bk].render
200
+ @imgs[:c1].render
201
+ @imgs[:c2].render
202
+ @manager.render
203
+ @parts.render
204
+ end
205
+
206
+ def stop
207
+ end
208
+
209
+ def finish?
210
+ return @finished
211
+ end
212
+ end
213
+
214
+ class MainScene
215
+ include Story::Scene
216
+
217
+ TEXTBOX_MARGIN = 16
218
+ TEXTBOX_BOTTOM = 24
219
+
220
+ def init
221
+ ws = Sprite.new(:file=>"wait_cursor.png", :type=>:ac)
222
+ ws.oh = ws.ow
223
+ ws = SpriteAnimation.new(:sprite=>ws, :wait=>0.2, :pattern_list=>[0,1,2,3,2,1])
224
+ @ws = ws
225
+ cs = Sprite.new(:file=>"cursor.png", :type=>:ac)
226
+ cs.oh = cs.ow
227
+ cs = SpriteAnimation.new(:sprite=>cs, :wait=>0.2, :pattern_list=>[0,1,2,3,2,1])
228
+ font = Font.sans_serif
229
+ font.color = Color[:white]
230
+ font.size = 24
231
+ @box = TextBox.new(:size=>[20,5], :wait_cursor => ws, :select_cursor => cs, :font => font)
232
+ @box_bg = Sprite.new(:size => @box.size.to_a.map{|v| v + TEXTBOX_MARGIN}, :type => :ac)
233
+ @box_bg.fill([0,0,255,128])
234
+ @parts = Parts.new(@box.size)
235
+ @parts[:box_bg] = @box_bg
236
+ @parts[:box] = @box
237
+ @parts[:box_bg].centering!
238
+ @parts[:box].centering!
239
+ @parts.center!.bottom!{ TEXTBOX_BOTTOM }
240
+
241
+ @yuki = Yuki.new
242
+ @yuki.update_text = self.method(:update_text)
243
+
244
+ @imgs = {}
245
+ @imgs[:c1] = Sprite.new(:file=>"chr01.png", :type=>:ac).bottom!
246
+ @imgs[:c2] = Sprite.new(:file=>"chr02.png", :type=>:ac).bottom!
247
+ @imgs[:bk] = Sprite.new(:file=>"back.png", :type=>:as).centering!
248
+
249
+
250
+ @pr = Diagram::Processor.new{|dia|
251
+ dia.add :move, Moving.new(@imgs, 0.01)
252
+ dia.add :start, StartPlot.new(@yuki, @parts, @imgs)
253
+ dia.add :plot, Plotting.new(@yuki, @parts, @imgs, lambda{|w| set_wait(w) })
254
+ dia.add_arrow(:move, :start){|from| from.finish? }
255
+ dia.add_arrow(:start, :plot){|from| from.finish? }
256
+ dia.add_arrow(:plot, nil){|from| from.finish? }
257
+ }
258
+
259
+ @base_wait = 0.1 # ウェイト基本値
260
+ @wait = @base_wait # ウェイト
261
+ end
262
+
263
+ def setup
264
+ @pr.start
265
+ @yuki.setup(@box, plot){|box, pl|
266
+ select_textbox box
267
+ select_plot pl
268
+ select_first_page nil # nil, :page1, :page2が選択可能
269
+ }
270
+ end
271
+
272
+ def update
273
+ return nil if Input.quit_or_escape?
274
+ @pr.update_input
275
+ @pr.update
276
+ return nil if @pr.finish?
277
+ return @now
278
+ end
279
+
280
+ def render
281
+ @pr.render
282
+ end
283
+
284
+ def plot
285
+ yuki_plot{
286
+ text_method :string do
287
+ page :page1 do
288
+ text "「ねえ、あんたの担当のセリフ、ちゃんと覚えてるわよねぇ?"
289
+ cr
290
+ pause
291
+ text " まさか、忘れてたなんて言わないわよねぇ?」"
292
+ end
293
+ clear
294
+ page :page2 do
295
+ color :red do
296
+ size 32 do
297
+ size(24){ "「そんなこと" }
298
+ text "ない"
299
+ size(24){ "よぉ~" }
300
+ end
301
+ cr
302
+ pause
303
+ text " ちゃんと覚えてるよぉ~」"
304
+ cr
305
+ end
306
+ end
307
+ end
308
+ }
309
+ end
310
+
311
+ def update_text(yuki, ch)
312
+ yuki.wait @wait # 1文字ずつ表示させる
313
+ end
314
+
315
+ def set_wait(wait)
316
+ @wait = wait
317
+ end
318
+
319
+ def reset_wait
320
+ @wait = @base_wait
321
+ end
322
+
323
+ def final
324
+ @pr.stop
325
+ end
326
+ end
327
+
328
+ ds = Story.new
329
+ ds.run(MainScene)