sfml3-rb 0.2.2 → 0.3.1

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