cyross-ruby-miyako 2.0.0
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 +977 -0
- data/Rakefile +7 -0
- data/img/cursor.png +0 -0
- data/img/cursors.png +0 -0
- data/img/dice.png +0 -0
- data/img/wait_cursor.png +0 -0
- data/img/win_base.png +0 -0
- data/img/window.png +0 -0
- data/install_miyako.rb +75 -0
- data/lib/Miyako/API/audio.rb +198 -0
- data/lib/Miyako/API/basic_data.rb +431 -0
- data/lib/Miyako/API/bitmap.rb +35 -0
- data/lib/Miyako/API/choices.rb +308 -0
- data/lib/Miyako/API/collision.rb +444 -0
- data/lib/Miyako/API/diagram.rb +573 -0
- data/lib/Miyako/API/drawing.rb +110 -0
- data/lib/Miyako/API/fixedmap.rb +315 -0
- data/lib/Miyako/API/font.rb +384 -0
- data/lib/Miyako/API/input.rb +440 -0
- data/lib/Miyako/API/layout.rb +451 -0
- data/lib/Miyako/API/map.rb +403 -0
- data/lib/Miyako/API/map_event.rb +198 -0
- data/lib/Miyako/API/modules.rb +109 -0
- data/lib/Miyako/API/movie.rb +151 -0
- data/lib/Miyako/API/parts.rb +154 -0
- data/lib/Miyako/API/plane.rb +131 -0
- data/lib/Miyako/API/screen.rb +257 -0
- data/lib/Miyako/API/shape.rb +362 -0
- data/lib/Miyako/API/sprite.rb +338 -0
- data/lib/Miyako/API/sprite_animation.rb +461 -0
- data/lib/Miyako/API/spriteunit.rb +113 -0
- data/lib/Miyako/API/story.rb +224 -0
- data/lib/Miyako/API/textbox.rb +496 -0
- data/lib/Miyako/API/viewport.rb +435 -0
- data/lib/Miyako/API/yuki.rb +779 -0
- data/lib/Miyako/EXT/miyako_cairo.rb +60 -0
- data/lib/Miyako/EXT/raster_scroll.rb +138 -0
- data/lib/Miyako/EXT/slides.rb +136 -0
- data/lib/Miyako/miyako.rb +172 -0
- data/miyako.png +0 -0
- data/miyako_banner.png +0 -0
- data/miyako_no_katana/extconf.rb +34 -0
- data/miyako_no_katana/miyako_no_katana.c +3301 -0
- data/sample/Animation1/m1ku.rb +89 -0
- data/sample/Animation1/m1ku_arm_0.png +0 -0
- data/sample/Animation1/m1ku_arm_1.png +0 -0
- data/sample/Animation1/m1ku_arm_2.png +0 -0
- data/sample/Animation1/m1ku_arm_3.png +0 -0
- data/sample/Animation1/m1ku_back.jpg +0 -0
- data/sample/Animation1/m1ku_body.png +0 -0
- data/sample/Animation1/m1ku_eye_0.png +0 -0
- data/sample/Animation1/m1ku_eye_1.png +0 -0
- data/sample/Animation1/m1ku_eye_2.png +0 -0
- data/sample/Animation1/m1ku_eye_3.png +0 -0
- data/sample/Animation1/m1ku_hair_front.png +0 -0
- data/sample/Animation1/m1ku_hair_rear.png +0 -0
- data/sample/Animation1/readme.txt +72 -0
- data/sample/Animation2/lex.rb +95 -0
- data/sample/Animation2/lex_back.png +0 -0
- data/sample/Animation2/lex_body.png +0 -0
- data/sample/Animation2/lex_roadroller.png +0 -0
- data/sample/Animation2/lex_wheel_0.png +0 -0
- data/sample/Animation2/lex_wheel_1.png +0 -0
- data/sample/Animation2/lex_wheel_2.png +0 -0
- data/sample/Animation2/readme.txt +72 -0
- data/sample/Animation2/song_title.png +0 -0
- data/sample/Diagram_sample/back.png +0 -0
- data/sample/Diagram_sample/chr01.png +0 -0
- data/sample/Diagram_sample/chr02.png +0 -0
- data/sample/Diagram_sample/cursor.png +0 -0
- data/sample/Diagram_sample/diagram_sample_yuki2.rb +283 -0
- data/sample/Diagram_sample/readme.txt +87 -0
- data/sample/Diagram_sample/wait_cursor.png +0 -0
- data/sample/Room3/blue.rb +250 -0
- data/sample/Room3/ending.rb +175 -0
- data/sample/Room3/green.rb +185 -0
- data/sample/Room3/image/akamatsu.png +0 -0
- data/sample/Room3/image/aoyama.png +0 -0
- data/sample/Room3/image/congra.png +0 -0
- data/sample/Room3/image/congratulation.png +0 -0
- data/sample/Room3/image/congratulation_bg.png +0 -0
- data/sample/Room3/image/cursor.png +0 -0
- data/sample/Room3/image/midori.png +0 -0
- data/sample/Room3/image/mittsu_no_oheya.png +0 -0
- data/sample/Room3/image/mittsu_no_oheya_logo.png +0 -0
- data/sample/Room3/image/room_blue.png +0 -0
- data/sample/Room3/image/room_green.png +0 -0
- data/sample/Room3/image/room_red.png +0 -0
- data/sample/Room3/image/start.png +0 -0
- data/sample/Room3/image/three_doors.png +0 -0
- data/sample/Room3/image/wait_cursor.png +0 -0
- data/sample/Room3/main.rb +102 -0
- data/sample/Room3/main_component.rb +58 -0
- data/sample/Room3/readme.txt +76 -0
- data/sample/Room3/red.rb +200 -0
- data/sample/Room3/room3.rb +26 -0
- data/sample/Room3/title.rb +171 -0
- data/sample/fixed_map_test/cursor.png +0 -0
- data/sample/fixed_map_test/fixed_map_sample.rb +149 -0
- data/sample/fixed_map_test/map.csv +19 -0
- data/sample/fixed_map_test/map_01.png +0 -0
- data/sample/fixed_map_test/map_sample.rb +121 -0
- data/sample/fixed_map_test/mapchip.csv +23 -0
- data/sample/fixed_map_test/monster.png +0 -0
- data/sample/fixed_map_test/readme.txt +72 -0
- data/sample/map_test/chara.rb +50 -0
- data/sample/map_test/chr1.png +0 -0
- data/sample/map_test/cursor.png +0 -0
- data/sample/map_test/main_parts.rb +48 -0
- data/sample/map_test/main_scene.rb +137 -0
- data/sample/map_test/map.png +0 -0
- data/sample/map_test/map2.png +0 -0
- data/sample/map_test/map_layer.csv +127 -0
- data/sample/map_test/map_manager.rb +92 -0
- data/sample/map_test/map_test.rb +23 -0
- data/sample/map_test/mapchip.csv +21 -0
- data/sample/map_test/oasis.rb +65 -0
- data/sample/map_test/readme.txt +87 -0
- data/sample/map_test/route.rb +144 -0
- data/sample/map_test/sea.png +0 -0
- data/sample/map_test/town.rb +68 -0
- data/sample/map_test/wait_cursor.png +0 -0
- data/sample/map_test/window.png +0 -0
- data/win/miyako_no_katana.so +0 -0
- metadata +194 -0
data/Rakefile
ADDED
data/img/cursor.png
ADDED
Binary file
|
data/img/cursors.png
ADDED
Binary file
|
data/img/dice.png
ADDED
Binary file
|
data/img/wait_cursor.png
ADDED
Binary file
|
data/img/win_base.png
ADDED
Binary file
|
data/img/window.png
ADDED
Binary file
|
data/install_miyako.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
if RUBY_VERSION < '1.8.7'
|
2
|
+
puts 'Sorry. Miyako needs Ruby 1.8.7 or above...'
|
3
|
+
exit
|
4
|
+
end
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'sdl'
|
8
|
+
rescue
|
9
|
+
puts 'Sorry. Miyako needs Ruby/SDL...'
|
10
|
+
exit
|
11
|
+
end
|
12
|
+
|
13
|
+
if SDL::VERSION < '2.0'
|
14
|
+
puts 'Sorry. Miyako needs Ruby/SDL 2.0.0 or above...'
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'rbconfig'
|
19
|
+
require 'fileutils'
|
20
|
+
require 'optparse'
|
21
|
+
|
22
|
+
option = { :noop => false, :verbose => true }
|
23
|
+
not_force = true
|
24
|
+
|
25
|
+
ARGV.options do |opt|
|
26
|
+
opt.on('--no-harm'){ option[:noop] = true }
|
27
|
+
opt.on('--force'){ not_force = false }
|
28
|
+
opt.on('--quiet'){ option[:verbose] = false }
|
29
|
+
|
30
|
+
opt.parse!
|
31
|
+
end
|
32
|
+
|
33
|
+
ext_dir = "./"
|
34
|
+
osn = Config::CONFIG["target_os"].downcase
|
35
|
+
if osn =~ /mswin|mingw|cygwin|bccwin/
|
36
|
+
ext_dir = "win/"
|
37
|
+
elsif osn =~ /darwin/ # Mac OS X
|
38
|
+
unless ENV['SDL_CONFIG_PATH']
|
39
|
+
puts 'Please set SDL_CONFIG_PATH environment variable...'
|
40
|
+
puts "USAGE: SDL_CONFIG_PATH='/bin/sh /hoge/foo/sdl-config"
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
system("cd miyako_no_katana/ ; " + Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='#{ENV['SDL_CONFIG_PATH']}'; make ; cp miyako_no_katana.bundle ../")
|
44
|
+
else # linux, U*IX...
|
45
|
+
unless ENV['SDL_CONFIG_PATH']
|
46
|
+
puts 'Please set SDL_CONFIG_PATH environment variable...'
|
47
|
+
puts "USAGE: SDL_CONFIG_PATH='/bin/sh /hoge/foo/sdl-config"
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
system("cd miyako_no_katana/ ; " + Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='#{ENV['SDL_CONFIG_PATH']}'; make ; cp miyako_no_katana.so ../")
|
51
|
+
end
|
52
|
+
|
53
|
+
sitelibdir = Config::CONFIG["sitelibdir"] + "/Miyako"
|
54
|
+
apidir = sitelibdir + "/API"
|
55
|
+
extdir = sitelibdir + "/EXT"
|
56
|
+
|
57
|
+
if FileTest.exist?(sitelibdir) && not_force
|
58
|
+
puts "#{sitelibdir} is arleady exists."
|
59
|
+
puts "Are you sure?(Y/else)"
|
60
|
+
exit unless $stdin.gets.split(//)[0].upcase == 'Y'
|
61
|
+
end
|
62
|
+
|
63
|
+
FileUtils.remove_dir(sitelibdir, true)
|
64
|
+
FileUtils.mkpath(sitelibdir, option)
|
65
|
+
FileUtils.mkpath(apidir, option)
|
66
|
+
FileUtils.mkpath(extdir, option)
|
67
|
+
|
68
|
+
if osn =~ /darwin/ # Mac OS X
|
69
|
+
Dir.glob(ext_dir + "*.bundle"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
70
|
+
else # Windows, linux, U*IX...
|
71
|
+
Dir.glob(ext_dir + "*.so"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
72
|
+
end
|
73
|
+
Dir.glob("lib/Miyako/*.rb"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
74
|
+
Dir.glob("lib/Miyako/API/*.rb"){|fname| FileUtils.install(fname, apidir, option)}
|
75
|
+
Dir.glob("lib/Miyako/EXT/*.rb"){|fname| FileUtils.install(fname, extdir, option)}
|
@@ -0,0 +1,198 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
=begin
|
3
|
+
--
|
4
|
+
Miyako v1.5
|
5
|
+
Copyright (C) 2007-2008 Cyross Makoto
|
6
|
+
|
7
|
+
This library is free software; you can redistribute it and/or
|
8
|
+
modify it under the terms of the GNU Lesser General Public
|
9
|
+
License as published by the Free Software Foundation; either
|
10
|
+
version 2.1 of the License, or (at your option) any later version.
|
11
|
+
|
12
|
+
This library is distributed in the hope that it will be useful,
|
13
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
Lesser General Public License for more details.
|
16
|
+
|
17
|
+
You should have received a copy of the GNU Lesser General Public
|
18
|
+
License along with this library; if not, write to the Free Software
|
19
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
20
|
+
++
|
21
|
+
=end
|
22
|
+
|
23
|
+
module Miyako
|
24
|
+
#==オーディオ管理モジュール
|
25
|
+
#オーディオにはBGM,SE(効果音)の2種類あり、扱えるメソッドが少々違う(別クラスになっている)。
|
26
|
+
module Audio
|
27
|
+
#==BGM管理クラス
|
28
|
+
class BGM
|
29
|
+
#===インスタンスを生成する
|
30
|
+
#_fname_:: 演奏するBGMファイル名。対応ファイルはwav,mp3,ogg,mid等。
|
31
|
+
#_loops_:: ループの可否を指定する。trueのとき繰り返し再生を行う
|
32
|
+
#返却値:: 生成したインスタンス
|
33
|
+
def initialize(fname, loops = true)
|
34
|
+
return if $not_use_audio
|
35
|
+
@bgm = SDL::Mixer::Music.load(fname)
|
36
|
+
@loops = loops
|
37
|
+
end
|
38
|
+
|
39
|
+
#===音の大きさを設定する
|
40
|
+
#_v_:: 音の大きさ。0〜255までの整数。255で最大。
|
41
|
+
#返却値:: 自分自身を返す
|
42
|
+
def set_volume(v)
|
43
|
+
return self if $not_use_audio
|
44
|
+
SDL::Mixer.setVolumeMusic(v)
|
45
|
+
return self
|
46
|
+
end
|
47
|
+
|
48
|
+
alias_method(:setVolume, :set_volume)
|
49
|
+
|
50
|
+
#===BGMを演奏する。ブロックが渡されている場合、ブロックの評価中のみ演奏する。
|
51
|
+
#_vol_:: 音の大きさ(省略可能)。0〜255までの整数。
|
52
|
+
#返却値:: 自分自身を返す
|
53
|
+
def play(vol = nil)
|
54
|
+
return self if $not_use_audio
|
55
|
+
set_volume(vol) if vol
|
56
|
+
l = @loops ? -1 : 0
|
57
|
+
SDL::Mixer.playMusic(@bgm, l).to_s()
|
58
|
+
if block_given?
|
59
|
+
yield self
|
60
|
+
SDL::Mixer.haltMusic
|
61
|
+
end
|
62
|
+
return self
|
63
|
+
end
|
64
|
+
|
65
|
+
#===フェードインしながら演奏する
|
66
|
+
#_msec_:: フェードインの時間。ミリ秒単位。デフォルトは5000ミリ秒(5秒)
|
67
|
+
#返却値:: 自分自身を返す
|
68
|
+
def fade_in(msec=5000)
|
69
|
+
return self if $not_use_audio
|
70
|
+
l = @loops ? -1 : 0
|
71
|
+
SDL::Mixer.fadeInMusic(@bgm, l, msec)
|
72
|
+
return self
|
73
|
+
end
|
74
|
+
|
75
|
+
alias_method(:fadeIn, :fade_in)
|
76
|
+
|
77
|
+
#===演奏中を示すフラグ
|
78
|
+
#返却値:: 演奏中はtrue、停止(一時停止)中はfalseを返す
|
79
|
+
def playing?
|
80
|
+
return false if $not_use_audio
|
81
|
+
return SDL::Mixer.playMusic?
|
82
|
+
end
|
83
|
+
|
84
|
+
#===演奏を一時停止する
|
85
|
+
#resumeメソッドで一時停止を解除する
|
86
|
+
#返却値:: 自分自身を返す
|
87
|
+
def pause
|
88
|
+
return self if $not_use_audio
|
89
|
+
SDL::Mixer.pauseMusic if SDL::Mixer.playMusic?
|
90
|
+
return self
|
91
|
+
end
|
92
|
+
|
93
|
+
#===一時停止を解除する
|
94
|
+
#返却値:: 自分自身を返す
|
95
|
+
def resume
|
96
|
+
return self if $not_use_audio
|
97
|
+
SDL::Mixer.resumeMusic if SDL::Mixer.pauseMusic?
|
98
|
+
return self
|
99
|
+
end
|
100
|
+
|
101
|
+
#===演奏を停止する
|
102
|
+
#pauseメソッドとは違い、完全に停止するため、resumeメソッドは使えない
|
103
|
+
#返却値:: 自分自身を返す
|
104
|
+
def stop
|
105
|
+
return self if $not_use_audio
|
106
|
+
SDL::Mixer.haltMusic if SDL::Mixer.playMusic?
|
107
|
+
return self
|
108
|
+
end
|
109
|
+
|
110
|
+
#===演奏をフェードアウトする
|
111
|
+
#_msec_:: フェードアウトする時間。ミリ秒単位。デフォルトは5000ミリ秒
|
112
|
+
#_wmode_:: フェードアウトする間、処理を停止するかどうかを示すフラグ。デフォルトはfalse(すぐに次の処理を開始)
|
113
|
+
#返却値:: 自分自身を返す
|
114
|
+
def fade_out(msec = 5000, wmode = false)
|
115
|
+
return self if $not_use_audio
|
116
|
+
if SDL::Mixer.playMusic?
|
117
|
+
SDL::Mixer.fadeOutMusic(msec)
|
118
|
+
SDL::delay(msec) if wmode
|
119
|
+
end
|
120
|
+
return self
|
121
|
+
end
|
122
|
+
|
123
|
+
#===演奏情報を解放する
|
124
|
+
#単なるダミー
|
125
|
+
def dispose
|
126
|
+
end
|
127
|
+
|
128
|
+
alias_method(:fadeOut, :fade_out)
|
129
|
+
end
|
130
|
+
|
131
|
+
#==効果音管理クラス
|
132
|
+
class SE
|
133
|
+
|
134
|
+
#===同時発音数を変更する
|
135
|
+
#デフォルトの同時発音数は8。発音数を減らすと鳴っている音が止まるため注意
|
136
|
+
#_channels_:: 変更するチャネル数。0以下を指定するとエラー
|
137
|
+
def SE.channels=(channels)
|
138
|
+
return if $not_use_audio
|
139
|
+
raise MiyakoError, "Illegal Channels! : #{channels}" if channels <= 0
|
140
|
+
SDL::Mixer.allocate_channels(channels)
|
141
|
+
end
|
142
|
+
|
143
|
+
#===インスタンスを生成する
|
144
|
+
#_fname_:: 効果音ファイル名。wavファイルのみ対応
|
145
|
+
#返却値:: 生成したインスタンス
|
146
|
+
def initialize(fname)
|
147
|
+
return if $not_use_audio
|
148
|
+
@wave = SDL::Mixer::Wave.load(fname)
|
149
|
+
@channel = -1
|
150
|
+
end
|
151
|
+
|
152
|
+
#===効果音を鳴らす
|
153
|
+
#_vol_:: 音の大きさ(省略可能)。0〜255の整数を設定する
|
154
|
+
#返却値:: 自分自身を返す
|
155
|
+
def play(vol = nil)
|
156
|
+
return self if $not_use_audio
|
157
|
+
set_volume(vol) if vol
|
158
|
+
@channel = SDL::Mixer.playChannel(-1, @wave, 0)
|
159
|
+
if block_given?
|
160
|
+
yield self
|
161
|
+
SDL::Mixer.halt(@channel)
|
162
|
+
end
|
163
|
+
return self
|
164
|
+
end
|
165
|
+
|
166
|
+
#===効果音が鳴っているかを示すフラグ
|
167
|
+
#返却値:: 効果音が鳴っているときはtrue、鳴っていないときはfalseを返す
|
168
|
+
def playing?
|
169
|
+
return false if $not_use_audio
|
170
|
+
return @channel != -1 ? SDL::Mixer.play?(@channel) : false
|
171
|
+
end
|
172
|
+
|
173
|
+
#===効果音を停止する
|
174
|
+
#返却値:: 自分自身を返す
|
175
|
+
def stop
|
176
|
+
return self if $not_use_audio
|
177
|
+
SDL::Mixer.halt(@channel) if @channel != -1
|
178
|
+
return self
|
179
|
+
end
|
180
|
+
|
181
|
+
#===効果音の大きさを設定する
|
182
|
+
#_v_:: 音の大きさ。0から255までの整数で示す。
|
183
|
+
#返却値:: 自分自身を返す
|
184
|
+
def set_volume(v)
|
185
|
+
return self if $not_use_audio
|
186
|
+
@wave.setVolume(v)
|
187
|
+
return self
|
188
|
+
end
|
189
|
+
|
190
|
+
#===演奏情報を解放する
|
191
|
+
#単なるダミー
|
192
|
+
def dispose
|
193
|
+
end
|
194
|
+
|
195
|
+
alias_method(:setVolume, :set_volume)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|