cyross-ruby-miyako 2.0.5.1.0 → 2.1.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 +1092 -929
- data/Rakefile +7 -7
- data/defines.h +144 -144
- data/extern.h +29 -29
- data/install_miyako.rb +87 -87
- data/lib/Miyako/API/audio.rb +572 -198
- data/lib/Miyako/API/basic_data.rb +825 -573
- data/lib/Miyako/API/bitmap.rb +534 -507
- data/lib/Miyako/API/choices.rb +481 -475
- data/lib/Miyako/API/collision.rb +486 -460
- data/lib/Miyako/API/diagram.rb +586 -561
- data/lib/Miyako/API/drawing.rb +151 -151
- data/lib/Miyako/API/exceptions.rb +105 -0
- data/lib/Miyako/API/fixedmap.rb +462 -428
- data/lib/Miyako/API/font.rb +430 -403
- data/lib/Miyako/API/input.rb +456 -447
- data/lib/Miyako/API/layout.rb +636 -433
- data/lib/Miyako/API/map.rb +583 -529
- data/lib/Miyako/API/map_event.rb +222 -198
- data/lib/Miyako/API/modules.rb +357 -109
- data/lib/Miyako/API/movie.rb +166 -154
- data/lib/Miyako/API/parts.rb +276 -189
- data/lib/Miyako/API/plane.rb +205 -166
- data/lib/Miyako/API/screen.rb +341 -325
- data/lib/Miyako/API/shape.rb +443 -443
- data/lib/Miyako/API/sprite.rb +771 -752
- data/lib/Miyako/API/sprite_animation.rb +490 -481
- data/lib/Miyako/API/sprite_list.rb +1135 -0
- data/lib/Miyako/API/spriteunit.rb +168 -147
- data/lib/Miyako/API/story.rb +350 -300
- data/lib/Miyako/API/textbox.rb +770 -725
- data/lib/Miyako/API/utility.rb +419 -388
- data/lib/Miyako/API/viewport.rb +189 -139
- data/lib/Miyako/API/yuki.rb +1226 -996
- data/lib/Miyako/EXT/miyako_cairo.rb +62 -62
- data/lib/Miyako/EXT/raster_scroll.rb +138 -138
- data/lib/Miyako/EXT/slides.rb +157 -157
- data/lib/Miyako/miyako.rb +201 -171
- data/lib/Miyako/miyako_require_only.rb +35 -0
- data/miyako_basicdata.c +590 -590
- data/miyako_bitmap.c +1225 -1225
- data/miyako_collision.c +403 -403
- data/miyako_drawing.c +187 -187
- data/miyako_font.c +334 -334
- data/miyako_hsv.c +830 -830
- data/miyako_input_audio.c +254 -0
- data/miyako_layout.c +191 -191
- data/miyako_no_katana.c +1078 -1074
- data/miyako_sprite2.c +431 -0
- data/miyako_transform.c +438 -438
- data/miyako_utility.c +288 -288
- data/sample/Animation1/m1ku.rb +68 -68
- data/sample/Animation2/lex.rb +96 -96
- data/sample/Diagram_sample/diagram_sample_yuki2.rb +328 -386
- data/sample/Room3/blue.rb +297 -297
- data/sample/Room3/ending.rb +180 -180
- data/sample/Room3/green.rb +220 -220
- data/sample/Room3/main.rb +119 -119
- data/sample/Room3/main_component.rb +59 -59
- data/sample/Room3/red.rb +227 -227
- data/sample/Room3/room3.rb +25 -27
- data/sample/Room3/title.rb +184 -184
- data/sample/ball_action_sample.rb +204 -204
- data/sample/blit_rop.rb +70 -70
- data/sample/cairo_sample.rb +25 -25
- data/sample/circle_collision_test.rb +66 -66
- data/sample/collision_test.rb +33 -33
- data/sample/collision_test2.rb +108 -108
- data/sample/fixed_map_test/fixed_map_sample.rb +140 -140
- data/sample/fixed_map_test/readme.txt +72 -72
- data/sample/map_test/chara.rb +58 -58
- data/sample/map_test/main_parts.rb +69 -69
- data/sample/map_test/main_scene.rb +153 -153
- data/sample/map_test/map_manager.rb +75 -75
- data/sample/map_test/map_test.rb +23 -23
- data/sample/map_test/oasis.rb +71 -71
- data/sample/map_test/readme.txt +89 -89
- data/sample/map_test/route.rb +157 -157
- data/sample/map_test/town.rb +74 -74
- data/sample/polygon_test.rb +35 -35
- data/sample/rasterscroll.rb +24 -24
- data/sample/takahashi.rb +42 -42
- data/sample/textbox_sample.rb +189 -189
- data/sample/transform.rb +54 -54
- data/sample/utility_test.rb +73 -73
- data/sample/utility_test2.rb +61 -61
- data/sample/utility_test3.rb +64 -64
- data/sample/utility_test4.rb +73 -73
- data/uninstall_miyako.rb +19 -19
- data/win/miyako_no_katana.so +0 -0
- metadata +7 -2
data/lib/Miyako/miyako.rb
CHANGED
@@ -1,171 +1,201 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
#=コンテンツ作成ライブラリMiyako2.
|
4
|
-
#
|
5
|
-
#Authors:: サイロス誠
|
6
|
-
#Version:: 2.
|
7
|
-
#Copyright:: 2007-2009 Cyross Makoto
|
8
|
-
#License:: LGPL2.1
|
9
|
-
#
|
10
|
-
=begin
|
11
|
-
Miyako v2.
|
12
|
-
Copyright (C) 2007-2008 Cyross Makoto
|
13
|
-
|
14
|
-
This library is free software; you can redistribute it and/or
|
15
|
-
modify it under the terms of the GNU Lesser General Public
|
16
|
-
License as published by the Free Software Foundation; either
|
17
|
-
version 2.1 of the License, or (at your option) any later version.
|
18
|
-
|
19
|
-
This library is distributed in the hope that it will be useful,
|
20
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
22
|
-
Lesser General Public License for more details.
|
23
|
-
|
24
|
-
You should have received a copy of the GNU Lesser General Public
|
25
|
-
License along with this library; if not, write to the Free Software
|
26
|
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
27
|
-
=end
|
28
|
-
|
29
|
-
if RUBY_VERSION < '1.9.1'
|
30
|
-
puts 'Sorry. Miyako needs Ruby 1.9.1 or above...'
|
31
|
-
exit
|
32
|
-
end
|
33
|
-
|
34
|
-
require 'sdl'
|
35
|
-
|
36
|
-
if SDL::VERSION < '2.0'
|
37
|
-
puts 'Sorry. Miyako needs Ruby/SDL 2.0.0 or above...'
|
38
|
-
exit
|
39
|
-
end
|
40
|
-
|
41
|
-
require 'forwardable'
|
42
|
-
require 'iconv' if RUBY_VERSION < '1.9.0'
|
43
|
-
require 'kconv'
|
44
|
-
require 'rbconfig'
|
45
|
-
|
46
|
-
|
47
|
-
$
|
48
|
-
|
49
|
-
|
50
|
-
$
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
#
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
require 'Miyako/API/
|
127
|
-
require 'Miyako/API/
|
128
|
-
require 'Miyako/API/
|
129
|
-
require 'Miyako/API/
|
130
|
-
require 'Miyako/API/
|
131
|
-
require 'Miyako/API/
|
132
|
-
require 'Miyako/API/
|
133
|
-
require 'Miyako/API/
|
134
|
-
require 'Miyako/API/
|
135
|
-
require 'Miyako/API/
|
136
|
-
require 'Miyako/API/
|
137
|
-
require 'Miyako/API/
|
138
|
-
require 'Miyako/API/
|
139
|
-
require 'Miyako/API/
|
140
|
-
require 'Miyako/API/
|
141
|
-
require 'Miyako/API/
|
142
|
-
require 'Miyako/API/
|
143
|
-
require 'Miyako/API/
|
144
|
-
require 'Miyako/API/
|
145
|
-
require 'Miyako/API/
|
146
|
-
require 'Miyako/API/
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
#=コンテンツ作成ライブラリMiyako2.1
|
4
|
+
#
|
5
|
+
#Authors:: サイロス誠
|
6
|
+
#Version:: 2.1.0
|
7
|
+
#Copyright:: 2007-2009 Cyross Makoto
|
8
|
+
#License:: LGPL2.1
|
9
|
+
#
|
10
|
+
=begin
|
11
|
+
Miyako v2.1
|
12
|
+
Copyright (C) 2007-2008 Cyross Makoto
|
13
|
+
|
14
|
+
This library is free software; you can redistribute it and/or
|
15
|
+
modify it under the terms of the GNU Lesser General Public
|
16
|
+
License as published by the Free Software Foundation; either
|
17
|
+
version 2.1 of the License, or (at your option) any later version.
|
18
|
+
|
19
|
+
This library is distributed in the hope that it will be useful,
|
20
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
22
|
+
Lesser General Public License for more details.
|
23
|
+
|
24
|
+
You should have received a copy of the GNU Lesser General Public
|
25
|
+
License along with this library; if not, write to the Free Software
|
26
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
27
|
+
=end
|
28
|
+
|
29
|
+
if RUBY_VERSION < '1.9.1'
|
30
|
+
puts 'Sorry. Miyako needs Ruby 1.9.1 or above...'
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'sdl'
|
35
|
+
|
36
|
+
if SDL::VERSION < '2.0'
|
37
|
+
puts 'Sorry. Miyako needs Ruby/SDL 2.0.0 or above...'
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
|
41
|
+
require 'forwardable'
|
42
|
+
require 'iconv' if RUBY_VERSION < '1.9.0'
|
43
|
+
require 'kconv'
|
44
|
+
require 'rbconfig'
|
45
|
+
|
46
|
+
#画面などの初期設定を自動的に行うかどうかの設定。デフォルトはtrue
|
47
|
+
$miyako_auto_open = true if $miyako_auto_open.nil?
|
48
|
+
|
49
|
+
#デバッグモードの設定。デバッグモードにするときはtrueを渡す。デフォルトはfalse
|
50
|
+
$miyako_debug_mode ||= false
|
51
|
+
|
52
|
+
#openGLを使う? openGLを使用するときはtrueを設定する。デフォルトはfalse
|
53
|
+
$miyako_use_opengl ||= false
|
54
|
+
|
55
|
+
#サウンド機能を使わないときは、miyako.rbをロードする前に
|
56
|
+
#$not_use_audio変数にtrueを割り当てる
|
57
|
+
$not_use_audio ||= false
|
58
|
+
|
59
|
+
Thread.abort_on_exception = true
|
60
|
+
|
61
|
+
#==Miyako基幹モジュール
|
62
|
+
module Miyako
|
63
|
+
VERSION = "2.1.0"
|
64
|
+
|
65
|
+
#===アプリケーション実行中に演奏する音楽のサンプリングレートを指定する
|
66
|
+
#単位はHz(周波数)
|
67
|
+
#規定値は44100
|
68
|
+
#音声ファイルを扱うときは、すべての音声ファイルを同じサンプリングレートに統一する必要がある
|
69
|
+
$sampling_seq ||= 44100
|
70
|
+
|
71
|
+
#サウンド機能を使うときのバッファサイズを設定する(バイト単位)
|
72
|
+
#デフォルトは4096バイト
|
73
|
+
$sound_buffer_size ||= 4096
|
74
|
+
|
75
|
+
#===Miyakoのバージョン番号を出力する
|
76
|
+
#返却値:: バージョン番号を示す文字列
|
77
|
+
def Miyako::version
|
78
|
+
return VERSION
|
79
|
+
end
|
80
|
+
|
81
|
+
osn = Config::CONFIG["target_os"].downcase
|
82
|
+
@@osName = "other"
|
83
|
+
case osn
|
84
|
+
when /mswin|mingw|cygwin|bccwin/
|
85
|
+
@@osName = "win"
|
86
|
+
when /linux/
|
87
|
+
@@osName = "linux"
|
88
|
+
when /darwin/
|
89
|
+
@@osName = "mac_osx"
|
90
|
+
end
|
91
|
+
|
92
|
+
#===実行しているOSの名前を取得する
|
93
|
+
#(Windows 9x/Me/Xp/Vista, Cygwin/MinGW) : "win"
|
94
|
+
#(Linux) : "linux"
|
95
|
+
#(Mac OS X) : "mac_osx"
|
96
|
+
#(other) : "other"
|
97
|
+
#返却値:: OS名
|
98
|
+
def Miyako::getOSName
|
99
|
+
return @@osName
|
100
|
+
end
|
101
|
+
|
102
|
+
#===ウィンドウのタイトルを設定する
|
103
|
+
#_title_:: 設定する文字列
|
104
|
+
def Miyako::setTitle(title)
|
105
|
+
str = title
|
106
|
+
case @@osName
|
107
|
+
when "win"
|
108
|
+
str = title.to_s().encode(Encoding::SJIS)
|
109
|
+
when "mac_osx"
|
110
|
+
str = title.to_s().encode(Encoding::UTF_8)
|
111
|
+
when "linux"
|
112
|
+
str = title.to_s().encode(Encoding::EUCJP)
|
113
|
+
end
|
114
|
+
SDL::WM.setCaption(str, "")
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
require 'Miyako/API/exceptions'
|
119
|
+
require 'Miyako/API/utility'
|
120
|
+
require 'Miyako/API/basic_data'
|
121
|
+
require 'Miyako/API/modules'
|
122
|
+
require 'Miyako/API/yuki'
|
123
|
+
require 'Miyako/API/font'
|
124
|
+
require 'Miyako/API/viewport'
|
125
|
+
require 'Miyako/API/layout'
|
126
|
+
require 'Miyako/API/bitmap'
|
127
|
+
require 'Miyako/API/drawing'
|
128
|
+
require 'Miyako/API/spriteunit'
|
129
|
+
require 'Miyako/API/sprite_animation'
|
130
|
+
require 'Miyako/API/sprite'
|
131
|
+
require 'Miyako/API/sprite_list'
|
132
|
+
require 'Miyako/API/collision'
|
133
|
+
require 'Miyako/API/screen'
|
134
|
+
require 'Miyako/API/shape'
|
135
|
+
require 'Miyako/API/plane'
|
136
|
+
require 'Miyako/API/input'
|
137
|
+
require 'Miyako/API/audio'
|
138
|
+
require 'Miyako/API/movie'
|
139
|
+
require 'Miyako/API/parts'
|
140
|
+
require 'Miyako/API/choices'
|
141
|
+
require 'Miyako/API/textbox'
|
142
|
+
require 'Miyako/API/map'
|
143
|
+
require 'Miyako/API/fixedmap'
|
144
|
+
require 'Miyako/API/map_event'
|
145
|
+
require 'Miyako/API/story'
|
146
|
+
require 'Miyako/API/diagram'
|
147
|
+
|
148
|
+
module Miyako
|
149
|
+
@@initialized = false
|
150
|
+
|
151
|
+
#===Miyakoのメインループ
|
152
|
+
#ブロックを受け取り、そのブロックを評価する
|
153
|
+
#ブロック評価前に<i>Audio::update</i>と<i>Input::update</i>、<i>Screen::clear</i>、評価後に<i>Screen::render</i>を呼び出す
|
154
|
+
#
|
155
|
+
#ブロックを渡さないと例外が発生する
|
156
|
+
def Miyako.main_loop
|
157
|
+
raise MiyakoError, "Miyako.main_loop needs brock!" unless block_given?
|
158
|
+
loop do
|
159
|
+
Audio.update
|
160
|
+
Input.update
|
161
|
+
Screen.clear
|
162
|
+
yield
|
163
|
+
Screen.render
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
#===SDLの初期化
|
168
|
+
def Miyako.init
|
169
|
+
raise MiyakoError, "Already initialized!" if @@initialized
|
170
|
+
if $not_use_audio
|
171
|
+
SDL.init(SDL::INIT_VIDEO | SDL::INIT_JOYSTICK)
|
172
|
+
else
|
173
|
+
SDL.init(SDL::INIT_VIDEO | SDL::INIT_AUDIO | SDL::INIT_JOYSTICK)
|
174
|
+
end
|
175
|
+
@@initialized = true
|
176
|
+
end
|
177
|
+
|
178
|
+
#===Miyako(SDL)が初期化された?
|
179
|
+
def Miyako.initialized?
|
180
|
+
@@initialized
|
181
|
+
end
|
182
|
+
|
183
|
+
#===Miyakoの初期化
|
184
|
+
#画面初期化や音声初期化などのメソッドを呼び出す。
|
185
|
+
#グローバル変数$miyako_auto_openがtrueのときは最初に自動的に呼び出される。
|
186
|
+
#ユーティリティメソッドを使うだけならば、$miyako_auto_open=falseを設定して、後々Miyako.openを呼び出す。
|
187
|
+
#_screen_:: 別のプロセスで生成されたSDL::Screenクラスのインスタンス。省略時はnil
|
188
|
+
#_buf_size_:: Audioモジュールで使用するバッファサイズ。単位はバイト。省略時は4096
|
189
|
+
#_seq_:: Audioモジュールで使用する音声の再生サンプル周波数。省略時は44100(44.1kHz)
|
190
|
+
def Miyako.open(screen = nil, buf_size = 4096, seq = 44100)
|
191
|
+
Miyako.init
|
192
|
+
Screen.init(screen)
|
193
|
+
Font.init
|
194
|
+
Audio.init(buf_size, seq)
|
195
|
+
Input.init
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
require 'Miyako/miyako_no_katana'
|
200
|
+
|
201
|
+
Miyako.open(nil, $sound_buffer_size, $sampling_seq) if $miyako_auto_open
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
#=コンテンツ作成ライブラリMiyako2.1
|
4
|
+
#
|
5
|
+
#Authors:: サイロス誠
|
6
|
+
#Version:: 2.1.0
|
7
|
+
#Copyright:: 2007-2009 Cyross Makoto
|
8
|
+
#License:: LGPL2.1
|
9
|
+
#
|
10
|
+
=begin
|
11
|
+
Miyako v2.1
|
12
|
+
Copyright (C) 2007-2008 Cyross Makoto
|
13
|
+
|
14
|
+
This library is free software; you can redistribute it and/or
|
15
|
+
modify it under the terms of the GNU Lesser General Public
|
16
|
+
License as published by the Free Software Foundation; either
|
17
|
+
version 2.1 of the License, or (at your option) any later version.
|
18
|
+
|
19
|
+
This library is distributed in the hope that it will be useful,
|
20
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
22
|
+
Lesser General Public License for more details.
|
23
|
+
|
24
|
+
You should have received a copy of the GNU Lesser General Public
|
25
|
+
License along with this library; if not, write to the Free Software
|
26
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
27
|
+
=end
|
28
|
+
|
29
|
+
# 初期化を行わずにrequire 'Miyako/miyako'のみ行う
|
30
|
+
|
31
|
+
$miyako_auto_open = false
|
32
|
+
|
33
|
+
require 'Miyako/miyako'
|
34
|
+
|
35
|
+
$miyako_auto_open = nil
|