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/ext/{rect.c → rect.cpp}
RENAMED
@@ -1,14 +1,13 @@
|
|
1
|
-
#include "ray.
|
1
|
+
#include "ray.hpp"
|
2
2
|
|
3
3
|
VALUE ray_cRect = Qnil;
|
4
4
|
|
5
5
|
void ray_free_rect(ray_rect *ptr) {
|
6
|
-
|
6
|
+
delete ptr;
|
7
7
|
}
|
8
8
|
|
9
|
-
VALUE ray_rect2rb(ray_rect rect) {
|
10
|
-
ray_rect *ptr =
|
11
|
-
memcpy(ptr, &rect, sizeof(ray_rect));
|
9
|
+
VALUE ray_rect2rb(const ray_rect &rect) {
|
10
|
+
ray_rect *ptr = new ray_rect(rect);
|
12
11
|
|
13
12
|
VALUE obj = Data_Wrap_Struct(ray_cRect, NULL, ray_free_rect, ptr);
|
14
13
|
return obj;
|
@@ -29,20 +28,14 @@ ray_rect ray_rb2rect(VALUE obj) {
|
|
29
28
|
ray_rect ray_convert_to_rect(VALUE obj) {
|
30
29
|
if (RAY_IS_A(obj, ray_cRect))
|
31
30
|
return ray_rb2rect(obj);
|
32
|
-
else if (RAY_IS_A(obj, rb_cArray))
|
33
|
-
return ray_rb2rect(rb_apply(ray_cRect, RAY_METH("new"), obj));
|
34
31
|
else {
|
35
|
-
|
36
|
-
|
32
|
+
obj = rb_funcall(obj, RAY_METH("to_rect"), 0);
|
33
|
+
return ray_rb2rect(obj);
|
37
34
|
}
|
38
|
-
|
39
|
-
/* Should never happen */
|
40
|
-
ray_rect empty_rect = {0, 0, 0, 0};
|
41
|
-
return empty_rect;
|
42
35
|
}
|
43
36
|
|
44
37
|
VALUE ray_alloc_rect(VALUE self) {
|
45
|
-
ray_rect *rect =
|
38
|
+
ray_rect *rect = new ray_rect;
|
46
39
|
VALUE ret = Data_Wrap_Struct(self, 0, ray_free_rect, rect);
|
47
40
|
|
48
41
|
return ret;
|
@@ -58,10 +51,13 @@ VALUE ray_alloc_rect(VALUE self) {
|
|
58
51
|
@overload initialize(hash)
|
59
52
|
Creates a new rect according to the keys specified in hash.
|
60
53
|
|
61
|
-
@option hash [
|
62
|
-
@option hash [
|
63
|
-
@option hash [
|
64
|
-
@option hash [
|
54
|
+
@option hash [Float] :x
|
55
|
+
@option hash [Float] :y
|
56
|
+
@option hash [Float, optional] :width
|
57
|
+
@option hash [Float, optional] :height required if width is set
|
58
|
+
|
59
|
+
@option hash [Float, optional] :w alias for :width
|
60
|
+
@option hash [Float, optional] :h alias for :height
|
65
61
|
*/
|
66
62
|
VALUE ray_init_rect(int argc, VALUE *argv, VALUE self) {
|
67
63
|
VALUE x_or_hash, y, w, h;
|
@@ -106,51 +102,60 @@ VALUE ray_init_rect(int argc, VALUE *argv, VALUE self) {
|
|
106
102
|
ray_rect *rect;
|
107
103
|
Data_Get_Struct(self, ray_rect, rect);
|
108
104
|
|
109
|
-
rect->
|
110
|
-
rect->
|
105
|
+
rect->Left = NUM2DBL(x_or_hash);
|
106
|
+
rect->Top = NUM2DBL(y);
|
111
107
|
|
112
108
|
if (!NIL_P(w)) {
|
113
|
-
rect->
|
114
|
-
rect->
|
109
|
+
rect->Width = NUM2DBL(w);
|
110
|
+
rect->Height = NUM2DBL(h);
|
115
111
|
}
|
116
112
|
else {
|
117
|
-
rect->
|
118
|
-
rect->
|
113
|
+
rect->Width = 0;
|
114
|
+
rect->Height = 0;
|
119
115
|
}
|
120
116
|
|
121
117
|
return Qnil;
|
122
118
|
}
|
123
119
|
|
124
|
-
|
120
|
+
VALUE ray_init_rect_copy(VALUE self, VALUE other) {
|
121
|
+
ray_rect *rect = NULL, *source = NULL;
|
122
|
+
Data_Get_Struct(self, ray_rect, rect);
|
123
|
+
Data_Get_Struct(other, ray_rect, source);
|
124
|
+
|
125
|
+
*rect = *source;
|
126
|
+
return self;
|
127
|
+
}
|
128
|
+
|
129
|
+
/* @return [Float] position of the rect */
|
125
130
|
VALUE ray_rect_x(VALUE self) {
|
126
131
|
ray_rect *rect;
|
127
132
|
Data_Get_Struct(self, ray_rect, rect);
|
128
133
|
|
129
|
-
return
|
134
|
+
return rb_float_new(rect->Left);
|
130
135
|
}
|
131
136
|
|
132
|
-
/* @return [
|
137
|
+
/* @return [Float] position of the rect */
|
133
138
|
VALUE ray_rect_y(VALUE self) {
|
134
139
|
ray_rect *rect;
|
135
140
|
Data_Get_Struct(self, ray_rect, rect);
|
136
141
|
|
137
|
-
return
|
142
|
+
return rb_float_new(rect->Top);
|
138
143
|
}
|
139
144
|
|
140
|
-
/* @return [
|
145
|
+
/* @return [Float] size of the rect */
|
141
146
|
VALUE ray_rect_w(VALUE self) {
|
142
147
|
ray_rect *rect;
|
143
148
|
Data_Get_Struct(self, ray_rect, rect);
|
144
149
|
|
145
|
-
return
|
150
|
+
return rb_float_new(rect->Width);
|
146
151
|
}
|
147
152
|
|
148
|
-
/* @return [
|
153
|
+
/* @return [Float] size of the rect */
|
149
154
|
VALUE ray_rect_h(VALUE self) {
|
150
155
|
ray_rect *rect;
|
151
156
|
Data_Get_Struct(self, ray_rect, rect);
|
152
157
|
|
153
|
-
return
|
158
|
+
return rb_float_new(rect->Height);
|
154
159
|
}
|
155
160
|
|
156
161
|
/*
|
@@ -158,10 +163,12 @@ VALUE ray_rect_h(VALUE self) {
|
|
158
163
|
Sets the position of the rect
|
159
164
|
*/
|
160
165
|
VALUE ray_rect_set_x(VALUE self, VALUE val) {
|
166
|
+
rb_check_frozen(self);
|
167
|
+
|
161
168
|
ray_rect *rect;
|
162
169
|
Data_Get_Struct(self, ray_rect, rect);
|
163
170
|
|
164
|
-
rect->
|
171
|
+
rect->Left = NUM2DBL(val);
|
165
172
|
|
166
173
|
return val;
|
167
174
|
}
|
@@ -171,10 +178,12 @@ VALUE ray_rect_set_x(VALUE self, VALUE val) {
|
|
171
178
|
Sets the position of the rect
|
172
179
|
*/
|
173
180
|
VALUE ray_rect_set_y(VALUE self, VALUE val) {
|
181
|
+
rb_check_frozen(self);
|
182
|
+
|
174
183
|
ray_rect *rect;
|
175
184
|
Data_Get_Struct(self, ray_rect, rect);
|
176
185
|
|
177
|
-
rect->
|
186
|
+
rect->Top = NUM2DBL(val);
|
178
187
|
|
179
188
|
return val;
|
180
189
|
}
|
@@ -184,10 +193,12 @@ VALUE ray_rect_set_y(VALUE self, VALUE val) {
|
|
184
193
|
Sets the size of the rect
|
185
194
|
*/
|
186
195
|
VALUE ray_rect_set_w(VALUE self, VALUE val) {
|
196
|
+
rb_check_frozen(self);
|
197
|
+
|
187
198
|
ray_rect *rect;
|
188
199
|
Data_Get_Struct(self, ray_rect, rect);
|
189
200
|
|
190
|
-
rect->
|
201
|
+
rect->Width = NUM2DBL(val);
|
191
202
|
|
192
203
|
return val;
|
193
204
|
}
|
@@ -197,10 +208,12 @@ VALUE ray_rect_set_w(VALUE self, VALUE val) {
|
|
197
208
|
Sets the size of the rect
|
198
209
|
*/
|
199
210
|
VALUE ray_rect_set_h(VALUE self, VALUE val) {
|
211
|
+
rb_check_frozen(self);
|
212
|
+
|
200
213
|
ray_rect *rect;
|
201
214
|
Data_Get_Struct(self, ray_rect, rect);
|
202
215
|
|
203
|
-
rect->
|
216
|
+
rect->Height = NUM2DBL(val);
|
204
217
|
|
205
218
|
return val;
|
206
219
|
}
|
@@ -208,7 +221,7 @@ VALUE ray_rect_set_h(VALUE self, VALUE val) {
|
|
208
221
|
/*
|
209
222
|
Document-class: Ray::Rect
|
210
223
|
|
211
|
-
Rects are used to represent a part of
|
224
|
+
Rects are used to represent a part of an image, using
|
212
225
|
two attributes to represent its position, and two
|
213
226
|
others to represent its size.
|
214
227
|
*/
|
@@ -218,6 +231,7 @@ void Init_ray_rect() {
|
|
218
231
|
|
219
232
|
rb_define_alloc_func(ray_cRect, ray_alloc_rect);
|
220
233
|
rb_define_method(ray_cRect, "initialize", ray_init_rect, -1);
|
234
|
+
rb_define_method(ray_cRect, "initialize_copy", ray_init_rect_copy, 1);
|
221
235
|
|
222
236
|
rb_define_method(ray_cRect, "x", ray_rect_x, 0);
|
223
237
|
rb_define_method(ray_cRect, "y", ray_rect_y, 0);
|
data/ext/shader.cpp
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
#include "ray.hpp"
|
2
|
+
|
3
|
+
VALUE ray_cShader = Qnil;
|
4
|
+
|
5
|
+
void ray_free_shader(sf::Shader *shader) {
|
6
|
+
delete shader;
|
7
|
+
}
|
8
|
+
|
9
|
+
VALUE ray_alloc_shader(VALUE self) {
|
10
|
+
sf::Shader *shader = new sf::Shader;
|
11
|
+
return Data_Wrap_Struct(self, 0, ray_free_shader, shader);
|
12
|
+
}
|
13
|
+
|
14
|
+
sf::Shader *ray_rb2shader(VALUE self) {
|
15
|
+
if (!RAY_IS_A(self, ray_cShader)) {
|
16
|
+
rb_raise(rb_eTypeError, "Can't convert %s into Ray::Shader",
|
17
|
+
RAY_OBJ_CLASSNAME(self));
|
18
|
+
}
|
19
|
+
|
20
|
+
sf::Shader *shader = NULL;
|
21
|
+
Data_Get_Struct(self, sf::Shader, shader);
|
22
|
+
|
23
|
+
return shader;
|
24
|
+
}
|
25
|
+
|
26
|
+
/*
|
27
|
+
@return [true, false] True if it is possible to use shaders.
|
28
|
+
*/
|
29
|
+
VALUE ray_shader_available(VALUE self) {
|
30
|
+
return sf::Shader::IsAvailable() ? Qtrue : Qfalse;
|
31
|
+
}
|
32
|
+
|
33
|
+
/*
|
34
|
+
@overload initialize(filename_or_io)
|
35
|
+
Creates a new Shader with the source code found
|
36
|
+
in a file or in an IO object.
|
37
|
+
|
38
|
+
@example
|
39
|
+
shader = Ray::Shader.new StringIO.new(<<-SHADER)
|
40
|
+
// Code of the shader
|
41
|
+
SHADER
|
42
|
+
*/
|
43
|
+
VALUE ray_init_shader(VALUE self, VALUE argument) {
|
44
|
+
sf::Shader *shader = ray_rb2shader(self);
|
45
|
+
|
46
|
+
if (RAY_IS_A(argument, rb_cString)) {
|
47
|
+
if (!shader->LoadFromFile(StringValuePtr(argument)))
|
48
|
+
rb_raise(rb_eRuntimeError, "Couldn't load the shader");
|
49
|
+
}
|
50
|
+
else if (rb_respond_to(argument, RAY_METH("read"))) {
|
51
|
+
VALUE string = rb_funcall2(argument, RAY_METH("read"), 0, NULL);
|
52
|
+
char *c_string = StringValuePtr(string);
|
53
|
+
|
54
|
+
if (!shader->LoadFromMemory(c_string))
|
55
|
+
rb_raise(rb_eRuntimeError, "Couldn't load the shader");
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
rb_raise(rb_eArgError, "Can't convert %s into String",
|
59
|
+
RAY_OBJ_CLASSNAME(argument));
|
60
|
+
}
|
61
|
+
|
62
|
+
return self;
|
63
|
+
}
|
64
|
+
|
65
|
+
/*
|
66
|
+
@overload []=(name, argument)
|
67
|
+
Sets one of the variables of the shader.
|
68
|
+
argument can be:
|
69
|
+
- a float
|
70
|
+
- an array of 1, 2, 3, or 4 floats (for vectors)
|
71
|
+
- a Vector2 or Vector3
|
72
|
+
- an image, or :current which is a magic value to set a
|
73
|
+
texture to the current one.
|
74
|
+
*/
|
75
|
+
VALUE ray_shader_set(VALUE self, VALUE param, VALUE arg) {
|
76
|
+
rb_check_frozen(self);
|
77
|
+
|
78
|
+
sf::Shader *shader = ray_rb2shader(self);
|
79
|
+
char *name = StringValuePtr(param);
|
80
|
+
|
81
|
+
if (RAY_IS_A(arg, rb_cArray)) {
|
82
|
+
switch (RARRAY_LEN(arg)) {
|
83
|
+
case 1:
|
84
|
+
shader->SetParameter(name, NUM2DBL(rb_ary_entry(arg, 0)));
|
85
|
+
break;
|
86
|
+
case 2:
|
87
|
+
shader->SetParameter(name, NUM2DBL(rb_ary_entry(arg, 0)),
|
88
|
+
NUM2DBL(rb_ary_entry(arg, 1)));
|
89
|
+
break;
|
90
|
+
case 3:
|
91
|
+
shader->SetParameter(name, NUM2DBL(rb_ary_entry(arg, 0)),
|
92
|
+
NUM2DBL(rb_ary_entry(arg, 1)),
|
93
|
+
NUM2DBL(rb_ary_entry(arg, 2)));
|
94
|
+
break;
|
95
|
+
case 4:
|
96
|
+
shader->SetParameter(name, NUM2DBL(rb_ary_entry(arg, 0)),
|
97
|
+
NUM2DBL(rb_ary_entry(arg, 1)),
|
98
|
+
NUM2DBL(rb_ary_entry(arg, 2)),
|
99
|
+
NUM2DBL(rb_ary_entry(arg, 3)));
|
100
|
+
break;
|
101
|
+
default:
|
102
|
+
rb_raise(rb_eArgError, "Can't set vectors of %ld components",
|
103
|
+
RARRAY_LEN(arg));
|
104
|
+
break;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
else {
|
108
|
+
if (RAY_IS_A(arg, ray_cImage)) {
|
109
|
+
ray_image *img = ray_rb2image(arg);
|
110
|
+
if (img->is_image())
|
111
|
+
shader->SetTexture(name, img->image());
|
112
|
+
else
|
113
|
+
rb_raise(rb_eArgError, "Can't set the screen as a texture");
|
114
|
+
}
|
115
|
+
else if (arg == RAY_SYM("current"))
|
116
|
+
shader->SetTexture(name, sf::Shader::CurrentTexture);
|
117
|
+
else if (RAY_IS_A(arg, ray_cVector2))
|
118
|
+
shader->SetParameter(name, ray_convert_to_vector2(arg));
|
119
|
+
else if (RAY_IS_A(arg, ray_cVector3))
|
120
|
+
shader->SetParameter(name, ray_convert_to_vector3(arg));
|
121
|
+
else
|
122
|
+
shader->SetParameter(name, NUM2DBL(arg));
|
123
|
+
}
|
124
|
+
|
125
|
+
return arg;
|
126
|
+
}
|
127
|
+
|
128
|
+
VALUE ray_shader_ensure_unbind(VALUE self) {
|
129
|
+
ray_rb2shader(self)->Unbind();
|
130
|
+
return self;
|
131
|
+
}
|
132
|
+
|
133
|
+
/*
|
134
|
+
Binds the shader (for custom OpenGL drawing).
|
135
|
+
If a block is given, it is executed. The shader is then unbound.
|
136
|
+
*/
|
137
|
+
VALUE ray_shader_bind(VALUE self) {
|
138
|
+
ray_rb2shader(self)->Bind();
|
139
|
+
|
140
|
+
if (rb_block_given_p())
|
141
|
+
rb_ensure(rb_yield, Qnil, ray_shader_ensure_unbind, self);
|
142
|
+
|
143
|
+
return self;
|
144
|
+
}
|
145
|
+
|
146
|
+
/* Unbinds the shader (useful when doing custom OpenGL drawing) */
|
147
|
+
VALUE ray_shader_unbind(VALUE self) {
|
148
|
+
return ray_shader_ensure_unbind(self);
|
149
|
+
}
|
150
|
+
|
151
|
+
/*
|
152
|
+
Document-class: Ray::Shader
|
153
|
+
|
154
|
+
Class used to load OpenGL pixel shaders, which are written
|
155
|
+
in the GLSL language (a C-like language).
|
156
|
+
*/
|
157
|
+
|
158
|
+
void Init_ray_shader() {
|
159
|
+
ray_cShader = rb_define_class_under(ray_mRay, "Shader", rb_cObject);
|
160
|
+
rb_define_alloc_func(ray_cShader, ray_alloc_shader);
|
161
|
+
rb_define_method(ray_cShader, "initialize", ray_init_shader, 1);
|
162
|
+
|
163
|
+
rb_define_singleton_method(ray_cShader, "available?", ray_shader_available, 0);
|
164
|
+
|
165
|
+
rb_define_method(ray_cShader, "[]=", ray_shader_set, 2);
|
166
|
+
|
167
|
+
rb_define_method(ray_cShader, "bind", ray_shader_bind, 0);
|
168
|
+
rb_define_method(ray_cShader, "unbind", ray_shader_unbind, 0);
|
169
|
+
}
|
data/ext/shape.cpp
ADDED
@@ -0,0 +1,409 @@
|
|
1
|
+
#include "ray.hpp"
|
2
|
+
|
3
|
+
VALUE ray_cShape = Qnil;
|
4
|
+
|
5
|
+
void ray_free_shape(sf::Shape *shape) {
|
6
|
+
delete shape;
|
7
|
+
}
|
8
|
+
|
9
|
+
VALUE ray_alloc_shape(VALUE self) {
|
10
|
+
sf::Shape *shape = new sf::Shape;
|
11
|
+
return Data_Wrap_Struct(self, 0, ray_free_shape, shape);
|
12
|
+
}
|
13
|
+
|
14
|
+
sf::Shape *ray_rb2shape(VALUE self) {
|
15
|
+
if (!RAY_IS_A(self, ray_cShape)) {
|
16
|
+
rb_raise(rb_eTypeError, "Can't convert %s into Ray::Shape",
|
17
|
+
RAY_OBJ_CLASSNAME(self));
|
18
|
+
}
|
19
|
+
|
20
|
+
sf::Shape *shape = NULL;
|
21
|
+
Data_Get_Struct(self, sf::Shape, shape);
|
22
|
+
|
23
|
+
return shape;
|
24
|
+
}
|
25
|
+
|
26
|
+
VALUE ray_shape2rb(const sf::Shape &shape) {
|
27
|
+
sf::Shape *copy = new sf::Shape(shape);
|
28
|
+
return Data_Wrap_Struct(ray_cShape, 0, ray_free_shape, copy);
|
29
|
+
}
|
30
|
+
|
31
|
+
VALUE ray_init_shape_copy(VALUE self, VALUE other) {
|
32
|
+
*ray_rb2shape(self) = *ray_rb2shape(other);
|
33
|
+
return self;
|
34
|
+
}
|
35
|
+
|
36
|
+
/*
|
37
|
+
@overload line(from, to, size = 1.0, color = Ray::Color.white,
|
38
|
+
outline_width = 0.0, outline_color = Ray::Color.none)
|
39
|
+
@param [Ray::Vector2, #to_vector2] from First point of the line
|
40
|
+
@param [Ray::Vector2, #to_vector2] to Last point of the line
|
41
|
+
|
42
|
+
@param [Float] size Width of the line
|
43
|
+
@param [Color] color Color of the line
|
44
|
+
|
45
|
+
@param [Float] outline_width Width of the outline
|
46
|
+
@param [Color] outline_color Color of the outline
|
47
|
+
|
48
|
+
@return [Shape] a line.
|
49
|
+
*/
|
50
|
+
VALUE ray_shape_line(int argc, VALUE *argv, VALUE self) {
|
51
|
+
VALUE from, to, size;
|
52
|
+
VALUE color;
|
53
|
+
VALUE outline_width, outline_color;
|
54
|
+
|
55
|
+
rb_scan_args(argc, argv, "24", &from, &to, &size, &color, &outline_width,
|
56
|
+
&outline_color);
|
57
|
+
|
58
|
+
ray_vector2 from_point = ray_convert_to_vector2(from);
|
59
|
+
ray_vector2 to_point = ray_convert_to_vector2(to);
|
60
|
+
|
61
|
+
float c_size = 1.0f;
|
62
|
+
if (!NIL_P(size)) c_size = (float)NUM2DBL(size);
|
63
|
+
|
64
|
+
float c_outline_width = 1.0f;
|
65
|
+
if (!NIL_P(outline_width)) c_outline_width = (float)NUM2DBL(outline_width);
|
66
|
+
|
67
|
+
ray_color sf_color(0, 0, 0);
|
68
|
+
if (!NIL_P(color)) sf_color = ray_rb2col(color);
|
69
|
+
|
70
|
+
ray_color sf_outline_color(0, 0, 0);
|
71
|
+
if (!NIL_P(outline_color)) sf_outline_color = ray_rb2col(outline_color);
|
72
|
+
|
73
|
+
return ray_shape2rb(sf::Shape::Line(from_point, to_point,
|
74
|
+
c_size, sf_color,
|
75
|
+
c_outline_width, sf_outline_color));
|
76
|
+
}
|
77
|
+
|
78
|
+
/*
|
79
|
+
@overload rectangle(rect, color = Ray::Color.white,
|
80
|
+
outline_width = 0.0, outline_color = Ray::Color.none)
|
81
|
+
@param [Ray::Rect, Array<Integer>] Rect used by this shape
|
82
|
+
@param [Color] color Color of the rect
|
83
|
+
@param [Float] outline_width (See Shape.line)
|
84
|
+
@param [Color] outline_color (See Shape.line)
|
85
|
+
|
86
|
+
@return [Shape] A rectangle.
|
87
|
+
*/
|
88
|
+
VALUE ray_shape_rectangle(int argc, VALUE *argv, VALUE self) {
|
89
|
+
VALUE rect, color, outline_width, outline_color;
|
90
|
+
rb_scan_args(argc, argv, "13", &rect, &color, &outline_width, &outline_color);
|
91
|
+
|
92
|
+
ray_rect c_rect = ray_convert_to_rect(rect);
|
93
|
+
|
94
|
+
ray_color c_color = ray_rb2col(color);
|
95
|
+
ray_color c_outline_color(0, 0, 0);
|
96
|
+
if (!NIL_P(outline_color))
|
97
|
+
c_outline_color = ray_rb2col(outline_color);
|
98
|
+
|
99
|
+
float c_outline_width = 0;
|
100
|
+
if (!NIL_P(outline_width))
|
101
|
+
c_outline_width = (float)NUM2DBL(outline_width);
|
102
|
+
|
103
|
+
return ray_shape2rb(sf::Shape::Rectangle(c_rect.Left, c_rect.Top,
|
104
|
+
c_rect.Width, c_rect.Height,
|
105
|
+
c_color, c_outline_width,
|
106
|
+
c_outline_color));
|
107
|
+
}
|
108
|
+
|
109
|
+
/*
|
110
|
+
@overload circle(center, radius, color = Ray::Color.white,
|
111
|
+
outline_width = 0.0, outline_color = Ray::Color.none)
|
112
|
+
@param [Ray::Vector2, #to_vector2] center Center of the circle
|
113
|
+
@param [Float] radius Radius of the circle.
|
114
|
+
@param [Color] color Color of the cirlce.
|
115
|
+
|
116
|
+
@param [Float] outline_width (See Shape.line)
|
117
|
+
@param [Color] outline_color (See Shape.line)
|
118
|
+
|
119
|
+
@return [Shape] A circle.
|
120
|
+
*/
|
121
|
+
VALUE ray_shape_circle(int argc, VALUE *argv, VALUE self) {
|
122
|
+
VALUE center, radius, color, outline_width, outline_color;
|
123
|
+
rb_scan_args(argc, argv, "23", ¢er, &radius, &color,
|
124
|
+
&outline_width, &outline_color);
|
125
|
+
|
126
|
+
ray_vector2 c_center = ray_convert_to_vector2(center);
|
127
|
+
float c_radius = (float)NUM2DBL(radius);
|
128
|
+
|
129
|
+
ray_color c_color = ray_rb2col(color);
|
130
|
+
ray_color c_outline_color(0, 0, 0);
|
131
|
+
if (!NIL_P(outline_color))
|
132
|
+
c_outline_color = ray_rb2col(outline_color);
|
133
|
+
|
134
|
+
float c_outline_width = 0;
|
135
|
+
if (!NIL_P(outline_width))
|
136
|
+
c_outline_width = (float)NUM2DBL(outline_width);
|
137
|
+
|
138
|
+
return ray_shape2rb(sf::Shape::Circle(c_center, c_radius,
|
139
|
+
c_color, c_outline_width,
|
140
|
+
c_outline_color));
|
141
|
+
}
|
142
|
+
|
143
|
+
/* @return [Ray::Vector2] Position of the shape */
|
144
|
+
VALUE ray_shape_pos(VALUE self) {
|
145
|
+
return ray_vector2_to_rb(ray_rb2shape(self)->GetPosition());
|
146
|
+
}
|
147
|
+
|
148
|
+
/* Sets the position of the shape */
|
149
|
+
VALUE ray_shape_set_pos(VALUE self, VALUE pos) {
|
150
|
+
rb_check_frozen(self);
|
151
|
+
ray_rb2shape(self)->SetPosition(ray_convert_to_vector2(pos));
|
152
|
+
return pos;
|
153
|
+
}
|
154
|
+
|
155
|
+
/*
|
156
|
+
@overload add_point(pos, color = Ray::Color.white, outline_color = Ray::Color.none)
|
157
|
+
Adds a new point to the shape.
|
158
|
+
|
159
|
+
@param [Ray::Vector2, #to_vector2] Position of the point.
|
160
|
+
@param [Color] color Color of the shape at that point.
|
161
|
+
@param [Color] outline_color Color of the outline at that point.
|
162
|
+
*/
|
163
|
+
VALUE ray_shape_add_point(int argc, VALUE *argv, VALUE self) {
|
164
|
+
rb_check_frozen(self);
|
165
|
+
|
166
|
+
sf::Shape *shape = ray_rb2shape(self);
|
167
|
+
|
168
|
+
VALUE rb_pos, rb_color, rb_outline_color;
|
169
|
+
|
170
|
+
ray_vector2 pos;
|
171
|
+
ray_color color(255, 255, 255), outline_color(255, 255, 255);
|
172
|
+
|
173
|
+
rb_scan_args(argc, argv, "12", &rb_pos, &rb_color, &rb_outline_color);
|
174
|
+
|
175
|
+
pos = ray_convert_to_vector2(rb_pos);
|
176
|
+
|
177
|
+
if (!NIL_P(rb_color))
|
178
|
+
color = ray_rb2col(rb_color);
|
179
|
+
|
180
|
+
if (!NIL_P(rb_outline_color))
|
181
|
+
outline_color = ray_rb2col(rb_outline_color);
|
182
|
+
|
183
|
+
shape->AddPoint(pos, color, outline_color);
|
184
|
+
return self;
|
185
|
+
}
|
186
|
+
|
187
|
+
/*
|
188
|
+
@return [Integer] the amount of points in this shape.
|
189
|
+
*/
|
190
|
+
VALUE ray_shape_point_count(VALUE self) {
|
191
|
+
sf::Shape *shape = ray_rb2shape(self);
|
192
|
+
return INT2FIX(shape->GetPointsCount());
|
193
|
+
}
|
194
|
+
|
195
|
+
/*
|
196
|
+
Sets whether the shape should be filled. Defaults to true.
|
197
|
+
*/
|
198
|
+
VALUE ray_shape_set_filled(VALUE self, VALUE val) {
|
199
|
+
rb_check_frozen(self);
|
200
|
+
|
201
|
+
sf::Shape *shape = ray_rb2shape(self);
|
202
|
+
shape->EnableFill(RTEST(val));
|
203
|
+
|
204
|
+
return val;
|
205
|
+
}
|
206
|
+
|
207
|
+
/*
|
208
|
+
Sets whether the outline of the shape should be drawn. Defaults to true.
|
209
|
+
*/
|
210
|
+
VALUE ray_shape_set_outlined(VALUE self, VALUE val) {
|
211
|
+
rb_check_frozen(self);
|
212
|
+
|
213
|
+
sf::Shape *shape = ray_rb2shape(self);
|
214
|
+
shape->EnableOutline(RTEST(val));
|
215
|
+
|
216
|
+
return val;
|
217
|
+
}
|
218
|
+
|
219
|
+
/*
|
220
|
+
@overload set_position_of(id, pos)
|
221
|
+
Changes the position of a point.
|
222
|
+
|
223
|
+
@param [Integer] id Id of the point to modify.
|
224
|
+
@param [Ray::Vector2, #to_vector2] pos New position of that point.
|
225
|
+
*/
|
226
|
+
VALUE ray_shape_set_position_of(VALUE self, VALUE id, VALUE pos) {
|
227
|
+
rb_check_frozen(self);
|
228
|
+
|
229
|
+
sf::Shape *shape = ray_rb2shape(self);
|
230
|
+
|
231
|
+
unsigned int c_id = NUM2UINT(id);
|
232
|
+
if (c_id >= shape->GetPointsCount())
|
233
|
+
rb_raise(rb_eArgError, "%d out of bounds", c_id);
|
234
|
+
|
235
|
+
shape->SetPointPosition(c_id, ray_convert_to_vector2(pos));
|
236
|
+
|
237
|
+
return pos;
|
238
|
+
}
|
239
|
+
|
240
|
+
/*
|
241
|
+
@overload set_color_of(id, col)
|
242
|
+
Changes the color of a point.
|
243
|
+
|
244
|
+
@param [Integer] id Id of the point to modify.
|
245
|
+
@param [Color] col New color of that point.
|
246
|
+
*/
|
247
|
+
VALUE ray_shape_set_color_of(VALUE self, VALUE id, VALUE col) {
|
248
|
+
rb_check_frozen(self);
|
249
|
+
|
250
|
+
sf::Shape *shape = ray_rb2shape(self);
|
251
|
+
|
252
|
+
unsigned int c_id = NUM2UINT(id);
|
253
|
+
if (c_id >= shape->GetPointsCount())
|
254
|
+
rb_raise(rb_eArgError, "%d out of bounds", c_id);
|
255
|
+
|
256
|
+
shape->SetPointColor(c_id, ray_rb2col(col));
|
257
|
+
return col;
|
258
|
+
}
|
259
|
+
|
260
|
+
/*
|
261
|
+
@overload set_outline_of(id, col)
|
262
|
+
Changes the outline color of a point.
|
263
|
+
|
264
|
+
@param [Integer] id Id of the point to modify.
|
265
|
+
@param [Color] col New outline color of that point.
|
266
|
+
*/
|
267
|
+
VALUE ray_shape_set_outline_of(VALUE self, VALUE id, VALUE col) {
|
268
|
+
rb_check_frozen(self);
|
269
|
+
|
270
|
+
sf::Shape *shape = ray_rb2shape(self);
|
271
|
+
|
272
|
+
unsigned int c_id = NUM2UINT(id);
|
273
|
+
if (c_id >= shape->GetPointsCount())
|
274
|
+
rb_raise(rb_eArgError, "%d out of bounds", c_id);
|
275
|
+
|
276
|
+
shape->SetPointOutlineColor(c_id, ray_rb2col(col));
|
277
|
+
return col;
|
278
|
+
}
|
279
|
+
|
280
|
+
/*
|
281
|
+
Sets the width of the outline of this shape.
|
282
|
+
*/
|
283
|
+
VALUE ray_shape_set_outline_width(VALUE self, VALUE width) {
|
284
|
+
rb_check_frozen(self);
|
285
|
+
|
286
|
+
sf::Shape *shape = ray_rb2shape(self);
|
287
|
+
shape->SetOutlineThickness(NUM2INT(width));
|
288
|
+
|
289
|
+
return width;
|
290
|
+
}
|
291
|
+
|
292
|
+
/*
|
293
|
+
@overload position_of(id)
|
294
|
+
@return [Ray::Vector2] Position of that point.
|
295
|
+
*/
|
296
|
+
VALUE ray_shape_position_of(VALUE self, VALUE id) {
|
297
|
+
sf::Shape *shape = ray_rb2shape(self);
|
298
|
+
|
299
|
+
unsigned int c_id = NUM2UINT(id);
|
300
|
+
if (c_id >= shape->GetPointsCount())
|
301
|
+
return Qnil;
|
302
|
+
|
303
|
+
sf::Vector2f point = shape->GetPointPosition(c_id);
|
304
|
+
return ray_vector2_to_rb(point);
|
305
|
+
}
|
306
|
+
|
307
|
+
/*
|
308
|
+
@overload color_of(id)
|
309
|
+
@return [Color] Color of that point.
|
310
|
+
*/
|
311
|
+
VALUE ray_shape_color_of(VALUE self, VALUE id) {
|
312
|
+
sf::Shape *shape = ray_rb2shape(self);
|
313
|
+
|
314
|
+
unsigned int c_id = NUM2UINT(id);
|
315
|
+
if (c_id >= shape->GetPointsCount())
|
316
|
+
return Qnil;
|
317
|
+
|
318
|
+
return ray_col2rb(shape->GetPointColor(c_id));
|
319
|
+
}
|
320
|
+
|
321
|
+
/*
|
322
|
+
@overload outline_of(id)
|
323
|
+
@return [Color] Outline of that point.
|
324
|
+
*/
|
325
|
+
VALUE ray_shape_outline_of(VALUE self, VALUE id) {
|
326
|
+
sf::Shape *shape = ray_rb2shape(self);
|
327
|
+
|
328
|
+
unsigned int c_id = NUM2UINT(id);
|
329
|
+
if (c_id >= shape->GetPointsCount())
|
330
|
+
return Qnil;
|
331
|
+
|
332
|
+
return ray_col2rb(shape->GetPointOutlineColor(c_id));
|
333
|
+
}
|
334
|
+
|
335
|
+
/* @return [Float] Outline width of this shape */
|
336
|
+
VALUE ray_shape_outline_width(VALUE self) {
|
337
|
+
sf::Shape *shape = ray_rb2shape(self);
|
338
|
+
return INT2FIX((int)(shape->GetOutlineThickness()));
|
339
|
+
}
|
340
|
+
|
341
|
+
/* @return [Float] Rotation applied to this shape when it is drawn (in degrees) */
|
342
|
+
VALUE ray_shape_angle(VALUE self) {
|
343
|
+
sf::Shape *shape = ray_rb2shape(self);
|
344
|
+
return rb_float_new(shape->GetRotation());
|
345
|
+
}
|
346
|
+
|
347
|
+
/* Sets the rotation applied to this object when it is drawn (in degrees) */
|
348
|
+
VALUE ray_shape_set_angle(VALUE self, VALUE angle) {
|
349
|
+
rb_check_frozen(self);
|
350
|
+
|
351
|
+
sf::Shape *shape = ray_rb2shape(self);
|
352
|
+
shape->SetRotation((float)NUM2DBL(angle));
|
353
|
+
|
354
|
+
return angle;
|
355
|
+
}
|
356
|
+
|
357
|
+
/* @return [Ray::Vector2] scale for width and height. */
|
358
|
+
VALUE ray_shape_scale(VALUE self) {
|
359
|
+
sf::Shape *shape = ray_rb2shape(self);
|
360
|
+
sf::Vector2f scale(shape->GetScale());
|
361
|
+
|
362
|
+
return ray_vector2_to_rb(scale);
|
363
|
+
}
|
364
|
+
|
365
|
+
/* Sets scale for width and height, using a vector. */
|
366
|
+
VALUE ray_shape_set_scale(VALUE self, VALUE val) {
|
367
|
+
rb_check_frozen(self);
|
368
|
+
|
369
|
+
sf::Shape *shape = ray_rb2shape(self);
|
370
|
+
shape->SetScale(ray_convert_to_vector2(val));
|
371
|
+
|
372
|
+
return val;
|
373
|
+
}
|
374
|
+
|
375
|
+
void Init_ray_shape() {
|
376
|
+
ray_cShape = rb_define_class_under(ray_mRay, "Shape", rb_cObject);
|
377
|
+
rb_define_alloc_func(ray_cShape, ray_alloc_shape);
|
378
|
+
rb_define_method(ray_cShape, "initialize_copy", ray_init_shape_copy, 1);
|
379
|
+
|
380
|
+
rb_define_singleton_method(ray_cShape, "line", ray_shape_line, -1);
|
381
|
+
rb_define_singleton_method(ray_cShape, "rectangle", ray_shape_rectangle, -1);
|
382
|
+
rb_define_singleton_method(ray_cShape, "circle", ray_shape_circle, -1);
|
383
|
+
|
384
|
+
rb_define_method(ray_cShape, "pos", ray_shape_pos, 0);
|
385
|
+
rb_define_method(ray_cShape, "pos=", ray_shape_set_pos, 1);
|
386
|
+
|
387
|
+
rb_define_method(ray_cShape, "add_point", ray_shape_add_point, -1);
|
388
|
+
rb_define_method(ray_cShape, "point_count", ray_shape_point_count, 0);
|
389
|
+
|
390
|
+
rb_define_method(ray_cShape, "filled=", ray_shape_set_filled, 1);
|
391
|
+
rb_define_method(ray_cShape, "outlined=", ray_shape_set_outlined, 1);
|
392
|
+
|
393
|
+
rb_define_method(ray_cShape, "outline_width=", ray_shape_set_outline_width, 1);
|
394
|
+
rb_define_method(ray_cShape, "outline_width", ray_shape_outline_width, 0);
|
395
|
+
|
396
|
+
rb_define_method(ray_cShape, "set_position_of", ray_shape_set_position_of, 2);
|
397
|
+
rb_define_method(ray_cShape, "set_color_of", ray_shape_set_color_of, 2);
|
398
|
+
rb_define_method(ray_cShape, "set_outline_of", ray_shape_set_outline_of, 2);
|
399
|
+
|
400
|
+
rb_define_method(ray_cShape, "position_of", ray_shape_position_of, 1);
|
401
|
+
rb_define_method(ray_cShape, "color_of", ray_shape_color_of, 1);
|
402
|
+
rb_define_method(ray_cShape, "outline_of", ray_shape_outline_of, 1);
|
403
|
+
|
404
|
+
rb_define_method(ray_cShape, "angle", ray_shape_angle, 0);
|
405
|
+
rb_define_method(ray_cShape, "angle=", ray_shape_set_angle, 1);
|
406
|
+
|
407
|
+
rb_define_method(ray_cShape, "scale", ray_shape_scale, 0);
|
408
|
+
rb_define_method(ray_cShape, "scale=", ray_shape_set_scale, 1);
|
409
|
+
}
|