ray 0.0.1 → 0.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.yardopts +4 -0
- data/README.md +17 -21
- data/Rakefile +18 -139
- data/VERSION +1 -1
- data/ext/audio.cpp +723 -0
- data/ext/{color.c → color.cpp} +25 -13
- data/ext/drawable.cpp +91 -0
- data/ext/event.cpp +460 -0
- data/ext/extconf.rb +5 -104
- data/ext/font.cpp +190 -0
- data/ext/image.cpp +733 -0
- data/ext/input.cpp +74 -0
- data/ext/ray.cpp +168 -0
- data/ext/ray.hpp +356 -0
- data/ext/{rect.c → rect.cpp} +51 -37
- data/ext/shader.cpp +169 -0
- data/ext/shape.cpp +409 -0
- data/ext/sprite.cpp +306 -0
- data/ext/text.cpp +181 -0
- data/ext/vector.cpp +215 -0
- data/guide.md +619 -0
- data/lib/ray/audio.rb +0 -41
- data/lib/ray/color.rb +32 -10
- data/lib/ray/drawable.rb +16 -0
- data/lib/ray/dsl/event_listener.rb +25 -2
- data/lib/ray/dsl/event_runner.rb +33 -5
- data/lib/ray/dsl/event_translator.rb +66 -30
- data/lib/ray/dsl/handler.rb +3 -2
- data/lib/ray/dsl/matcher.rb +58 -14
- data/lib/ray/font.rb +38 -96
- data/lib/ray/font_set.rb +8 -8
- data/lib/ray/game.rb +87 -66
- data/lib/ray/helper.rb +105 -10
- data/lib/ray/image.rb +150 -24
- data/lib/ray/image_set.rb +3 -1
- data/lib/ray/input.rb +10 -0
- data/lib/ray/music_set.rb +5 -3
- data/lib/ray/ray.rb +21 -9
- data/lib/ray/rect.rb +48 -7
- data/lib/ray/rmagick.rb +41 -0
- data/lib/ray/scene.rb +99 -43
- data/lib/ray/scene_list.rb +67 -0
- data/lib/ray/shape.rb +132 -0
- data/lib/ray/sound_set.rb +4 -2
- data/lib/ray/sprite.rb +49 -111
- data/lib/ray/text.rb +101 -0
- data/lib/ray/text_helper.rb +37 -0
- data/lib/ray/turtle.rb +215 -0
- data/lib/ray/vector.rb +226 -0
- data/samples/audio/spacial.rb +44 -0
- data/samples/hello_world/hello.rb +9 -13
- data/samples/hello_world/hello_dsl.rb +8 -12
- data/samples/hello_world/text.rb +15 -0
- data/samples/opengl/binding.rb +38 -0
- data/samples/opengl/image.rb +32 -0
- data/samples/opengl/opengl.rb +34 -0
- data/samples/opengl/shader.rb +42 -0
- data/samples/pong/pong.rb +14 -10
- data/samples/run_scene.rb +53 -0
- data/samples/shaders/scene.rb +40 -0
- data/samples/shaders/shaders.rb +42 -0
- data/samples/shaders/shape.rb +34 -0
- data/samples/sokoban/sokoban.rb +18 -18
- data/samples/test/actual_scene.rb +41 -0
- data/samples/test/scene_riot.rb +39 -0
- data/samples/test/scene_spec.rb +32 -0
- data/samples/test/scene_test_unit.rb +25 -0
- data/samples/turtle/byzantium.rb +45 -0
- data/samples/turtle/hilbert.rb +48 -0
- data/samples/turtle/koch.rb +55 -0
- data/samples/turtle/mandala.rb +61 -0
- data/samples/turtle/tree.rb +57 -0
- data/test/audio_test.rb +69 -0
- data/test/color_test.rb +77 -0
- data/test/drawable_test.rb +19 -0
- data/test/dsl_test.rb +93 -0
- data/test/font_test.rb +57 -0
- data/test/helpers.rb +94 -0
- data/test/image_test.rb +82 -0
- data/test/ray_test.rb +25 -0
- data/test/rect_test.rb +121 -0
- data/{spec → test}/res/VeraMono.ttf +0 -0
- data/{spec → test}/res/aqua.bmp +0 -0
- data/{spec → test}/res/aqua.png +0 -0
- data/{spec → test}/res/aqua2.bmp +0 -0
- data/{spec → test}/res/not_a_jpeg.jpeg +0 -0
- data/{spec → test}/res/pop.wav +0 -0
- data/test/resource_set_test.rb +99 -0
- data/test/run_all.rb +7 -0
- data/test/shape_test.rb +101 -0
- data/test/sprite_test.rb +89 -0
- data/test/text_test.rb +78 -0
- data/test/turtle_test.rb +176 -0
- data/test/vector_test.rb +111 -0
- data/yard_ext.rb +0 -28
- metadata +95 -139
- data/.gitignore +0 -23
- data/.gitmodules +0 -3
- data/.rspec +0 -3
- data/ext/audio.c +0 -473
- data/ext/event.c +0 -557
- data/ext/font.c +0 -287
- data/ext/image.c +0 -933
- data/ext/joystick.c +0 -145
- data/ext/ray.c +0 -489
- data/ext/ray.h +0 -245
- data/ext/ray_osx.m +0 -161
- data/lib/ray/joystick.rb +0 -30
- data/psp/SDL_psp_main.c +0 -84
- data/psp/bigdecimal/README +0 -60
- data/psp/bigdecimal/bigdecimal.c +0 -4697
- data/psp/bigdecimal/bigdecimal.h +0 -216
- data/psp/bigdecimal/lib/bigdecimal/jacobian.rb +0 -85
- data/psp/bigdecimal/lib/bigdecimal/ludcmp.rb +0 -84
- data/psp/bigdecimal/lib/bigdecimal/math.rb +0 -235
- data/psp/bigdecimal/lib/bigdecimal/newton.rb +0 -77
- data/psp/bigdecimal/lib/bigdecimal/util.rb +0 -65
- data/psp/digest/bubblebabble/bubblebabble.c +0 -142
- data/psp/digest/defs.h +0 -20
- data/psp/digest/digest.c +0 -643
- data/psp/digest/digest.h +0 -32
- data/psp/digest/lib/digest.rb +0 -50
- data/psp/digest/lib/md5.rb +0 -27
- data/psp/digest/lib/sha1.rb +0 -27
- data/psp/digest/md5/md5.c +0 -420
- data/psp/digest/md5/md5.h +0 -80
- data/psp/digest/md5/md5init.c +0 -40
- data/psp/digest/rmd160/rmd160.c +0 -457
- data/psp/digest/rmd160/rmd160.h +0 -56
- data/psp/digest/rmd160/rmd160init.c +0 -40
- data/psp/digest/sha1/sha1.c +0 -269
- data/psp/digest/sha1/sha1.h +0 -39
- data/psp/digest/sha1/sha1init.c +0 -40
- data/psp/digest/sha2/lib/sha2.rb +0 -73
- data/psp/digest/sha2/sha2.c +0 -919
- data/psp/digest/sha2/sha2.h +0 -109
- data/psp/digest/sha2/sha2init.c +0 -52
- data/psp/enumerator/enumerator.c +0 -298
- data/psp/etc/etc.c +0 -559
- data/psp/ext.c +0 -289
- data/psp/fcntl/fcntl.c +0 -187
- data/psp/lib/rbconfig.rb +0 -178
- data/psp/nkf/lib/kconv.rb +0 -367
- data/psp/nkf/nkf-utf8/config.h +0 -88
- data/psp/nkf/nkf-utf8/nkf.c +0 -6040
- data/psp/nkf/nkf-utf8/utf8tbl.c +0 -8500
- data/psp/nkf/nkf-utf8/utf8tbl.h +0 -34
- data/psp/nkf/nkf.c +0 -654
- data/psp/socket/addrinfo.h +0 -173
- data/psp/socket/getaddrinfo.c +0 -676
- data/psp/socket/getnameinfo.c +0 -270
- data/psp/socket/pspsocket.c +0 -71
- data/psp/socket/pspsocket.h +0 -28
- data/psp/socket/socket.c +0 -4662
- data/psp/socket/sockport.h +0 -76
- data/psp/stringio/stringio.c +0 -1306
- data/psp/strscan/strscan.c +0 -1320
- data/psp/syck/bytecode.c +0 -1166
- data/psp/syck/emitter.c +0 -1242
- data/psp/syck/gram.c +0 -1894
- data/psp/syck/gram.h +0 -79
- data/psp/syck/handler.c +0 -174
- data/psp/syck/implicit.c +0 -2990
- data/psp/syck/node.c +0 -408
- data/psp/syck/rubyext.c +0 -2367
- data/psp/syck/syck.c +0 -504
- data/psp/syck/syck.h +0 -456
- data/psp/syck/token.c +0 -2725
- data/psp/syck/yaml2byte.c +0 -257
- data/psp/syck/yamlbyte.h +0 -170
- data/psp/thread/thread.c +0 -1175
- data/psp/zlib/zlib.c +0 -3547
- data/script.rb +0 -10
- data/spec/ray/audio_spec.rb +0 -146
- data/spec/ray/color_spec.rb +0 -57
- data/spec/ray/event_spec.rb +0 -80
- data/spec/ray/font_spec.rb +0 -93
- data/spec/ray/image_set_spec.rb +0 -48
- data/spec/ray/image_spec.rb +0 -162
- data/spec/ray/joystick_spec.rb +0 -21
- data/spec/ray/matcher_spec.rb +0 -50
- data/spec/ray/ray_spec.rb +0 -88
- data/spec/ray/rect_spec.rb +0 -154
- data/spec/ray/resource_set_spec.rb +0 -105
- data/spec/ray/sprite_spec.rb +0 -163
- data/spec/spec.opts +0 -4
- data/spec/spec_helper.rb +0 -8
data/yard_ext.rb
CHANGED
@@ -19,13 +19,7 @@ end
|
|
19
19
|
class CustomCParser < YARD::Parser::CParser
|
20
20
|
include YARD
|
21
21
|
|
22
|
-
def parse
|
23
|
-
super
|
24
|
-
parse_constants
|
25
|
-
end
|
26
|
-
|
27
22
|
private
|
28
|
-
|
29
23
|
def find_method_body(object, func_name, content = @content)
|
30
24
|
case content
|
31
25
|
when %r"((?>/\*.*?\*/\s*))(?:(?:static|SWIGINTERN)\s+)?(?:intern\s+)?VALUE\s+#{func_name}
|
@@ -63,28 +57,6 @@ class CustomCParser < YARD::Parser::CParser
|
|
63
57
|
object.docstring = parse_comments(object, comment) if comment
|
64
58
|
end
|
65
59
|
end
|
66
|
-
|
67
|
-
def handle_constants(type, var_name, const_name, definition)
|
68
|
-
namespace = @namespaces[var_name]
|
69
|
-
obj = CodeObjects::ConstantObject.new(namespace, const_name)
|
70
|
-
obj.value = definition
|
71
|
-
end
|
72
|
-
|
73
|
-
def parse_constants
|
74
|
-
@content.scan(%r{\Wrb_define_
|
75
|
-
( variable |
|
76
|
-
readonly_variable |
|
77
|
-
const |
|
78
|
-
global_const | )
|
79
|
-
\s*\(
|
80
|
-
(?:\s*(\w+),)?
|
81
|
-
\s*"(\w+)",
|
82
|
-
\s*(.*?)\s*\)\s*;
|
83
|
-
}xm) do |type, var_name, const_name, definition|
|
84
|
-
var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
|
85
|
-
handle_constants type, var_name, const_name, definition
|
86
|
-
end
|
87
|
-
end
|
88
60
|
end
|
89
61
|
|
90
62
|
YARD::Parser::SourceParser.register_parser_type(:c, CustomCParser,
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ray
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
version: 0.0.1
|
4
|
+
prerelease: 6
|
5
|
+
version: 0.1.0.pre1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- "Mon ou\xC3\xAFe"
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
13
|
+
date: 2011-02-19 00:00:00 +01:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,8 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ">="
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
24
|
version: "0"
|
31
25
|
type: :development
|
32
26
|
version_requirements: *id001
|
@@ -38,34 +32,28 @@ dependencies:
|
|
38
32
|
requirements:
|
39
33
|
- - ">="
|
40
34
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 0
|
43
35
|
version: "0"
|
44
36
|
type: :development
|
45
37
|
version_requirements: *id002
|
46
38
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
39
|
+
name: riot
|
48
40
|
prerelease: false
|
49
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
50
42
|
none: false
|
51
43
|
requirements:
|
52
44
|
- - ">="
|
53
45
|
- !ruby/object:Gem::Version
|
54
|
-
segments:
|
55
|
-
- 0
|
56
46
|
version: "0"
|
57
47
|
type: :development
|
58
48
|
version_requirements: *id003
|
59
49
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
50
|
+
name: rr
|
61
51
|
prerelease: false
|
62
52
|
requirement: &id004 !ruby/object:Gem::Requirement
|
63
53
|
none: false
|
64
54
|
requirements:
|
65
55
|
- - ">="
|
66
56
|
- !ruby/object:Gem::Version
|
67
|
-
segments:
|
68
|
-
- 0
|
69
57
|
version: "0"
|
70
58
|
type: :development
|
71
59
|
version_requirements: *id004
|
@@ -78,26 +66,32 @@ extensions:
|
|
78
66
|
extra_rdoc_files:
|
79
67
|
- README.md
|
80
68
|
files:
|
81
|
-
- .
|
82
|
-
- .
|
83
|
-
- .rspec
|
69
|
+
- .gemtest
|
70
|
+
- .yardopts
|
84
71
|
- README.md
|
85
72
|
- Rakefile
|
86
73
|
- VERSION
|
87
|
-
- ext/audio.
|
88
|
-
- ext/color.
|
89
|
-
- ext/
|
74
|
+
- ext/audio.cpp
|
75
|
+
- ext/color.cpp
|
76
|
+
- ext/drawable.cpp
|
77
|
+
- ext/event.cpp
|
90
78
|
- ext/extconf.rb
|
91
|
-
- ext/font.
|
92
|
-
- ext/image.
|
93
|
-
- ext/
|
94
|
-
- ext/ray.
|
95
|
-
- ext/ray.
|
96
|
-
- ext/
|
97
|
-
- ext/
|
79
|
+
- ext/font.cpp
|
80
|
+
- ext/image.cpp
|
81
|
+
- ext/input.cpp
|
82
|
+
- ext/ray.cpp
|
83
|
+
- ext/ray.hpp
|
84
|
+
- ext/rect.cpp
|
85
|
+
- ext/shader.cpp
|
86
|
+
- ext/shape.cpp
|
87
|
+
- ext/sprite.cpp
|
88
|
+
- ext/text.cpp
|
89
|
+
- ext/vector.cpp
|
90
|
+
- guide.md
|
98
91
|
- lib/ray.rb
|
99
92
|
- lib/ray/audio.rb
|
100
93
|
- lib/ray/color.rb
|
94
|
+
- lib/ray/drawable.rb
|
101
95
|
- lib/ray/dsl.rb
|
102
96
|
- lib/ray/dsl/event.rb
|
103
97
|
- lib/ray/dsl/event_listener.rb
|
@@ -112,112 +106,75 @@ files:
|
|
112
106
|
- lib/ray/helper.rb
|
113
107
|
- lib/ray/image.rb
|
114
108
|
- lib/ray/image_set.rb
|
115
|
-
- lib/ray/
|
109
|
+
- lib/ray/input.rb
|
116
110
|
- lib/ray/music_set.rb
|
117
111
|
- lib/ray/ray.rb
|
118
112
|
- lib/ray/rect.rb
|
119
113
|
- lib/ray/resource_set.rb
|
114
|
+
- lib/ray/rmagick.rb
|
120
115
|
- lib/ray/scene.rb
|
116
|
+
- lib/ray/scene_list.rb
|
117
|
+
- lib/ray/shape.rb
|
121
118
|
- lib/ray/sound_set.rb
|
122
119
|
- lib/ray/sprite.rb
|
123
|
-
-
|
124
|
-
-
|
125
|
-
-
|
126
|
-
-
|
127
|
-
-
|
128
|
-
- psp/bigdecimal/lib/bigdecimal/ludcmp.rb
|
129
|
-
- psp/bigdecimal/lib/bigdecimal/math.rb
|
130
|
-
- psp/bigdecimal/lib/bigdecimal/newton.rb
|
131
|
-
- psp/bigdecimal/lib/bigdecimal/util.rb
|
132
|
-
- psp/digest/bubblebabble/bubblebabble.c
|
133
|
-
- psp/digest/defs.h
|
134
|
-
- psp/digest/digest.c
|
135
|
-
- psp/digest/digest.h
|
136
|
-
- psp/digest/lib/digest.rb
|
137
|
-
- psp/digest/lib/md5.rb
|
138
|
-
- psp/digest/lib/sha1.rb
|
139
|
-
- psp/digest/md5/md5.c
|
140
|
-
- psp/digest/md5/md5.h
|
141
|
-
- psp/digest/md5/md5init.c
|
142
|
-
- psp/digest/rmd160/rmd160.c
|
143
|
-
- psp/digest/rmd160/rmd160.h
|
144
|
-
- psp/digest/rmd160/rmd160init.c
|
145
|
-
- psp/digest/sha1/sha1.c
|
146
|
-
- psp/digest/sha1/sha1.h
|
147
|
-
- psp/digest/sha1/sha1init.c
|
148
|
-
- psp/digest/sha2/lib/sha2.rb
|
149
|
-
- psp/digest/sha2/sha2.c
|
150
|
-
- psp/digest/sha2/sha2.h
|
151
|
-
- psp/digest/sha2/sha2init.c
|
152
|
-
- psp/enumerator/enumerator.c
|
153
|
-
- psp/etc/etc.c
|
154
|
-
- psp/ext.c
|
155
|
-
- psp/fcntl/fcntl.c
|
156
|
-
- psp/lib/rbconfig.rb
|
157
|
-
- psp/nkf/lib/kconv.rb
|
158
|
-
- psp/nkf/nkf-utf8/config.h
|
159
|
-
- psp/nkf/nkf-utf8/nkf.c
|
160
|
-
- psp/nkf/nkf-utf8/utf8tbl.c
|
161
|
-
- psp/nkf/nkf-utf8/utf8tbl.h
|
162
|
-
- psp/nkf/nkf.c
|
163
|
-
- psp/socket/addrinfo.h
|
164
|
-
- psp/socket/getaddrinfo.c
|
165
|
-
- psp/socket/getnameinfo.c
|
166
|
-
- psp/socket/pspsocket.c
|
167
|
-
- psp/socket/pspsocket.h
|
168
|
-
- psp/socket/socket.c
|
169
|
-
- psp/socket/sockport.h
|
170
|
-
- psp/stringio/stringio.c
|
171
|
-
- psp/strscan/strscan.c
|
172
|
-
- psp/syck/bytecode.c
|
173
|
-
- psp/syck/emitter.c
|
174
|
-
- psp/syck/gram.c
|
175
|
-
- psp/syck/gram.h
|
176
|
-
- psp/syck/handler.c
|
177
|
-
- psp/syck/implicit.c
|
178
|
-
- psp/syck/node.c
|
179
|
-
- psp/syck/rubyext.c
|
180
|
-
- psp/syck/syck.c
|
181
|
-
- psp/syck/syck.h
|
182
|
-
- psp/syck/token.c
|
183
|
-
- psp/syck/yaml2byte.c
|
184
|
-
- psp/syck/yamlbyte.h
|
185
|
-
- psp/thread/thread.c
|
186
|
-
- psp/zlib/zlib.c
|
120
|
+
- lib/ray/text.rb
|
121
|
+
- lib/ray/text_helper.rb
|
122
|
+
- lib/ray/turtle.rb
|
123
|
+
- lib/ray/vector.rb
|
124
|
+
- samples/audio/spacial.rb
|
187
125
|
- samples/hello_world/hello.rb
|
188
126
|
- samples/hello_world/hello_dsl.rb
|
127
|
+
- samples/hello_world/text.rb
|
128
|
+
- samples/opengl/binding.rb
|
129
|
+
- samples/opengl/image.rb
|
130
|
+
- samples/opengl/opengl.rb
|
131
|
+
- samples/opengl/shader.rb
|
189
132
|
- samples/pong/pong.rb
|
133
|
+
- samples/run_scene.rb
|
134
|
+
- samples/shaders/scene.rb
|
135
|
+
- samples/shaders/shaders.rb
|
136
|
+
- samples/shaders/shape.rb
|
190
137
|
- samples/sokoban/level_1
|
191
138
|
- samples/sokoban/sokoban.rb
|
192
|
-
-
|
193
|
-
-
|
194
|
-
-
|
195
|
-
-
|
196
|
-
-
|
197
|
-
-
|
198
|
-
-
|
199
|
-
-
|
200
|
-
-
|
201
|
-
-
|
202
|
-
-
|
203
|
-
-
|
204
|
-
-
|
205
|
-
-
|
206
|
-
-
|
207
|
-
-
|
208
|
-
-
|
209
|
-
-
|
210
|
-
-
|
211
|
-
-
|
212
|
-
-
|
139
|
+
- samples/test/actual_scene.rb
|
140
|
+
- samples/test/scene_riot.rb
|
141
|
+
- samples/test/scene_spec.rb
|
142
|
+
- samples/test/scene_test_unit.rb
|
143
|
+
- samples/turtle/byzantium.rb
|
144
|
+
- samples/turtle/hilbert.rb
|
145
|
+
- samples/turtle/koch.rb
|
146
|
+
- samples/turtle/mandala.rb
|
147
|
+
- samples/turtle/tree.rb
|
148
|
+
- test/audio_test.rb
|
149
|
+
- test/color_test.rb
|
150
|
+
- test/drawable_test.rb
|
151
|
+
- test/dsl_test.rb
|
152
|
+
- test/font_test.rb
|
153
|
+
- test/helpers.rb
|
154
|
+
- test/image_test.rb
|
155
|
+
- test/ray_test.rb
|
156
|
+
- test/rect_test.rb
|
157
|
+
- test/res/VeraMono.ttf
|
158
|
+
- test/res/aqua.bmp
|
159
|
+
- test/res/aqua.png
|
160
|
+
- test/res/aqua2.bmp
|
161
|
+
- test/res/not_a_jpeg.jpeg
|
162
|
+
- test/res/pop.wav
|
163
|
+
- test/resource_set_test.rb
|
164
|
+
- test/run_all.rb
|
165
|
+
- test/shape_test.rb
|
166
|
+
- test/sprite_test.rb
|
167
|
+
- test/text_test.rb
|
168
|
+
- test/turtle_test.rb
|
169
|
+
- test/vector_test.rb
|
213
170
|
- yard_ext.rb
|
214
|
-
has_rdoc:
|
171
|
+
has_rdoc: true
|
215
172
|
homepage: http://github.com/Mon-Ouie/ray
|
216
173
|
licenses: []
|
217
174
|
|
218
175
|
post_install_message:
|
219
|
-
rdoc_options:
|
220
|
-
|
176
|
+
rdoc_options: []
|
177
|
+
|
221
178
|
require_paths:
|
222
179
|
- lib
|
223
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -225,35 +182,34 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
182
|
requirements:
|
226
183
|
- - ">="
|
227
184
|
- !ruby/object:Gem::Version
|
228
|
-
segments:
|
229
|
-
- 0
|
230
185
|
version: "0"
|
231
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
187
|
none: false
|
233
188
|
requirements:
|
234
|
-
- - "
|
189
|
+
- - ">"
|
235
190
|
- !ruby/object:Gem::Version
|
236
|
-
|
237
|
-
- 0
|
238
|
-
version: "0"
|
191
|
+
version: 1.3.1
|
239
192
|
requirements: []
|
240
193
|
|
241
194
|
rubyforge_project:
|
242
|
-
rubygems_version: 1.
|
195
|
+
rubygems_version: 1.5.2
|
243
196
|
signing_key:
|
244
197
|
specification_version: 3
|
245
198
|
summary: A library to write games (or to play with) in Ruby
|
246
199
|
test_files:
|
247
|
-
-
|
248
|
-
-
|
249
|
-
-
|
250
|
-
-
|
251
|
-
-
|
252
|
-
-
|
253
|
-
-
|
254
|
-
-
|
255
|
-
-
|
256
|
-
-
|
257
|
-
-
|
258
|
-
-
|
259
|
-
-
|
200
|
+
- test/audio_test.rb
|
201
|
+
- test/color_test.rb
|
202
|
+
- test/drawable_test.rb
|
203
|
+
- test/dsl_test.rb
|
204
|
+
- test/font_test.rb
|
205
|
+
- test/helpers.rb
|
206
|
+
- test/image_test.rb
|
207
|
+
- test/ray_test.rb
|
208
|
+
- test/rect_test.rb
|
209
|
+
- test/resource_set_test.rb
|
210
|
+
- test/run_all.rb
|
211
|
+
- test/shape_test.rb
|
212
|
+
- test/sprite_test.rb
|
213
|
+
- test/text_test.rb
|
214
|
+
- test/turtle_test.rb
|
215
|
+
- test/vector_test.rb
|
data/.gitignore
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
.yardoc/
|
2
|
-
doc/
|
3
|
-
pkg/
|
4
|
-
*.rbc
|
5
|
-
*.gems
|
6
|
-
*.o
|
7
|
-
*.gemspec
|
8
|
-
*.elf
|
9
|
-
*.tar.gz
|
10
|
-
*.tar.bz2
|
11
|
-
*.prx
|
12
|
-
*.PBP
|
13
|
-
*.log
|
14
|
-
ext/Makefile
|
15
|
-
*.so
|
16
|
-
*.SFO
|
17
|
-
*.bundle
|
18
|
-
Makefile
|
19
|
-
ext/ray
|
20
|
-
/ext/mkmf.log
|
21
|
-
ruby-1.8.*/
|
22
|
-
ruby_stdlib/
|
23
|
-
autotest/
|
data/.gitmodules
DELETED
data/.rspec
DELETED
data/ext/audio.c
DELETED
@@ -1,473 +0,0 @@
|
|
1
|
-
#include "ray.h"
|
2
|
-
|
3
|
-
#ifdef HAVE_SDL_MIXER
|
4
|
-
|
5
|
-
VALUE ray_mAudio = Qnil;
|
6
|
-
VALUE ray_cSound = Qnil;
|
7
|
-
VALUE ray_cMusic = Qnil;
|
8
|
-
|
9
|
-
/* @return [Integer] The audio frequency */
|
10
|
-
VALUE ray_audio_frequency() {
|
11
|
-
int freq = 0, channels = 0;
|
12
|
-
uint16_t format = 0;
|
13
|
-
Mix_QuerySpec(&freq, &format, &channels);
|
14
|
-
|
15
|
-
return INT2FIX(freq);
|
16
|
-
}
|
17
|
-
|
18
|
-
/* @return [Integer] The audio format */
|
19
|
-
VALUE ray_audio_format() {
|
20
|
-
int freq = 0, channels = 0;
|
21
|
-
uint16_t format = 0;
|
22
|
-
Mix_QuerySpec(&freq, &format, &channels);
|
23
|
-
|
24
|
-
return INT2FIX(format);
|
25
|
-
}
|
26
|
-
|
27
|
-
/* @return [true, false] true if mono is used */
|
28
|
-
VALUE ray_audio_mono() {
|
29
|
-
int freq = 0, channels = 0;
|
30
|
-
uint16_t format = 0;
|
31
|
-
Mix_QuerySpec(&freq, &format, &channels);
|
32
|
-
|
33
|
-
return channels == 1 ? Qtrue : Qfalse;
|
34
|
-
}
|
35
|
-
|
36
|
-
/* @return [true, false] true if stereo is used */
|
37
|
-
VALUE ray_audio_stereo() {
|
38
|
-
int freq = 0, channels = 0;
|
39
|
-
uint16_t format = 0;
|
40
|
-
Mix_QuerySpec(&freq, &format, &channels);
|
41
|
-
|
42
|
-
return channels == 1 ? Qfalse : Qtrue;
|
43
|
-
}
|
44
|
-
|
45
|
-
/*
|
46
|
-
@return [Float] The volume for the song which is currently being played.
|
47
|
-
0 is the minimum volume, whereas 100 is the maximum.
|
48
|
-
*/
|
49
|
-
VALUE ray_audio_volume(VALUE self) {
|
50
|
-
int volume = Mix_VolumeMusic(-1);
|
51
|
-
return rb_float_new((volume / 128.0f) * 100.0f);
|
52
|
-
}
|
53
|
-
|
54
|
-
/* Sets the volume of the song which is currently being played */
|
55
|
-
VALUE ray_audio_set_volume(VALUE self, VALUE value) {
|
56
|
-
float volume = (float)NUM2DBL(value);
|
57
|
-
Mix_VolumeMusic((int)((volume / 100.0f) * 128.0f));
|
58
|
-
|
59
|
-
return value;
|
60
|
-
}
|
61
|
-
|
62
|
-
/*
|
63
|
-
@overload playing?(channel = nil)
|
64
|
-
@return [true, false] If channel is set, true if something is playing on
|
65
|
-
that channel. If it isn't, true if a music is currently being played.
|
66
|
-
*/
|
67
|
-
VALUE ray_audio_playing(int argc, VALUE *argv, VALUE self) {
|
68
|
-
VALUE channel = Qnil;
|
69
|
-
rb_scan_args(argc, argv, "01", &channel);
|
70
|
-
|
71
|
-
if (NIL_P(channel))
|
72
|
-
return Mix_PlayingMusic() ? Qtrue : Qfalse;
|
73
|
-
return Mix_Playing(NUM2INT(channel)) ? Qtrue: Qfalse;
|
74
|
-
}
|
75
|
-
|
76
|
-
/*
|
77
|
-
@overload stop(channel = nil)
|
78
|
-
If channel is set, stops playback on a channel. Stops playing
|
79
|
-
the current music otherwise.
|
80
|
-
*/
|
81
|
-
VALUE ray_audio_stop(int argc, VALUE *argv, VALUE self) {
|
82
|
-
VALUE channel;
|
83
|
-
rb_scan_args(argc, argv, "01", &channel);
|
84
|
-
|
85
|
-
if (!NIL_P(channel)) {
|
86
|
-
Mix_HaltChannel(NUM2INT(channel));
|
87
|
-
return channel;
|
88
|
-
}
|
89
|
-
|
90
|
-
Mix_HaltMusic();
|
91
|
-
return Qnil;
|
92
|
-
}
|
93
|
-
|
94
|
-
/*
|
95
|
-
@overload pause(channel = nil)
|
96
|
-
If channel is set, pauses a channel. Pauses the current music otherwise.
|
97
|
-
*/
|
98
|
-
VALUE ray_audio_pause(int argc, VALUE *argv, VALUE self) {
|
99
|
-
VALUE channel;
|
100
|
-
rb_scan_args(argc, argv, "01", &channel);
|
101
|
-
|
102
|
-
if (!NIL_P(channel)) {
|
103
|
-
Mix_Pause(NUM2INT(channel));
|
104
|
-
return channel;
|
105
|
-
}
|
106
|
-
|
107
|
-
Mix_PauseMusic();
|
108
|
-
return Qnil;
|
109
|
-
}
|
110
|
-
|
111
|
-
/*
|
112
|
-
@overload resume(channel = nil)
|
113
|
-
If channel is set, resumes a paused channel from pause. Resumes the music
|
114
|
-
otherwise.
|
115
|
-
*/
|
116
|
-
VALUE ray_audio_resume(int argc, VALUE *argv, VALUE self) {
|
117
|
-
VALUE channel;
|
118
|
-
rb_scan_args(argc, argv, "01", &channel);
|
119
|
-
|
120
|
-
if (!NIL_P(channel)) {
|
121
|
-
Mix_Resume(NUM2INT(channel));
|
122
|
-
return channel;
|
123
|
-
}
|
124
|
-
|
125
|
-
Mix_ResumeMusic();
|
126
|
-
return Qnil;
|
127
|
-
}
|
128
|
-
|
129
|
-
/*
|
130
|
-
@overload paused?(channel = nil)
|
131
|
-
@return [true, false] True if the channel is paused. If channel isn't set,
|
132
|
-
returns true if the current music isn't paused.
|
133
|
-
*/
|
134
|
-
VALUE ray_audio_paused(int argc, VALUE *argv, VALUE self) {
|
135
|
-
VALUE channel;
|
136
|
-
rb_scan_args(argc, argv, "01", &channel);
|
137
|
-
|
138
|
-
if (!NIL_P(channel))
|
139
|
-
return Mix_Paused(NUM2INT(channel)) ? Qtrue : Qfalse;
|
140
|
-
return Mix_PausedMusic() ? Qtrue : Qfalse;
|
141
|
-
}
|
142
|
-
|
143
|
-
/*
|
144
|
-
@overload music_pos=(val)
|
145
|
-
Sets the position in the current music. May not be implemented for some
|
146
|
-
formats.
|
147
|
-
*/
|
148
|
-
VALUE ray_audio_set_music_pos(VALUE self, VALUE val) {
|
149
|
-
Mix_SetMusicPosition(NUM2DBL(val));
|
150
|
-
return val;
|
151
|
-
}
|
152
|
-
|
153
|
-
Mix_Chunk *ray_rb2chunk(VALUE object) {
|
154
|
-
if (!RAY_IS_A(object, ray_cSound)) {
|
155
|
-
rb_raise(rb_eTypeError, "Can't convert %s into Ray::Sound",
|
156
|
-
RAY_OBJ_CLASSNAME(object));
|
157
|
-
}
|
158
|
-
|
159
|
-
ray_sound *ptr = NULL;
|
160
|
-
Data_Get_Struct(object, ray_sound, ptr);
|
161
|
-
|
162
|
-
return ptr->sound;
|
163
|
-
}
|
164
|
-
|
165
|
-
void ray_free_sound(ray_sound *sound) {
|
166
|
-
if (sound->sound) Mix_FreeChunk(sound->sound);
|
167
|
-
free(sound);
|
168
|
-
}
|
169
|
-
|
170
|
-
VALUE ray_alloc_sound(VALUE self) {
|
171
|
-
ray_sound *ptr = malloc(sizeof(ray_sound));
|
172
|
-
ptr->sound = NULL;
|
173
|
-
|
174
|
-
VALUE ret = Data_Wrap_Struct(self, 0, ray_free_sound, ptr);
|
175
|
-
|
176
|
-
return ret;
|
177
|
-
}
|
178
|
-
|
179
|
-
void ray_init_sound_with_filename(VALUE self, VALUE filename) {
|
180
|
-
char *c_filename = StringValuePtr(filename);
|
181
|
-
ray_sound *sound = NULL;
|
182
|
-
Data_Get_Struct(self, ray_sound, sound);
|
183
|
-
|
184
|
-
sound->sound = Mix_LoadWAV(c_filename);
|
185
|
-
if (!sound->sound) {
|
186
|
-
rb_raise(rb_eRuntimeError, "Could not load sound (%s)",
|
187
|
-
Mix_GetError());
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
void ray_init_sound_with_io(VALUE self, VALUE io) {
|
192
|
-
ray_sound *sound = NULL;
|
193
|
-
Data_Get_Struct(self, ray_sound, sound);
|
194
|
-
|
195
|
-
VALUE string = rb_funcall2(io, RAY_METH("read"), 0, NULL);
|
196
|
-
char *content = StringValuePtr(string);
|
197
|
-
SDL_RWops *data = SDL_RWFromMem(content, (int)RSTRING_LEN(string));
|
198
|
-
|
199
|
-
if (!data) {
|
200
|
-
rb_raise(rb_eRuntimeError, "Could not create music data (%s)",
|
201
|
-
SDL_GetError());
|
202
|
-
}
|
203
|
-
|
204
|
-
sound->sound = Mix_LoadWAV_RW(data, 1);
|
205
|
-
if (!sound->sound) {
|
206
|
-
rb_raise(rb_eRuntimeError, "Could not load sound (%s)",
|
207
|
-
Mix_GetError());
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
|
-
/*
|
212
|
-
Creates a new sound from an IO object or a filename.
|
213
|
-
*/
|
214
|
-
VALUE ray_init_sound(VALUE self, VALUE arg) {
|
215
|
-
if (rb_respond_to(arg, RAY_METH("to_str")))
|
216
|
-
ray_init_sound_with_filename(self, rb_String(arg));
|
217
|
-
else if (rb_respond_to(arg, RAY_METH("read")))
|
218
|
-
ray_init_sound_with_io(self, arg);
|
219
|
-
else {
|
220
|
-
rb_raise(rb_eTypeError, "Can't convert %s into String",
|
221
|
-
RAY_OBJ_CLASSNAME(arg));
|
222
|
-
}
|
223
|
-
|
224
|
-
return Qnil;
|
225
|
-
}
|
226
|
-
|
227
|
-
/*
|
228
|
-
@overload play(channel = 0, times = 1)
|
229
|
-
Plays a sound on the given channel a given number of times.
|
230
|
-
@param [Integer, :forever] times How many times the sound should be played.
|
231
|
-
Can also be :forever or 0 to play it forever.
|
232
|
-
*/
|
233
|
-
VALUE ray_sound_play(int argc, VALUE *argv, VALUE self) {
|
234
|
-
VALUE channel, times;
|
235
|
-
rb_scan_args(argc, argv, "02", &channel, ×);
|
236
|
-
|
237
|
-
if (NIL_P(channel)) channel = INT2FIX(0);
|
238
|
-
if (NIL_P(times)) times = INT2FIX(1);
|
239
|
-
|
240
|
-
int c_channel = NUM2INT(channel), c_times = 0;
|
241
|
-
if (times == RAY_SYM("forever"))
|
242
|
-
c_times = 0;
|
243
|
-
else
|
244
|
-
c_times = NUM2INT(times);
|
245
|
-
|
246
|
-
Mix_Chunk *chunk = ray_rb2chunk(self);
|
247
|
-
Mix_PlayChannel(c_channel, chunk, c_times - 1);
|
248
|
-
|
249
|
-
return self;
|
250
|
-
}
|
251
|
-
|
252
|
-
/*
|
253
|
-
@overload fade(duration, channel = 0, times = 1)
|
254
|
-
Same as play, but fades for a given number of a seconds.
|
255
|
-
@param [Float] duration Duration of the fade, in seconds.
|
256
|
-
@see Ray::Sound#play
|
257
|
-
*/
|
258
|
-
VALUE ray_sound_fade(int argc, VALUE *argv, VALUE self) {
|
259
|
-
VALUE duration, channel, times;
|
260
|
-
rb_scan_args(argc, argv, "12", &duration, &channel, ×);
|
261
|
-
|
262
|
-
if (NIL_P(channel)) channel = INT2FIX(0);
|
263
|
-
if (NIL_P(times)) times = INT2FIX(1);
|
264
|
-
|
265
|
-
int c_channel = NUM2INT(channel), c_times = 0;
|
266
|
-
if (times == RAY_SYM("forever"))
|
267
|
-
c_times = 0;
|
268
|
-
else
|
269
|
-
c_times = NUM2INT(times);
|
270
|
-
|
271
|
-
Mix_Chunk *chunk = ray_rb2chunk(self);
|
272
|
-
Mix_FadeInChannel(c_channel, chunk, c_times - 1,
|
273
|
-
(int)(NUM2DBL(duration) * 1000));
|
274
|
-
|
275
|
-
return self;
|
276
|
-
}
|
277
|
-
|
278
|
-
/* @return [Float] Volume of the sound, between 0 and 100. */
|
279
|
-
VALUE ray_sound_volume(VALUE self) {
|
280
|
-
Mix_Chunk *chunk = ray_rb2chunk(self);
|
281
|
-
int volume = Mix_VolumeChunk(chunk, -1);
|
282
|
-
|
283
|
-
return rb_float_new((volume / 128.0f) * 100.0f);
|
284
|
-
}
|
285
|
-
|
286
|
-
/* Sets the volume of the sound. */
|
287
|
-
VALUE ray_sound_set_volume(VALUE self, VALUE value) {
|
288
|
-
Mix_Chunk *chunk = ray_rb2chunk(self);
|
289
|
-
float volume = (float)NUM2DBL(value);
|
290
|
-
Mix_VolumeChunk(chunk, (int)((volume / 100.0f) * 128.0f));
|
291
|
-
|
292
|
-
return value;
|
293
|
-
}
|
294
|
-
|
295
|
-
Mix_Music *ray_rb2music(VALUE object) {
|
296
|
-
if (!RAY_IS_A(object, ray_cMusic)) {
|
297
|
-
rb_raise(rb_eTypeError, "Can't convert %s into Ray::Music",
|
298
|
-
RAY_OBJ_CLASSNAME(object));
|
299
|
-
}
|
300
|
-
|
301
|
-
ray_music *ptr = NULL;
|
302
|
-
Data_Get_Struct(object, ray_music, ptr);
|
303
|
-
|
304
|
-
return ptr->music;
|
305
|
-
}
|
306
|
-
|
307
|
-
void ray_free_music(ray_music *music) {
|
308
|
-
if (music->music) Mix_FreeMusic(music->music);
|
309
|
-
free(music);
|
310
|
-
}
|
311
|
-
|
312
|
-
VALUE ray_alloc_music(VALUE self) {
|
313
|
-
ray_music *ptr = malloc(sizeof(ray_music));
|
314
|
-
ptr->music = NULL;
|
315
|
-
|
316
|
-
VALUE ret = Data_Wrap_Struct(self, 0, ray_free_music, ptr);
|
317
|
-
|
318
|
-
return ret;
|
319
|
-
}
|
320
|
-
|
321
|
-
void ray_init_music_with_filename(VALUE self, VALUE filename) {
|
322
|
-
char *c_filename = StringValuePtr(filename);
|
323
|
-
ray_music *music = NULL;
|
324
|
-
Data_Get_Struct(self, ray_music, music);
|
325
|
-
|
326
|
-
music->music = Mix_LoadMUS(c_filename);
|
327
|
-
if (!music->music) {
|
328
|
-
rb_raise(rb_eRuntimeError, "Could not load music (%s)",
|
329
|
-
Mix_GetError());
|
330
|
-
}
|
331
|
-
}
|
332
|
-
|
333
|
-
void ray_init_music_with_io(VALUE self, VALUE io) {
|
334
|
-
ray_music *music = NULL;
|
335
|
-
Data_Get_Struct(self, ray_music, music);
|
336
|
-
|
337
|
-
VALUE string = rb_funcall2(io, RAY_METH("read"), 0, NULL);
|
338
|
-
char *content = StringValuePtr(string);
|
339
|
-
SDL_RWops *data = SDL_RWFromMem(content, (int)RSTRING_LEN(string));
|
340
|
-
|
341
|
-
if (!data) {
|
342
|
-
rb_raise(rb_eRuntimeError, "Could not create music data (%s)",
|
343
|
-
SDL_GetError());
|
344
|
-
}
|
345
|
-
|
346
|
-
music->music = Mix_LoadMUS_RW(data);
|
347
|
-
if (!music->music) {
|
348
|
-
rb_raise(rb_eRuntimeError, "Could not load music (%s)",
|
349
|
-
Mix_GetError());
|
350
|
-
}
|
351
|
-
|
352
|
-
SDL_FreeRW(data);
|
353
|
-
}
|
354
|
-
|
355
|
-
/*
|
356
|
-
Creates a new music from an IO object or a filename.
|
357
|
-
*/
|
358
|
-
VALUE ray_init_music(VALUE self, VALUE arg) {
|
359
|
-
if (rb_respond_to(arg, RAY_METH("to_str")))
|
360
|
-
ray_init_music_with_filename(self, rb_String(arg));
|
361
|
-
else if (rb_respond_to(arg, RAY_METH("read")))
|
362
|
-
ray_init_music_with_io(self, arg);
|
363
|
-
else {
|
364
|
-
rb_raise(rb_eTypeError, "Can't convert %s into String",
|
365
|
-
RAY_OBJ_CLASSNAME(arg));
|
366
|
-
}
|
367
|
-
|
368
|
-
return Qnil;
|
369
|
-
}
|
370
|
-
|
371
|
-
/* @return [Integer] The type of the music */
|
372
|
-
VALUE ray_music_type(VALUE self) {
|
373
|
-
Mix_Music *music = ray_rb2music(self);
|
374
|
-
Mix_MusicType ret = Mix_GetMusicType(music);
|
375
|
-
|
376
|
-
return INT2FIX(ret);
|
377
|
-
}
|
378
|
-
|
379
|
-
/*
|
380
|
-
@overload play(times = 1)
|
381
|
-
Plays the music a given number of times.
|
382
|
-
@param [Integer, :forever] times How many times the music should be played.
|
383
|
-
Can also be :forever or 0 to play it forever.
|
384
|
-
*/
|
385
|
-
VALUE ray_music_play(int argc, VALUE *argv, VALUE self) {
|
386
|
-
VALUE times;
|
387
|
-
rb_scan_args(argc, argv, "01", ×);
|
388
|
-
|
389
|
-
if (NIL_P(times)) times = INT2FIX(1);
|
390
|
-
|
391
|
-
int c_times = 0;
|
392
|
-
if (times == RAY_SYM("forever"))
|
393
|
-
c_times = 0;
|
394
|
-
else
|
395
|
-
c_times = NUM2INT(times);
|
396
|
-
|
397
|
-
Mix_Music *music = ray_rb2music(self);
|
398
|
-
Mix_PlayMusic(music, c_times);
|
399
|
-
|
400
|
-
return self;
|
401
|
-
}
|
402
|
-
|
403
|
-
/*
|
404
|
-
Document-class: Ray::Music
|
405
|
-
|
406
|
-
Class used to play music. Notice only one music can be played at the
|
407
|
-
same time.
|
408
|
-
*/
|
409
|
-
|
410
|
-
/*
|
411
|
-
Document-class: Ray::Sound
|
412
|
-
|
413
|
-
Class used to represent short sounds. You can play one sound per channel.
|
414
|
-
*/
|
415
|
-
|
416
|
-
void Init_ray_audio() {
|
417
|
-
ray_mAudio = rb_define_module_under(ray_mRay, "Audio");
|
418
|
-
|
419
|
-
rb_define_const(ray_mAudio, "FORMAT_U8", INT2FIX(AUDIO_U8));
|
420
|
-
rb_define_const(ray_mAudio, "FORMAT_S8", INT2FIX(AUDIO_S8));
|
421
|
-
rb_define_const(ray_mAudio, "FORMAT_U16LSB", INT2FIX(AUDIO_U16LSB));
|
422
|
-
rb_define_const(ray_mAudio, "FORMAT_S16LSB", INT2FIX(AUDIO_S16LSB));
|
423
|
-
rb_define_const(ray_mAudio, "FORMAT_U16MSB", INT2FIX(AUDIO_U16MSB));
|
424
|
-
rb_define_const(ray_mAudio, "FORMAT_S16MSB", INT2FIX(AUDIO_S16MSB));
|
425
|
-
rb_define_const(ray_mAudio, "FORMAT_U16", INT2FIX(AUDIO_U16));
|
426
|
-
rb_define_const(ray_mAudio, "FORMAT_S16", INT2FIX(AUDIO_S16));
|
427
|
-
rb_define_const(ray_mAudio, "FORMAT_U16SYS", INT2FIX(AUDIO_U16SYS));
|
428
|
-
rb_define_const(ray_mAudio, "FORMAT_S16SYS", INT2FIX(AUDIO_S16SYS));
|
429
|
-
|
430
|
-
rb_define_module_function(ray_mAudio, "frequency", ray_audio_frequency, 0);
|
431
|
-
rb_define_module_function(ray_mAudio, "format", ray_audio_format, 0);
|
432
|
-
rb_define_module_function(ray_mAudio, "mono?", ray_audio_mono, 0);
|
433
|
-
rb_define_module_function(ray_mAudio, "stereo?", ray_audio_stereo, 0);
|
434
|
-
|
435
|
-
rb_define_module_function(ray_mAudio, "volume", ray_audio_volume, 0);
|
436
|
-
rb_define_module_function(ray_mAudio, "volume=", ray_audio_set_volume, 1);
|
437
|
-
|
438
|
-
rb_define_module_function(ray_mAudio, "stop", ray_audio_stop, -1);
|
439
|
-
rb_define_module_function(ray_mAudio, "pause", ray_audio_pause, -1);
|
440
|
-
rb_define_module_function(ray_mAudio, "resume", ray_audio_resume, -1);
|
441
|
-
rb_define_module_function(ray_mAudio, "paused?", ray_audio_paused, -1);
|
442
|
-
rb_define_module_function(ray_mAudio, "playing?", ray_audio_playing, -1);
|
443
|
-
|
444
|
-
rb_define_module_function(ray_mAudio, "music_pos=", ray_audio_set_music_pos, 1);
|
445
|
-
|
446
|
-
ray_cSound = rb_define_class_under(ray_mRay, "Sound", rb_cObject);
|
447
|
-
rb_define_alloc_func(ray_cSound, ray_alloc_sound);
|
448
|
-
rb_define_method(ray_cSound, "initialize", ray_init_sound, 1);
|
449
|
-
rb_define_method(ray_cSound, "play", ray_sound_play, -1);
|
450
|
-
rb_define_method(ray_cSound, "fade", ray_sound_fade, -1);
|
451
|
-
rb_define_method(ray_cSound, "volume", ray_sound_volume, 0);
|
452
|
-
rb_define_method(ray_cSound, "volume=", ray_sound_set_volume, 1);
|
453
|
-
|
454
|
-
ray_cMusic = rb_define_class_under(ray_mRay, "Music", rb_cObject);
|
455
|
-
rb_define_alloc_func(ray_cMusic, ray_alloc_music);
|
456
|
-
rb_define_method(ray_cMusic, "initialize", ray_init_music, 1);
|
457
|
-
rb_define_method(ray_cMusic, "type", ray_music_type, 0);
|
458
|
-
rb_define_method(ray_cMusic, "play", ray_music_play, -1);
|
459
|
-
|
460
|
-
rb_define_const(ray_cMusic, "TYPE_NONE", INT2FIX(MUS_NONE));
|
461
|
-
rb_define_const(ray_cMusic, "TYPE_CMD", INT2FIX(MUS_CMD));
|
462
|
-
rb_define_const(ray_cMusic, "TYPE_WAV", INT2FIX(MUS_WAV));
|
463
|
-
rb_define_const(ray_cMusic, "TYPE_MOD", INT2FIX(MUS_MOD));
|
464
|
-
rb_define_const(ray_cMusic, "TYPE_MID", INT2FIX(MUS_MID));
|
465
|
-
rb_define_const(ray_cMusic, "TYPE_OGG", INT2FIX(MUS_OGG));
|
466
|
-
rb_define_const(ray_cMusic, "TYPE_MP3", INT2FIX(MUS_MP3));
|
467
|
-
#ifndef PSP
|
468
|
-
rb_define_const(ray_cMusic, "TYPE_MP3_MAD", INT2FIX(MUS_MP3_MAD));
|
469
|
-
rb_define_const(ray_cMusic, "TYPE_FLAC", INT2FIX(MUS_FLAC));
|
470
|
-
#endif
|
471
|
-
}
|
472
|
-
|
473
|
-
#endif
|