ruby-miyako-mswin32 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +275 -20
- 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/miyako_no_katana.so +0 -0
- data/lib/miyako.rb +28 -0
- data/lib/miyako_require_only.rb +35 -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 +8 -5
- data/sample/transform.rb +2 -1
- data/uninstall_miyako.rb +4 -1
- metadata +13 -4
- data/lib/Miyako/EXT/miyako_cairo.rb +0 -62
- data/sample/cairo_sample.rb +0 -25
data/sample/Room3/title.rb
CHANGED
@@ -19,7 +19,7 @@ class Title
|
|
19
19
|
@visible = false
|
20
20
|
|
21
21
|
@title = Sprite.new(:file=>"image/mittsu_no_oheya.png", :type=>:ck)
|
22
|
-
|
22
|
+
|
23
23
|
@exec = self.method(:view_in)
|
24
24
|
end
|
25
25
|
|
@@ -52,7 +52,7 @@ class Title
|
|
52
52
|
end
|
53
53
|
return TitleCall
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def update
|
57
57
|
return nil if (Input.pushed_any?(:esc) || Input.quit?)
|
58
58
|
return @exec.call
|
@@ -79,7 +79,7 @@ class TitleCall
|
|
79
79
|
@man.center!.bottom!
|
80
80
|
@alpha = 0.0
|
81
81
|
@wait = WaitCounter.new(0.2)
|
82
|
-
@exec =
|
82
|
+
@exec = :view_in
|
83
83
|
end
|
84
84
|
|
85
85
|
def setup
|
@@ -92,19 +92,24 @@ class TitleCall
|
|
92
92
|
|
93
93
|
def update
|
94
94
|
return nil if (Input.pushed_any?(:esc) || Input.quit?)
|
95
|
-
|
95
|
+
case @exec
|
96
|
+
when :view_in
|
97
|
+
return view_in
|
98
|
+
when :exec_yuki
|
99
|
+
return exec_yuki
|
100
|
+
end
|
96
101
|
end
|
97
|
-
|
102
|
+
|
98
103
|
def final
|
99
104
|
message_box.stop
|
100
105
|
end
|
101
|
-
|
106
|
+
|
102
107
|
def view_in
|
103
108
|
if @wait.finish?
|
104
109
|
if @alpha == 1.0
|
105
|
-
@
|
106
|
-
@exec = self.method(:exec_yuki)
|
110
|
+
@exec = :exec_yuki
|
107
111
|
message_box.start
|
112
|
+
@yuki.start_plot
|
108
113
|
return @now
|
109
114
|
end
|
110
115
|
@alpha += 0.15
|
@@ -119,7 +124,7 @@ class TitleCall
|
|
119
124
|
@yuki.update
|
120
125
|
return @yuki.result ? @yuki.result : @now
|
121
126
|
end
|
122
|
-
|
127
|
+
|
123
128
|
def plot
|
124
129
|
yuki_plot do
|
125
130
|
text("「レディ〜ス エ〜ン ジェントルメ〜ン!」").pause.cr
|
@@ -179,6 +184,6 @@ class TitleCall
|
|
179
184
|
|
180
185
|
def render
|
181
186
|
Bitmap.dec_alpha(@man, Screen, @alpha)
|
182
|
-
message_box.render if @exec ==
|
187
|
+
message_box.render if @exec == :exec_yuki
|
183
188
|
end
|
184
189
|
end
|
data/sample/collision_test2.rb
CHANGED
@@ -48,6 +48,7 @@ sprites = Array.new(Sprites){|n|
|
|
48
48
|
|
49
49
|
# :collisioned => 当たり判定した?
|
50
50
|
{
|
51
|
+
:name => "sprite_#{n}",
|
51
52
|
:sprite => sprite,
|
52
53
|
:collision => collision,
|
53
54
|
:amount => get_amount_one
|
@@ -66,7 +67,7 @@ cautions = {
|
|
66
67
|
collision_type = collision_list.next
|
67
68
|
|
68
69
|
# 一気にレンダリング
|
69
|
-
Screen.pre_render_array <<
|
70
|
+
sprites.each{|m| Screen.pre_render_array << [m[:name], m[:sprite]] }
|
70
71
|
|
71
72
|
# 判定を切り替えるタイミングを決めるタイマー
|
72
73
|
wait = WaitCounter.new(1.0)
|
@@ -30,7 +30,7 @@ class Monster
|
|
30
30
|
def start
|
31
31
|
@anim.start
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def update(map, events, param)
|
35
35
|
@anim.update_animation
|
36
36
|
end
|
@@ -41,7 +41,7 @@ class Monster
|
|
41
41
|
|
42
42
|
def finish
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def dispose
|
46
46
|
@anim.dispose
|
47
47
|
@spr.dispose
|
@@ -103,11 +103,11 @@ class SlimeEvent
|
|
103
103
|
def init(map, x, y)
|
104
104
|
@slime = Slime.new(map, x, y)
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
def update(map, events, param)
|
108
108
|
@slime.update(map, events, param)
|
109
109
|
end
|
110
|
-
|
110
|
+
|
111
111
|
def final
|
112
112
|
@slime.finish
|
113
113
|
end
|
@@ -115,7 +115,7 @@ class SlimeEvent
|
|
115
115
|
def dispose
|
116
116
|
@slime.dispose
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
def render
|
120
120
|
@slime.render
|
121
121
|
end
|
@@ -126,7 +126,8 @@ em.add(1, SlimeEvent)
|
|
126
126
|
|
127
127
|
# main
|
128
128
|
mp = MapChipFactory.load("./mapchip.csv")
|
129
|
-
|
129
|
+
ms = MapStructFactory.load("./map.csv")
|
130
|
+
@fmap = FixedMap.new(mp, ms, em)
|
130
131
|
|
131
132
|
Miyako.main_loop do
|
132
133
|
break if Input.quit_or_escape?
|
@@ -20,14 +20,19 @@ class MainScene
|
|
20
20
|
@map.move!(*@chr.margin)
|
21
21
|
# マップの実座標を設定する
|
22
22
|
@map.move!(*@chr.position)
|
23
|
-
|
23
|
+
|
24
24
|
@parts = CommonParts.instance
|
25
25
|
#Yukiの初期化
|
26
26
|
@yuki = Yuki.new
|
27
27
|
@yuki.select_textbox(@parts.box[:box])
|
28
28
|
@yuki.select_commandbox(@parts.cbox[:box])
|
29
|
+
@yuki.vars[:command] = [
|
30
|
+
Yuki::Command.new("話す", "話す", "話す", true, nil, talk),
|
31
|
+
Yuki::Command.new("調べる", "調べる", "調べる", true, nil, check),
|
32
|
+
Yuki::Command.new("その他", "その他", "その他", false, nil, check)
|
33
|
+
]
|
29
34
|
end
|
30
|
-
|
35
|
+
|
31
36
|
def setup
|
32
37
|
@map.start
|
33
38
|
@chr.start
|
@@ -56,8 +61,6 @@ class MainScene
|
|
56
61
|
if event_flags.none?
|
57
62
|
#標準のコマンドを表示
|
58
63
|
@yuki.vars[:now] = @now
|
59
|
-
@yuki.vars[:talk] = talk
|
60
|
-
@yuki.vars[:check] = check
|
61
64
|
@yuki.start_plot(command_plot)
|
62
65
|
else
|
63
66
|
#キャラの立ち位置が重なっているイベントを起動
|
@@ -93,7 +96,7 @@ class MainScene
|
|
93
96
|
end
|
94
97
|
}
|
95
98
|
@executing_flags = @map.events[0].map{|e| e.executing? }
|
96
|
-
|
99
|
+
|
97
100
|
#コマンド選択の結果、イベントが実行されたときは、結果として@nowを返す
|
98
101
|
return @now unless @yuki.is_scene?(@yuki.result)
|
99
102
|
return @yuki.result || @now
|
@@ -112,8 +115,7 @@ class MainScene
|
|
112
115
|
|
113
116
|
def command_plot
|
114
117
|
yuki_plot do
|
115
|
-
command([
|
116
|
-
Yuki::Command.new("調べる", "調べる", nil, vars[:check])], vars[:now])
|
118
|
+
command(vars[:command], vars[:now])
|
117
119
|
call_plot(select_result) if is_scenario?(select_result)
|
118
120
|
vars[:now]
|
119
121
|
end
|
@@ -128,7 +130,7 @@ class MainScene
|
|
128
130
|
clear
|
129
131
|
end
|
130
132
|
end
|
131
|
-
|
133
|
+
|
132
134
|
#コマンドウィンドウの「話す」を選んだときの処理
|
133
135
|
def talk
|
134
136
|
yuki_plot do
|
@@ -139,13 +141,13 @@ class MainScene
|
|
139
141
|
clear
|
140
142
|
end
|
141
143
|
end
|
142
|
-
|
144
|
+
|
143
145
|
def final
|
144
146
|
@parts.stop
|
145
147
|
@map.stop
|
146
148
|
@chr.stop
|
147
149
|
end
|
148
|
-
|
150
|
+
|
149
151
|
def dispose
|
150
152
|
@map.dispose
|
151
153
|
@chr.dispose
|
@@ -1,27 +1,28 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
#マップ管理クラス
|
3
3
|
class MapManager
|
4
4
|
extend Forwardable
|
5
5
|
|
6
6
|
attr_reader :mapchip
|
7
|
-
|
7
|
+
|
8
8
|
def initialize
|
9
9
|
@moving = false
|
10
10
|
|
11
|
-
|
11
|
+
#マップチップインスタンスの作成
|
12
12
|
@mapchip = MapChipFactory.load("./mapchip.csv")
|
13
13
|
|
14
|
-
|
14
|
+
#イベントを登録
|
15
15
|
em = MapEventManager.new
|
16
16
|
em.add(3, EventRouteMarker).
|
17
17
|
add(7, EventRouteMarker2).
|
18
18
|
add(8, EventTown).
|
19
19
|
add(16, EventOasis)
|
20
20
|
|
21
|
-
|
22
|
-
@
|
21
|
+
#マップの作成
|
22
|
+
@map_struct = MapStructFactory.load("./map_layer.csv")
|
23
|
+
@map = Map.new(@mapchip, @map_struct, em)
|
23
24
|
|
24
|
-
|
25
|
+
#海のマップチップを波がアニメーションする画像に置き換え
|
25
26
|
@sp = Sprite.new(:file=>"sea.png", :type=>:as)
|
26
27
|
@sp.oh = @sp.w
|
27
28
|
@ar = SpriteAnimation.new(:sprite=>@sp, :wait=>0.4)
|
@@ -32,21 +33,21 @@ class MapManager
|
|
32
33
|
@map.move!(dx, dy)
|
33
34
|
@map.events[0].each{|e| e.move!(dx, dy) }
|
34
35
|
end
|
35
|
-
|
36
|
+
|
36
37
|
def move_to!(x, y)
|
37
38
|
@map.events[0].each{|e| e.move!(x-@map.pos.x, y-@map.pos.y) }
|
38
39
|
@map.move_to!(x, y)
|
39
40
|
end
|
40
|
-
|
41
|
+
|
41
42
|
def start
|
42
43
|
@ar.start
|
43
44
|
end
|
44
|
-
|
45
|
+
|
45
46
|
def update
|
46
47
|
@ar.update_animation
|
47
48
|
@map.events[0].each{|e| e.update(@map, @map.events, nil) }
|
48
49
|
end
|
49
|
-
|
50
|
+
|
50
51
|
def render
|
51
52
|
@map.render
|
52
53
|
end
|
@@ -62,13 +63,13 @@ class MapManager
|
|
62
63
|
def stop
|
63
64
|
@ar.stop
|
64
65
|
end
|
65
|
-
|
66
|
+
|
66
67
|
def dispose
|
67
68
|
@map.dispose
|
68
69
|
@ar.dispose
|
69
70
|
@sp.dispose
|
70
71
|
end
|
71
|
-
|
72
|
+
|
72
73
|
def_delegators(:@map, :w, :h, :get_code, :get_code_real, :margin, :mapchips, :[])
|
73
74
|
def_delegators(:@map, :collision?, :meet?, :cover?, :events)
|
74
75
|
def_delegators(:@mapchip, :collision_table, :access_table)
|
data/sample/rasterscroll.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
#
|
2
|
+
# ラスタスクロールサンプル
|
3
3
|
# 2009.4.12 Cyross Makoto
|
4
4
|
|
5
5
|
require 'Miyako/miyako'
|
@@ -7,9 +7,9 @@ require 'Miyako/EXT/raster_scroll'
|
|
7
7
|
|
8
8
|
include Miyako
|
9
9
|
|
10
|
-
#1
|
10
|
+
#1秒後にラスタスクロールのフェードアウトを設定する
|
11
11
|
wait = WaitCounter.new(1.0).start
|
12
|
-
# 0.05
|
12
|
+
# 0.05秒ごとに、2ラインずつ、8ピクセル単位のラスタスクロールを行う
|
13
13
|
sprite = Sprite.new(:file => "Animation2/lex_body.png", :type => :ck).centering!
|
14
14
|
rs = RasterScroll.new(sprite).start({:lines => 2, :size => 8, :wait=>WaitCounter.new(0.05)})
|
15
15
|
fade = false
|
@@ -18,8 +18,8 @@ Miyako.main_loop do
|
|
18
18
|
break if Input.quit_or_escape?
|
19
19
|
rs.effecting? ? rs.update.render : sprite.render
|
20
20
|
if fade == false && wait.finish?
|
21
|
-
#1
|
21
|
+
#1秒後ごとに、ラスタスクロールの幅を縮める
|
22
22
|
rs.fade_out(1, WaitCounter.new(1.0))
|
23
23
|
fade = true
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
data/sample/takahashi.rb
CHANGED
@@ -32,9 +32,9 @@ shape2 = Shape.text(:font=>Font.serif, :align=>:right){|v|
|
|
32
32
|
text("DEFG")
|
33
33
|
}
|
34
34
|
|
35
|
-
#
|
36
|
-
Screen.auto_render_array << shape1
|
37
|
-
Screen.auto_render_array << shape2
|
35
|
+
# オートレンダー(SpriteList)にshape1、shape2を組み込み
|
36
|
+
Screen.auto_render_array << [:shape1, shape1]
|
37
|
+
Screen.auto_render_array << [:shape2, shape2]
|
38
38
|
|
39
39
|
Miyako.main_loop do
|
40
40
|
break if Input.quit_or_escape?
|
data/sample/textbox_sample.rb
CHANGED
@@ -40,11 +40,14 @@ box_bg.fill([128,0,64,128])
|
|
40
40
|
|
41
41
|
# 選択肢の作成
|
42
42
|
list = [
|
43
|
-
[
|
44
|
-
[
|
45
|
-
[
|
43
|
+
["選択肢1", "選択肢1", "選択肢1", true, 1],
|
44
|
+
["選択肢2", "選択肢2", "選択肢2", true, 2],
|
45
|
+
["選択肢3", "選択肢3", "選択肢3", true, 3],
|
46
|
+
["選択肢4", "選択肢4", "選択肢4", false, 4]
|
46
47
|
]
|
47
48
|
@choices = @parts[:box].create_choices_chain(list)
|
49
|
+
#@choices[0][1].visible = false
|
50
|
+
#@choices[0][2].enable = false
|
48
51
|
|
49
52
|
# カーソルのアニメーションの開始
|
50
53
|
@parts[:box].start
|
@@ -162,7 +165,7 @@ list = [
|
|
162
165
|
|
163
166
|
# テキストボックスのまとめ処理
|
164
167
|
def process_textbox
|
165
|
-
@parts
|
168
|
+
@parts.update_animation
|
166
169
|
@parts.render
|
167
170
|
end
|
168
171
|
|
@@ -181,7 +184,7 @@ Miyako.main_loop do
|
|
181
184
|
# カーソルの移動
|
182
185
|
@parts[:box].move_cursor(*Input.pushed_amount)
|
183
186
|
# 1ボタンを押したとき、選択状態を解除する
|
184
|
-
@parts[:box].finish_command if Input.pushed_any?(:btn1)
|
187
|
+
@parts[:box].finish_command if (Input.pushed_any?(:btn1) && @parts[:box].enable_choice?)
|
185
188
|
process_textbox
|
186
189
|
next
|
187
190
|
end
|
data/sample/transform.rb
CHANGED
@@ -29,7 +29,8 @@ yscale = 4.0 # 初期拡大率(y座標)4倍
|
|
29
29
|
angle = 0.0 # 初期回転角度0度
|
30
30
|
|
31
31
|
# 画面の中心に画像を表示指定(pre_render)
|
32
|
-
Screen.pre_render_array << [Sprite.new(:file=>"Animation1/m1ku_back.jpg", :type=>:ac).centering
|
32
|
+
Screen.pre_render_array << [:s1, Sprite.new(:file=>"Animation1/m1ku_back.jpg", :type=>:ac).centering!]
|
33
|
+
Screen.pre_render_array << [:s2, @sprite]
|
33
34
|
|
34
35
|
# 画面の変形中心を設定
|
35
36
|
Screen.center_x = Screen.w/2
|
data/uninstall_miyako.rb
CHANGED
@@ -12,8 +12,11 @@ require 'fileutils'
|
|
12
12
|
puts "Are you sure?(Y/else)"
|
13
13
|
exit unless $stdin.gets.split(//)[0].upcase == 'Y'
|
14
14
|
|
15
|
-
|
15
|
+
baselibdir = Config::CONFIG["sitelibdir"]
|
16
|
+
sitelibdir = baselibdir + "/Miyako"
|
16
17
|
|
18
|
+
FileUtils.remove(baselibdir+"/miyako.rb")
|
19
|
+
FileUtils.remove(baselibdir+"/miyako_require_only.rb")
|
17
20
|
FileUtils.remove_dir(sitelibdir, true)
|
18
21
|
|
19
22
|
puts "uninstall completed."
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-miyako-mswin32
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyross Makoto
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-16 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -34,13 +34,16 @@ files:
|
|
34
34
|
- ./lib/Miyako/API/bitmap.rb
|
35
35
|
- ./lib/Miyako/API/choices.rb
|
36
36
|
- ./lib/Miyako/API/collision.rb
|
37
|
+
- ./lib/Miyako/API/color.rb
|
37
38
|
- ./lib/Miyako/API/diagram.rb
|
38
39
|
- ./lib/Miyako/API/drawing.rb
|
39
40
|
- ./lib/Miyako/API/exceptions.rb
|
40
41
|
- ./lib/Miyako/API/fixedmap.rb
|
41
42
|
- ./lib/Miyako/API/font.rb
|
43
|
+
- ./lib/Miyako/API/i_yuki.rb
|
42
44
|
- ./lib/Miyako/API/input.rb
|
43
45
|
- ./lib/Miyako/API/layout.rb
|
46
|
+
- ./lib/Miyako/API/map_struct.rb
|
44
47
|
- ./lib/Miyako/API/map.rb
|
45
48
|
- ./lib/Miyako/API/map_event.rb
|
46
49
|
- ./lib/Miyako/API/modules.rb
|
@@ -54,16 +57,23 @@ files:
|
|
54
57
|
- ./lib/Miyako/API/sprite_animation.rb
|
55
58
|
- ./lib/Miyako/API/sprite_list.rb
|
56
59
|
- ./lib/Miyako/API/story.rb
|
60
|
+
- ./lib/Miyako/API/struct_point.rb
|
61
|
+
- ./lib/Miyako/API/struct_size.rb
|
62
|
+
- ./lib/Miyako/API/struct_rect.rb
|
63
|
+
- ./lib/Miyako/API/struct_square.rb
|
64
|
+
- ./lib/Miyako/API/struct_segment.rb
|
57
65
|
- ./lib/Miyako/API/textbox.rb
|
58
66
|
- ./lib/Miyako/API/utility.rb
|
59
67
|
- ./lib/Miyako/API/viewport.rb
|
68
|
+
- ./lib/Miyako/API/wait_counter.rb
|
60
69
|
- ./lib/Miyako/API/yuki.rb
|
61
|
-
- ./lib/Miyako/EXT/miyako_cairo.rb
|
62
70
|
- ./lib/Miyako/EXT/raster_scroll.rb
|
63
71
|
- ./lib/Miyako/EXT/slides.rb
|
64
72
|
- ./lib/Miyako/miyako.rb
|
65
73
|
- ./lib/Miyako/miyako_require_only.rb
|
66
74
|
- ./lib/Miyako/miyako_no_katana.so
|
75
|
+
- ./lib/miyako.rb
|
76
|
+
- ./lib/miyako_require_only.rb
|
67
77
|
- ./logo/EGSR_logo.png
|
68
78
|
- ./logo/EGSR_logo_bg.png
|
69
79
|
- ./logo/EGSR_logo_fg.png
|
@@ -98,7 +108,6 @@ files:
|
|
98
108
|
- ./sample/Animation2/song_title.png
|
99
109
|
- ./sample/ball_action_sample.rb
|
100
110
|
- ./sample/blit_rop.rb
|
101
|
-
- ./sample/cairo_sample.rb
|
102
111
|
- ./sample/circle_collision_test.rb
|
103
112
|
- ./sample/collision_test.rb
|
104
113
|
- ./sample/collision_test2.rb
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
# Miyako Extension Cairo-Miyako interface
|
3
|
-
=begin
|
4
|
-
Miyako Extention Library v2.1
|
5
|
-
Copyright (C) 2007-2009 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
|
-
=end
|
21
|
-
|
22
|
-
begin
|
23
|
-
loaded = false
|
24
|
-
require 'cairo'
|
25
|
-
rescue LoadError
|
26
|
-
begin
|
27
|
-
require 'rubygems'
|
28
|
-
require 'cairo'
|
29
|
-
loaded = true
|
30
|
-
rescue LoadError
|
31
|
-
raise Miyako::MiyakoError, "Sorry, Cairo-Miyako Interface has rcairo." unless loaded
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
module Miyako
|
36
|
-
#==MiyakoのSpriteクラスのインスタンスとCairoのImageSurfaceクラスのインスタンスとの相互変換モジュール
|
37
|
-
#要rcairo1.8以降
|
38
|
-
module MiyakoCairo
|
39
|
-
#===SpriteインスタンスをCairoのImageSurfaceに変換
|
40
|
-
#変換したCairo::ImageSurfaceインスタンスは、32ビット(Cairo::Format::ARGB32)の画像を持つ
|
41
|
-
#_sprite_:: 変換元Spriteインスタンス
|
42
|
-
#返却値:: 変換したCairo::ImageSurfaceインスタンス
|
43
|
-
def MiyakoCairo.to_cairo_surface(sprite)
|
44
|
-
return Cairo::ImageSurface.new(sprite.bitmap.pixels, Cairo::Format::ARGB32, sprite.w, sprite.h, sprite.w * 4)
|
45
|
-
end
|
46
|
-
|
47
|
-
#===CairoのImageSurfaceをSpriteインスタンスに変換
|
48
|
-
#変換したSpriteインスタンスは、:acタイプ(但し元画像がCairo::Format::RGB24の時は:asタイプ)の画像を持つ
|
49
|
-
#_surface_:: 変換元Cairo::ImageSurfaceインスタンス
|
50
|
-
#返却値:: 変換したSpriteインスタンス
|
51
|
-
def MiyakoCairo.to_sprite(surface)
|
52
|
-
# エンディアン判別
|
53
|
-
if [1].pack("V*") == [1].pack("L*") # リトルエンディアン?
|
54
|
-
bitmap = SDL::Surface.new_from(surface.data, surface.width, surface.height, 32, surface.stride, 0xff0000, 0xff00, 0xff, 0xff000000)
|
55
|
-
else # ビッグエンディアン
|
56
|
-
bitmap = SDL::Surface.new_from(surface.data, surface.width, surface.height, 32, surface.stride, 0xff00, 0xff0000, 0xff000000, 0xff)
|
57
|
-
end
|
58
|
-
return Sprite.new(:bitmap => bitmap, :type => :as) if surface.format == Cairo::Format::RGB24
|
59
|
-
return Sprite.new(:bitmap => bitmap, :type => :ac)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
data/sample/cairo_sample.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# MiyakoCairoサンプル
|
3
|
-
# 2009.4.12 Cyross Makoto
|
4
|
-
|
5
|
-
require 'Miyako/miyako'
|
6
|
-
require 'Miyako/EXT/miyako_cairo'
|
7
|
-
|
8
|
-
sprite = Miyako::Sprite.new(:file=>"Animation2/lex_body.png", :type=>:ck)
|
9
|
-
sprite.bitmap.saveBMP("./sample.bmp")
|
10
|
-
|
11
|
-
surface = Miyako::MiyakoCairo.to_cairo_surface(sprite)
|
12
|
-
surface.write_to_png("./sample.png")
|
13
|
-
|
14
|
-
surface = Cairo::ImageSurface.new(Cairo::Format::ARGB32, 320, 240)
|
15
|
-
context = Cairo::Context.new(surface)
|
16
|
-
|
17
|
-
context.set_source_rgb(1.0, 0.5, 0.8)
|
18
|
-
context.fill{
|
19
|
-
context.rectangle(50, 50, 150, 100)
|
20
|
-
}
|
21
|
-
|
22
|
-
surface.write_to_png("./sample2.png")
|
23
|
-
|
24
|
-
sprite = Miyako::MiyakoCairo.to_sprite(surface)
|
25
|
-
sprite.bitmap.saveBMP("./sample2.bmp")
|