sfml3-rb 0.2.2 → 0.3.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.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/CHANGELOG.md +43 -17
- data/README.md +97 -29
- data/ext/audio/audio_enums.c +58 -20
- data/ext/audio/listener.c +89 -6
- data/ext/audio/music.c +206 -5
- data/ext/audio/sound.c +175 -5
- data/ext/audio/sound_buffer.c +189 -47
- data/ext/audio/sound_buffer_recorder.c +83 -16
- data/ext/audio/sound_recorder.c +172 -52
- data/ext/audio/sound_source_cone.c +108 -29
- data/ext/audio/sound_stream.c +178 -5
- data/ext/core/exceptions.c +10 -8
- data/ext/core/unicode.c +12 -2
- data/ext/ext.c +4 -0
- data/ext/graphics/blend_mode.c +203 -53
- data/ext/graphics/circle.c +271 -4
- data/ext/graphics/color.c +240 -90
- data/ext/graphics/drawable.c +15 -4
- data/ext/graphics/font.c +138 -25
- data/ext/graphics/glyph.c +31 -8
- data/ext/graphics/image.c +180 -37
- data/ext/graphics/polygon.c +293 -26
- data/ext/graphics/rect.c +211 -54
- data/ext/graphics/rectangle.c +279 -26
- data/ext/graphics/render_state.c +116 -2
- data/ext/graphics/render_texture.c +163 -2
- data/ext/graphics/shader.c +283 -17
- data/ext/graphics/shape.c +252 -26
- data/ext/graphics/sprite.c +216 -25
- data/ext/graphics/stencil_mode.c +148 -39
- data/ext/graphics/target.c +67 -22
- data/ext/graphics/target.h +15 -15
- data/ext/graphics/text.c +306 -6
- data/ext/graphics/texture.c +257 -3
- data/ext/graphics/transform.c +178 -5
- data/ext/graphics/transformable.c +126 -2
- data/ext/graphics/vertex.c +79 -2
- data/ext/graphics/vertex_array.c +128 -16
- data/ext/graphics/vertex_buffer.c +124 -2
- data/ext/graphics/view.c +130 -2
- data/ext/network/ftp.c +249 -10
- data/ext/network/http.c +156 -38
- data/ext/network/ip_address.c +107 -26
- data/ext/network/network_enums.c +248 -141
- data/ext/network/packet.c +273 -39
- data/ext/network/socket_selector.c +91 -19
- data/ext/network/tcp_listener.c +75 -16
- data/ext/network/tcp_socket.c +128 -25
- data/ext/network/udp_socket.c +122 -26
- data/ext/ports.rb +7 -0
- data/ext/system/buffer.c +41 -12
- data/ext/system/clock.c +68 -9
- data/ext/system/input_stream.c +94 -42
- data/ext/system/sleep.c +10 -2
- data/ext/system/time.c +172 -34
- data/ext/system/vec2.c +156 -35
- data/ext/system/vec3.c +166 -35
- data/ext/window/clipboard.c +47 -17
- data/ext/window/context.c +59 -9
- data/ext/window/context_settings.c +116 -38
- data/ext/window/cursor.c +39 -9
- data/ext/window/event.c +163 -42
- data/ext/window/joystick.c +69 -3
- data/ext/window/keyboard.c +168 -116
- data/ext/window/mouse.c +36 -2
- data/ext/window/sensor.c +28 -2
- data/ext/window/touch.c +20 -2
- data/ext/window/video_mode.c +90 -19
- data/ext/window/vulkan.c +34 -6
- data/ext/window/window.c +340 -16
- data/lib/sfml/version.rb +1 -1
- data/sig/audio/audio_enums.rbs +30 -0
- data/sig/audio/listener.rbs +16 -0
- data/sig/audio/music.rbs +56 -0
- data/sig/audio/sound.rbs +51 -0
- data/sig/audio/sound_buffer.rbs +17 -0
- data/sig/audio/sound_buffer_recorder.rbs +14 -0
- data/sig/audio/sound_recorder.rbs +17 -0
- data/sig/audio/sound_source_cone.rbs +14 -0
- data/sig/audio/sound_stream.rbs +51 -0
- data/sig/graphics/blend_mode.rbs +29 -0
- data/sig/graphics/circle.rbs +44 -0
- data/sig/graphics/color.rbs +39 -0
- data/sig/graphics/drawable.rbs +5 -0
- data/sig/graphics/font.rbs +20 -0
- data/sig/graphics/glyph.rbs +7 -0
- data/sig/graphics/image.rbs +22 -0
- data/sig/graphics/polygon.rbs +42 -0
- data/sig/graphics/rect.rbs +33 -0
- data/sig/graphics/rectangle.rbs +42 -0
- data/sig/graphics/render_state.rbs +21 -0
- data/sig/graphics/render_texture.rbs +37 -0
- data/sig/graphics/shader.rbs +39 -0
- data/sig/graphics/shape.rbs +38 -0
- data/sig/graphics/sprite.rbs +34 -0
- data/sig/graphics/stencil_mode.rbs +18 -0
- data/sig/graphics/target.rbs +10 -0
- data/sig/graphics/text.rbs +48 -0
- data/sig/graphics/texture.rbs +34 -0
- data/sig/graphics/transform.rbs +37 -0
- data/sig/graphics/transformable.rbs +25 -0
- data/sig/graphics/vertex.rbs +17 -0
- data/sig/graphics/vertex_array.rbs +17 -0
- data/sig/graphics/vertex_buffer.rbs +22 -0
- data/sig/graphics/view.rbs +24 -0
- data/sig/network/ftp.rbs +46 -0
- data/sig/network/http.rbs +27 -0
- data/sig/network/ip_address.rbs +22 -0
- data/sig/network/network_enums.rbs +95 -0
- data/sig/network/packet.rbs +40 -0
- data/sig/network/socket_selector.rbs +14 -0
- data/sig/network/tcp_listener.rbs +13 -0
- data/sig/network/tcp_socket.rbs +18 -0
- data/sig/network/udp_socket.rbs +17 -0
- data/sig/system/buffer.rbs +11 -0
- data/sig/system/clock.rbs +13 -0
- data/sig/system/input_stream.rbs +7 -0
- data/sig/system/sleep.rbs +3 -0
- data/sig/system/time.rbs +28 -0
- data/sig/system/vec2.rbs +26 -0
- data/sig/system/vec3.rbs +27 -0
- data/sig/window/clipboard.rbs +8 -0
- data/sig/window/context.rbs +11 -0
- data/sig/window/context_settings.rbs +20 -0
- data/sig/window/cursor.rbs +6 -0
- data/sig/window/event.rbs +20 -0
- data/sig/window/joystick.rbs +15 -0
- data/sig/window/keyboard.rbs +10 -0
- data/sig/window/mouse.rbs +9 -0
- data/sig/window/sensor.rbs +8 -0
- data/sig/window/touch.rbs +6 -0
- data/sig/window/video_mode.rbs +16 -0
- data/sig/window/vulkan.rbs +7 -0
- data/sig/window/window.rbs +57 -0
- metadata +66 -2
data/ext/graphics/circle.c
CHANGED
|
@@ -61,6 +61,13 @@ static VALUE Circle_wrap(VALUE klass, sfCircleShape* shape) {
|
|
|
61
61
|
return TypedData_Wrap_Struct(klass, &Circle_data_type, ptr);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/* call-seq:
|
|
65
|
+
* Circle.new(radius = 0) -> Circle
|
|
66
|
+
*
|
|
67
|
+
* Creates a circle shape with the given +radius+ (0 by default).
|
|
68
|
+
*
|
|
69
|
+
* @return [Circle]
|
|
70
|
+
*/
|
|
64
71
|
static VALUE Circle_new(int argc, VALUE* argv, VALUE klass) {
|
|
65
72
|
VALUE rb_radius;
|
|
66
73
|
sfCircleShape* shape;
|
|
@@ -76,6 +83,12 @@ static VALUE Circle_new(int argc, VALUE* argv, VALUE klass) {
|
|
|
76
83
|
return Circle_wrap(klass, shape);
|
|
77
84
|
}
|
|
78
85
|
|
|
86
|
+
/* call-seq: copy -> Circle
|
|
87
|
+
*
|
|
88
|
+
* Returns a deep copy of the circle, including its texture reference.
|
|
89
|
+
*
|
|
90
|
+
* @return [Circle] an independent copy, including its texture reference
|
|
91
|
+
*/
|
|
79
92
|
static VALUE Circle_copy(VALUE self) {
|
|
80
93
|
Circle* ptr = Get_Circle(self);
|
|
81
94
|
VALUE copy = Circle_wrap(Get_Klass_Circle(), sfCircleShape_copy(ptr->shape));
|
|
@@ -90,102 +103,244 @@ static VALUE Circle_copy(VALUE self) {
|
|
|
90
103
|
return copy;
|
|
91
104
|
}
|
|
92
105
|
|
|
106
|
+
/* call-seq:
|
|
107
|
+
* fill_color=(value) -> Color
|
|
108
|
+
*
|
|
109
|
+
* Sets the shape's fill color.
|
|
110
|
+
*
|
|
111
|
+
* @return [Color] +value+
|
|
112
|
+
*/
|
|
93
113
|
static VALUE Circle_set_fill_color(VALUE self, VALUE rb_color) {
|
|
94
114
|
sfCircleShape_setFillColor(Get_Circle_Shape(self), color_from_rb(rb_color));
|
|
95
115
|
return rb_color;
|
|
96
116
|
}
|
|
97
117
|
|
|
118
|
+
/* call-seq: fill_color -> Color
|
|
119
|
+
*
|
|
120
|
+
* Returns the shape's fill color.
|
|
121
|
+
*
|
|
122
|
+
* @return [Color]
|
|
123
|
+
*/
|
|
98
124
|
static VALUE Circle_get_fill_color(VALUE self) {
|
|
99
125
|
return color_to_rb(sfCircleShape_getFillColor(Get_Circle_Shape(self)));
|
|
100
126
|
}
|
|
101
127
|
|
|
128
|
+
/* call-seq:
|
|
129
|
+
* outline_color=(value) -> Color
|
|
130
|
+
*
|
|
131
|
+
* Sets the shape's outline color.
|
|
132
|
+
*
|
|
133
|
+
* @return [Color] +value+
|
|
134
|
+
*/
|
|
102
135
|
static VALUE Circle_set_outline_color(VALUE self, VALUE rb_color) {
|
|
103
136
|
sfCircleShape_setOutlineColor(Get_Circle_Shape(self), color_from_rb(rb_color));
|
|
104
137
|
return rb_color;
|
|
105
138
|
}
|
|
106
139
|
|
|
140
|
+
/* call-seq: outline_color -> Color
|
|
141
|
+
*
|
|
142
|
+
* Returns the shape's outline color.
|
|
143
|
+
*
|
|
144
|
+
* @return [Color]
|
|
145
|
+
*/
|
|
107
146
|
static VALUE Circle_get_outline_color(VALUE self) {
|
|
108
147
|
return color_to_rb(sfCircleShape_getOutlineColor(Get_Circle_Shape(self)));
|
|
109
148
|
}
|
|
110
149
|
|
|
150
|
+
/* call-seq:
|
|
151
|
+
* outline_thickness=(value) -> Float
|
|
152
|
+
*
|
|
153
|
+
* Sets the shape's outline thickness.
|
|
154
|
+
*
|
|
155
|
+
* @return [Float] +value+
|
|
156
|
+
*/
|
|
111
157
|
static VALUE Circle_set_outline_thickness(VALUE self, VALUE rb_thickness) {
|
|
112
158
|
sfCircleShape_setOutlineThickness(Get_Circle_Shape(self), NUM2DBL(rb_thickness));
|
|
113
159
|
return rb_thickness;
|
|
114
160
|
}
|
|
115
161
|
|
|
162
|
+
/* call-seq: outline_thickness -> Float
|
|
163
|
+
*
|
|
164
|
+
* Returns the shape's outline thickness.
|
|
165
|
+
*
|
|
166
|
+
* @return [Float]
|
|
167
|
+
*/
|
|
116
168
|
static VALUE Circle_get_outline_thickness(VALUE self) {
|
|
117
169
|
return DBL2NUM(sfCircleShape_getOutlineThickness(Get_Circle_Shape(self)));
|
|
118
170
|
}
|
|
119
171
|
|
|
172
|
+
/* call-seq:
|
|
173
|
+
* radius=(value) -> Float
|
|
174
|
+
*
|
|
175
|
+
* Sets the circle's radius.
|
|
176
|
+
*
|
|
177
|
+
* @return [Float] +value+
|
|
178
|
+
*/
|
|
120
179
|
static VALUE Circle_set_radius(VALUE self, VALUE rb_radius) {
|
|
121
180
|
sfCircleShape_setRadius(Get_Circle_Shape(self), NUM2DBL(rb_radius));
|
|
122
181
|
return rb_radius;
|
|
123
182
|
}
|
|
124
183
|
|
|
184
|
+
/* call-seq:
|
|
185
|
+
* position=(value) -> Vector2
|
|
186
|
+
*
|
|
187
|
+
* Sets the object's position.
|
|
188
|
+
*
|
|
189
|
+
* @return [Vector2] +value+
|
|
190
|
+
*/
|
|
125
191
|
static VALUE Circle_set_position(VALUE self, VALUE rb_position) {
|
|
126
192
|
sfCircleShape_setPosition(Get_Circle_Shape(self), vec2f_from_rb(rb_position));
|
|
127
193
|
return rb_position;
|
|
128
194
|
}
|
|
129
195
|
|
|
196
|
+
/* call-seq:
|
|
197
|
+
* rotation=(value) -> Float
|
|
198
|
+
*
|
|
199
|
+
* Sets the object's rotation, in degrees.
|
|
200
|
+
*
|
|
201
|
+
* @return [Float] +value+
|
|
202
|
+
*/
|
|
130
203
|
static VALUE Circle_set_rotation(VALUE self, VALUE rb_angle) {
|
|
131
204
|
sfCircleShape_setRotation(Get_Circle_Shape(self), NUM2DBL(rb_angle));
|
|
132
205
|
return rb_angle;
|
|
133
206
|
}
|
|
134
207
|
|
|
208
|
+
/* call-seq:
|
|
209
|
+
* origin=(value) -> Vector2
|
|
210
|
+
*
|
|
211
|
+
* Sets the object's origin.
|
|
212
|
+
*
|
|
213
|
+
* @return [Vector2] +value+
|
|
214
|
+
*/
|
|
135
215
|
static VALUE Circle_set_origin(VALUE self, VALUE rb_origin) {
|
|
136
216
|
sfCircleShape_setOrigin(Get_Circle_Shape(self), vec2f_from_rb(rb_origin));
|
|
137
217
|
return rb_origin;
|
|
138
218
|
}
|
|
139
219
|
|
|
220
|
+
/* call-seq:
|
|
221
|
+
* scale=(value) -> Vector2
|
|
222
|
+
*
|
|
223
|
+
* Sets the object's scale factors.
|
|
224
|
+
*
|
|
225
|
+
* @return [Vector2] +value+
|
|
226
|
+
*/
|
|
140
227
|
static VALUE Circle_set_scale(VALUE self, VALUE rb_scale) {
|
|
141
228
|
sfCircleShape_setScale(Get_Circle_Shape(self), vec2f_from_rb(rb_scale));
|
|
142
229
|
return rb_scale;
|
|
143
230
|
}
|
|
144
231
|
|
|
232
|
+
/* call-seq: radius -> Float
|
|
233
|
+
*
|
|
234
|
+
* Returns the circle's radius.
|
|
235
|
+
*
|
|
236
|
+
* @return [Float]
|
|
237
|
+
*/
|
|
145
238
|
static VALUE Circle_get_radius(VALUE self) {
|
|
146
239
|
return DBL2NUM(sfCircleShape_getRadius(Get_Circle_Shape(self)));
|
|
147
240
|
}
|
|
148
241
|
|
|
242
|
+
/* call-seq: position -> Vector2
|
|
243
|
+
*
|
|
244
|
+
* Returns the object's position.
|
|
245
|
+
*
|
|
246
|
+
* @return [Vector2]
|
|
247
|
+
*/
|
|
149
248
|
static VALUE Circle_get_position(VALUE self) {
|
|
150
249
|
return vec2f_to_rb(sfCircleShape_getPosition(Get_Circle_Shape(self)));
|
|
151
250
|
}
|
|
152
251
|
|
|
252
|
+
/* call-seq: rotation -> Float
|
|
253
|
+
*
|
|
254
|
+
* Returns the object's rotation, in degrees.
|
|
255
|
+
*
|
|
256
|
+
* @return [Float]
|
|
257
|
+
*/
|
|
153
258
|
static VALUE Circle_get_rotation(VALUE self) {
|
|
154
259
|
return DBL2NUM(sfCircleShape_getRotation(Get_Circle_Shape(self)));
|
|
155
260
|
}
|
|
156
261
|
|
|
262
|
+
/* call-seq: scale -> Vector2
|
|
263
|
+
*
|
|
264
|
+
* Returns the object's scale factors.
|
|
265
|
+
*
|
|
266
|
+
* @return [Vector2]
|
|
267
|
+
*/
|
|
157
268
|
static VALUE Circle_get_scale(VALUE self) {
|
|
158
269
|
return vec2f_to_rb(sfCircleShape_getScale(Get_Circle_Shape(self)));
|
|
159
270
|
}
|
|
160
271
|
|
|
272
|
+
/* call-seq: origin -> Vector2
|
|
273
|
+
*
|
|
274
|
+
* Returns the object's origin.
|
|
275
|
+
*
|
|
276
|
+
* @return [Vector2]
|
|
277
|
+
*/
|
|
161
278
|
static VALUE Circle_get_origin(VALUE self) {
|
|
162
279
|
return vec2f_to_rb(sfCircleShape_getOrigin(Get_Circle_Shape(self)));
|
|
163
280
|
}
|
|
164
281
|
|
|
282
|
+
/* call-seq: move(offset) -> self
|
|
283
|
+
*
|
|
284
|
+
* Moves the circle by +offset+.
|
|
285
|
+
*
|
|
286
|
+
* @return [self]
|
|
287
|
+
*/
|
|
165
288
|
static VALUE Circle_move(VALUE self, VALUE rb_move) {
|
|
166
289
|
sfCircleShape_move(Get_Circle_Shape(self), vec2f_from_rb(rb_move));
|
|
167
290
|
return self;
|
|
168
291
|
}
|
|
169
292
|
|
|
293
|
+
/* call-seq: rotate(angle) -> self
|
|
294
|
+
*
|
|
295
|
+
* Rotates the circle by +angle+ degrees.
|
|
296
|
+
*
|
|
297
|
+
* @return [self]
|
|
298
|
+
*/
|
|
170
299
|
static VALUE Circle_rotate(VALUE self, VALUE rb_angle) {
|
|
171
300
|
sfCircleShape_rotate(Get_Circle_Shape(self), NUM2DBL(rb_angle));
|
|
172
301
|
return self;
|
|
173
302
|
}
|
|
174
303
|
|
|
304
|
+
/* call-seq:
|
|
305
|
+
* scale!(factors) -> self
|
|
306
|
+
*
|
|
307
|
+
* Scales the circle by +factors+ relative to its current scale.
|
|
308
|
+
*
|
|
309
|
+
* @return [self]
|
|
310
|
+
*/
|
|
175
311
|
static VALUE Circle_scale(VALUE self, VALUE rb_scale) {
|
|
176
312
|
sfCircleShape_scale(Get_Circle_Shape(self), vec2f_from_rb(rb_scale));
|
|
177
313
|
return self;
|
|
178
314
|
}
|
|
179
315
|
|
|
316
|
+
/* call-seq: transform -> Array
|
|
317
|
+
*
|
|
318
|
+
* Also available as #matrix.
|
|
319
|
+
*
|
|
320
|
+
* @return [Array] the 3x3 row-major transform matrix
|
|
321
|
+
*/
|
|
180
322
|
static VALUE Circle_get_transform(VALUE self) {
|
|
181
323
|
return Transform_MatrixToArray(sfCircleShape_getTransform(Get_Circle_Shape(self)).matrix);
|
|
182
324
|
}
|
|
183
325
|
|
|
326
|
+
/* call-seq: inverse_transform -> Array
|
|
327
|
+
*
|
|
328
|
+
* Returns the 3x3 row-major inverse of the circle's transform matrix.
|
|
329
|
+
*
|
|
330
|
+
* @return [Array] the 3x3 row-major inverse transform matrix
|
|
331
|
+
*/
|
|
184
332
|
static VALUE Circle_get_inverse_transform(VALUE self) {
|
|
185
333
|
return Transform_MatrixToArray(
|
|
186
334
|
sfCircleShape_getInverseTransform(Get_Circle_Shape(self)).matrix);
|
|
187
335
|
}
|
|
188
336
|
|
|
337
|
+
/* call-seq:
|
|
338
|
+
* texture=(value) -> Texture or nil
|
|
339
|
+
*
|
|
340
|
+
* Sets the object's texture.
|
|
341
|
+
*
|
|
342
|
+
* @return [Texture, nil] +value+
|
|
343
|
+
*/
|
|
189
344
|
static VALUE Circle_set_texture(VALUE self, VALUE rb_texture) {
|
|
190
345
|
Circle* ptr = Get_Circle(self);
|
|
191
346
|
|
|
@@ -205,47 +360,110 @@ static VALUE Circle_set_texture(VALUE self, VALUE rb_texture) {
|
|
|
205
360
|
return rb_texture;
|
|
206
361
|
}
|
|
207
362
|
|
|
363
|
+
/* call-seq: texture -> Texture or nil
|
|
364
|
+
*
|
|
365
|
+
* Returns the object's texture, or +nil+ if it has none.
|
|
366
|
+
*
|
|
367
|
+
* @return [Texture, nil]
|
|
368
|
+
*/
|
|
208
369
|
static VALUE Circle_get_texture(VALUE self) {
|
|
209
370
|
return Get_Circle(self)->rb_texture;
|
|
210
371
|
}
|
|
211
372
|
|
|
373
|
+
/* call-seq: texture_rect -> Rect
|
|
374
|
+
*
|
|
375
|
+
* Returns the sub-rectangle of the texture displayed on the object.
|
|
376
|
+
*
|
|
377
|
+
* @return [Rect] the sub-rectangle of the texture displayed on the circle
|
|
378
|
+
*/
|
|
212
379
|
static VALUE Circle_get_texture_rect(VALUE self) {
|
|
213
380
|
return int_rect_to_rb(sfCircleShape_getTextureRect(Get_Circle_Shape(self)));
|
|
214
381
|
}
|
|
215
382
|
|
|
383
|
+
/* call-seq:
|
|
384
|
+
* texture_rect=(value) -> Rect
|
|
385
|
+
*
|
|
386
|
+
* Sets the sub-rectangle of the texture displayed on the object.
|
|
387
|
+
*
|
|
388
|
+
* @return [Rect] +value+
|
|
389
|
+
*/
|
|
216
390
|
static VALUE Circle_set_texture_rect(VALUE self, VALUE rb_rect) {
|
|
217
391
|
sfCircleShape_setTextureRect(Get_Circle_Shape(self), int_rect_from_rb(rb_rect));
|
|
218
392
|
return rb_rect;
|
|
219
393
|
}
|
|
220
394
|
|
|
395
|
+
/* call-seq: point_count -> Integer
|
|
396
|
+
*
|
|
397
|
+
* Returns the number of points composing the shape.
|
|
398
|
+
*
|
|
399
|
+
* @return [Integer] the number of points/segments the circle is
|
|
400
|
+
* approximated with
|
|
401
|
+
*/
|
|
221
402
|
static VALUE Circle_get_point_count(VALUE self) {
|
|
222
403
|
return SIZET2NUM(sfCircleShape_getPointCount(Get_Circle_Shape(self)));
|
|
223
404
|
}
|
|
224
405
|
|
|
225
|
-
/*
|
|
226
|
-
|
|
406
|
+
/* call-seq:
|
|
407
|
+
* point_count=(value) -> self
|
|
408
|
+
*
|
|
409
|
+
* The number of segments the circle is approximated with -- more for a
|
|
410
|
+
* smoother outline, fewer for a polygon (3 gives a triangle).
|
|
411
|
+
*
|
|
412
|
+
* @return [self]
|
|
413
|
+
*/
|
|
227
414
|
static VALUE Circle_set_point_count(VALUE self, VALUE rb_count) {
|
|
228
415
|
sfCircleShape_setPointCount(Get_Circle_Shape(self), NUM2SIZET(rb_count));
|
|
229
416
|
|
|
230
417
|
return self;
|
|
231
418
|
}
|
|
232
419
|
|
|
420
|
+
/* call-seq: point(index) -> Vector2
|
|
421
|
+
*
|
|
422
|
+
* Returns the local position of the point at +index+.
|
|
423
|
+
*
|
|
424
|
+
* @return [Vector2] the local position of the point at +index+
|
|
425
|
+
*/
|
|
233
426
|
static VALUE Circle_get_point(VALUE self, VALUE rb_index) {
|
|
234
427
|
return vec2f_to_rb(sfCircleShape_getPoint(Get_Circle_Shape(self), (size_t)NUM2SIZET(rb_index)));
|
|
235
428
|
}
|
|
236
429
|
|
|
430
|
+
/* call-seq: geometric_center -> Vector2
|
|
431
|
+
*
|
|
432
|
+
* Returns the local position of the shape's geometric center.
|
|
433
|
+
*
|
|
434
|
+
* @return [Vector2] the local position of the shape's geometric center
|
|
435
|
+
*/
|
|
237
436
|
static VALUE Circle_get_geometric_center(VALUE self) {
|
|
238
437
|
return vec2f_to_rb(sfCircleShape_getGeometricCenter(Get_Circle_Shape(self)));
|
|
239
438
|
}
|
|
240
439
|
|
|
440
|
+
/* call-seq: local_bounds -> Rect
|
|
441
|
+
*
|
|
442
|
+
* Returns the bounding box in local (untransformed) coordinates.
|
|
443
|
+
*
|
|
444
|
+
* @return [Rect] the bounding box in local (untransformed) coordinates
|
|
445
|
+
*/
|
|
241
446
|
static VALUE Circle_get_local_bounds(VALUE self) {
|
|
242
447
|
return rect_to_rb(sfCircleShape_getLocalBounds(Get_Circle_Shape(self)));
|
|
243
448
|
}
|
|
244
449
|
|
|
450
|
+
/* call-seq: global_bounds -> Rect
|
|
451
|
+
*
|
|
452
|
+
* Returns the bounding box after the transform is applied.
|
|
453
|
+
*
|
|
454
|
+
* @return [Rect] the bounding box after transform is applied
|
|
455
|
+
*/
|
|
245
456
|
static VALUE Circle_get_global_bounds(VALUE self) {
|
|
246
457
|
return rect_to_rb(sfCircleShape_getGlobalBounds(Get_Circle_Shape(self)));
|
|
247
458
|
}
|
|
248
459
|
|
|
460
|
+
/* call-seq:
|
|
461
|
+
* draw(target, state) -> nil
|
|
462
|
+
*
|
|
463
|
+
* Draws the circle onto +target+ using the given render +state+.
|
|
464
|
+
*
|
|
465
|
+
* @return [nil]
|
|
466
|
+
*/
|
|
249
467
|
static VALUE Circle_draw(VALUE self, VALUE rb_target, VALUE rb_state) {
|
|
250
468
|
if (!rb_obj_is_kind_of(rb_target, Get_Klass_Target())) {
|
|
251
469
|
raise_invalid_argument_class(Get_Klass_Target());
|
|
@@ -262,8 +480,57 @@ static VALUE Circle_draw(VALUE self, VALUE rb_target, VALUE rb_state) {
|
|
|
262
480
|
return Qnil;
|
|
263
481
|
}
|
|
264
482
|
|
|
265
|
-
|
|
266
|
-
|
|
483
|
+
/* Document-class: SFML::Circle
|
|
484
|
+
* A circle shape, drawable, transformable and stylable like the other
|
|
485
|
+
* SFML shapes. Includes Drawable.
|
|
486
|
+
*
|
|
487
|
+
* @!attribute radius
|
|
488
|
+
* The circle's radius.
|
|
489
|
+
*
|
|
490
|
+
* @return [Float]
|
|
491
|
+
* @!attribute position
|
|
492
|
+
* The circle's position.
|
|
493
|
+
*
|
|
494
|
+
* @return [Vector2]
|
|
495
|
+
* @!attribute rotation
|
|
496
|
+
* The circle's rotation, in degrees.
|
|
497
|
+
*
|
|
498
|
+
* @return [Float]
|
|
499
|
+
* @!attribute scale
|
|
500
|
+
* The circle's scale factors.
|
|
501
|
+
*
|
|
502
|
+
* @return [Vector2]
|
|
503
|
+
* @!attribute origin
|
|
504
|
+
* The circle's origin, used as the center of rotation and scaling.
|
|
505
|
+
*
|
|
506
|
+
* @return [Vector2]
|
|
507
|
+
* @!attribute fill_color
|
|
508
|
+
* The circle's fill color.
|
|
509
|
+
*
|
|
510
|
+
* @return [Color]
|
|
511
|
+
* @!attribute outline_color
|
|
512
|
+
* The circle's outline color.
|
|
513
|
+
*
|
|
514
|
+
* @return [Color]
|
|
515
|
+
* @!attribute outline_thickness
|
|
516
|
+
* The circle's outline thickness.
|
|
517
|
+
*
|
|
518
|
+
* @return [Float]
|
|
519
|
+
* @!attribute texture
|
|
520
|
+
* The circle's texture, or +nil+ if it has none.
|
|
521
|
+
*
|
|
522
|
+
* @return [Texture, nil]
|
|
523
|
+
* @!attribute texture_rect
|
|
524
|
+
* The sub-rectangle of the texture displayed on the circle.
|
|
525
|
+
*
|
|
526
|
+
* @return [Rect]
|
|
527
|
+
* @!attribute point_count
|
|
528
|
+
* The number of segments the circle is approximated with.
|
|
529
|
+
*
|
|
530
|
+
* @return [Integer] the number of segments the circle is approximated with
|
|
531
|
+
*/
|
|
532
|
+
void Init_Circle(VALUE rb_mSFML) {
|
|
533
|
+
rb_cCircle = rb_define_class_under(rb_mSFML, "Circle", rb_cObject);
|
|
267
534
|
|
|
268
535
|
rb_include_module(rb_cCircle, Get_Module_Drawable());
|
|
269
536
|
|