sfml3-rb 0.0.1 → 0.2.2

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 (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +342 -0
  3. data/README.md +51 -14
  4. data/TODO.md +199 -0
  5. data/ext/audio/audio_enums.c +131 -0
  6. data/ext/audio/audio_enums.h +18 -0
  7. data/ext/audio/effect_processor.c +233 -0
  8. data/ext/audio/effect_processor.h +25 -0
  9. data/ext/audio/listener.c +83 -0
  10. data/ext/audio/listener.h +8 -0
  11. data/ext/audio/music.c +174 -0
  12. data/ext/audio/music.h +14 -0
  13. data/ext/audio/sound.c +139 -0
  14. data/ext/audio/sound.h +14 -0
  15. data/ext/audio/sound_buffer.c +274 -0
  16. data/ext/audio/sound_buffer.h +18 -0
  17. data/ext/audio/sound_buffer_recorder.c +109 -0
  18. data/ext/audio/sound_buffer_recorder.h +14 -0
  19. data/ext/audio/sound_recorder.c +268 -0
  20. data/ext/audio/sound_recorder.h +14 -0
  21. data/ext/audio/sound_source.h +13 -0
  22. data/ext/audio/sound_source.inc +271 -0
  23. data/ext/audio/sound_source_cone.c +138 -0
  24. data/ext/audio/sound_source_cone.h +20 -0
  25. data/ext/audio/sound_stream.c +294 -0
  26. data/ext/audio/sound_stream.h +14 -0
  27. data/ext/{exceptions.c → core/exceptions.c} +10 -8
  28. data/ext/{ext → core}/exceptions.h +3 -3
  29. data/ext/core/foreign_thread.c +149 -0
  30. data/ext/core/foreign_thread.h +31 -0
  31. data/ext/core/macros.h +8 -0
  32. data/ext/{ext → core}/sfml.h +5 -3
  33. data/ext/core/unicode.c +46 -0
  34. data/ext/core/unicode.h +25 -0
  35. data/ext/ext.c +125 -14
  36. data/ext/extconf.rb +51 -6
  37. data/ext/graphics/blend_mode.c +261 -0
  38. data/ext/graphics/blend_mode.h +18 -0
  39. data/ext/graphics/circle.c +319 -0
  40. data/ext/{ext/klass/drawable → graphics}/circle.h +3 -3
  41. data/ext/graphics/color.c +318 -0
  42. data/ext/graphics/color.h +37 -0
  43. data/ext/{drawable.c → graphics/drawable.c} +11 -11
  44. data/ext/graphics/drawable.h +10 -0
  45. data/ext/graphics/enums.c +123 -0
  46. data/ext/graphics/enums.h +20 -0
  47. data/ext/graphics/font.c +148 -0
  48. data/ext/graphics/font.h +14 -0
  49. data/ext/graphics/glyph.c +60 -0
  50. data/ext/graphics/glyph.h +14 -0
  51. data/ext/graphics/image.c +205 -0
  52. data/ext/graphics/image.h +16 -0
  53. data/ext/graphics/polygon.c +300 -0
  54. data/ext/graphics/polygon.h +10 -0
  55. data/ext/graphics/rect.c +287 -0
  56. data/ext/graphics/rect.h +30 -0
  57. data/ext/graphics/rectangle.c +302 -0
  58. data/ext/graphics/rectangle.h +10 -0
  59. data/ext/graphics/render_state.c +204 -0
  60. data/ext/graphics/render_state.h +18 -0
  61. data/ext/graphics/render_target.inc +181 -0
  62. data/ext/graphics/render_texture.c +182 -0
  63. data/ext/graphics/render_texture.h +14 -0
  64. data/ext/graphics/shader.c +540 -0
  65. data/ext/graphics/shader.h +14 -0
  66. data/ext/graphics/shape.c +311 -0
  67. data/ext/graphics/shape.h +10 -0
  68. data/ext/graphics/sprite.c +249 -0
  69. data/ext/graphics/sprite.h +10 -0
  70. data/ext/graphics/stencil_mode.c +211 -0
  71. data/ext/graphics/stencil_mode.h +18 -0
  72. data/ext/graphics/target.c +133 -0
  73. data/ext/graphics/target.h +40 -0
  74. data/ext/graphics/text.c +344 -0
  75. data/ext/graphics/text.h +10 -0
  76. data/ext/graphics/texture.c +379 -0
  77. data/ext/graphics/texture.h +16 -0
  78. data/ext/graphics/transform.c +372 -0
  79. data/ext/graphics/transform.h +35 -0
  80. data/ext/{transformable.c → graphics/transformable.c} +168 -144
  81. data/ext/{ext/klass → graphics}/transformable.h +3 -3
  82. data/ext/graphics/vertex.c +179 -0
  83. data/ext/graphics/vertex.h +23 -0
  84. data/ext/graphics/vertex_array.c +127 -0
  85. data/ext/graphics/vertex_array.h +10 -0
  86. data/ext/graphics/vertex_buffer.c +211 -0
  87. data/ext/graphics/vertex_buffer.h +14 -0
  88. data/ext/{view.c → graphics/view.c} +168 -169
  89. data/ext/{ext/klass → graphics}/view.h +3 -3
  90. data/ext/network/ftp.c +405 -0
  91. data/ext/network/ftp.h +20 -0
  92. data/ext/network/http.c +243 -0
  93. data/ext/network/http.h +18 -0
  94. data/ext/network/ip_address.c +164 -0
  95. data/ext/network/ip_address.h +20 -0
  96. data/ext/network/network_enums.c +298 -0
  97. data/ext/network/network_enums.h +26 -0
  98. data/ext/network/packet.c +189 -0
  99. data/ext/network/packet.h +14 -0
  100. data/ext/network/socket_selector.c +142 -0
  101. data/ext/network/socket_selector.h +14 -0
  102. data/ext/network/tcp_listener.c +115 -0
  103. data/ext/network/tcp_listener.h +14 -0
  104. data/ext/network/tcp_socket.c +199 -0
  105. data/ext/network/tcp_socket.h +17 -0
  106. data/ext/network/udp_socket.c +190 -0
  107. data/ext/network/udp_socket.h +14 -0
  108. data/ext/ports.rb +97 -21
  109. data/ext/system/buffer.c +77 -0
  110. data/ext/system/buffer.h +14 -0
  111. data/ext/system/clock.c +100 -0
  112. data/ext/{ext/klass → system}/clock.h +3 -3
  113. data/ext/system/input_stream.c +229 -0
  114. data/ext/system/input_stream.h +23 -0
  115. data/ext/system/sleep.c +16 -0
  116. data/ext/system/sleep.h +8 -0
  117. data/ext/system/time.c +218 -0
  118. data/ext/system/time.h +18 -0
  119. data/ext/system/vec2.c +251 -0
  120. data/ext/system/vec2.h +55 -0
  121. data/ext/system/vec3.c +219 -0
  122. data/ext/system/vec3.h +18 -0
  123. data/ext/window/clipboard.c +89 -0
  124. data/ext/window/clipboard.h +8 -0
  125. data/ext/window/context.c +70 -0
  126. data/ext/window/context.h +8 -0
  127. data/ext/window/context_settings.c +220 -0
  128. data/ext/window/context_settings.h +18 -0
  129. data/ext/window/cursor.c +56 -0
  130. data/ext/window/cursor.h +14 -0
  131. data/ext/window/event.c +216 -0
  132. data/ext/window/event.h +14 -0
  133. data/ext/{event_name.c → window/event_name.c} +2 -2
  134. data/ext/window/event_name.h +8 -0
  135. data/ext/window/input_enums.c +261 -0
  136. data/ext/window/input_enums.h +36 -0
  137. data/ext/window/joystick.c +60 -0
  138. data/ext/window/joystick.h +8 -0
  139. data/ext/{keyboard.c → window/keyboard.c} +74 -2
  140. data/ext/window/keyboard.h +12 -0
  141. data/ext/window/mouse.c +70 -0
  142. data/ext/window/mouse.h +8 -0
  143. data/ext/window/sensor.c +30 -0
  144. data/ext/window/sensor.h +8 -0
  145. data/ext/window/touch.c +49 -0
  146. data/ext/window/touch.h +8 -0
  147. data/ext/window/video_mode.c +133 -0
  148. data/ext/window/video_mode.h +14 -0
  149. data/ext/window/vulkan.c +44 -0
  150. data/ext/window/vulkan.h +8 -0
  151. data/ext/window/window.c +414 -0
  152. data/ext/{ext/klass → window}/window.h +3 -3
  153. data/lib/sfml/version.rb +4 -2
  154. data/lib/sfml.rb +2 -0
  155. metadata +163 -56
  156. data/ext/circle.c +0 -198
  157. data/ext/clock.c +0 -65
  158. data/ext/color.c +0 -43
  159. data/ext/event.c +0 -148
  160. data/ext/ext/klass/color.h +0 -26
  161. data/ext/ext/klass/drawable/image.h +0 -4
  162. data/ext/ext/klass/drawable/polygon.h +0 -4
  163. data/ext/ext/klass/drawable/rectangle.h +0 -4
  164. data/ext/ext/klass/drawable/sprite.h +0 -4
  165. data/ext/ext/klass/drawable/texture.h +0 -4
  166. data/ext/ext/klass/event/event_name.h +0 -8
  167. data/ext/ext/klass/event.h +0 -12
  168. data/ext/ext/klass/keyboard.h +0 -8
  169. data/ext/ext/klass/render_state.h +0 -16
  170. data/ext/ext/klass/target.h +0 -18
  171. data/ext/ext/klass/transform.h +0 -17
  172. data/ext/ext/klass/video_mode.h +0 -12
  173. data/ext/ext/module/drawable/drawable.h +0 -10
  174. data/ext/ext/module/transform.h +0 -18
  175. data/ext/ext/module.h +0 -10
  176. data/ext/ext/rect.h +0 -16
  177. data/ext/ext/style_name.h +0 -11
  178. data/ext/ext/vec2.h +0 -38
  179. data/ext/image.c +0 -5
  180. data/ext/polygon.c +0 -5
  181. data/ext/rect.c +0 -26
  182. data/ext/rectangle.c +0 -5
  183. data/ext/render_state.c +0 -109
  184. data/ext/sprite.c +0 -5
  185. data/ext/style_name.c +0 -15
  186. data/ext/target.c +0 -106
  187. data/ext/texture.c +0 -5
  188. data/ext/transform.c +0 -107
  189. data/ext/vec2.c +0 -42
  190. data/ext/video_mode.c +0 -78
  191. data/ext/window.c +0 -274
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfml3-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
- - Sealtiel Valderrama
7
+ - Algaves
8
+ - Diego-Sealtiel Valderrama
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2026-09-13 00:00:00.000000000 Z
12
+ date: 2026-09-18 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: Ruby bindings for SFML 3 via CSFML. Precompiled binaries are published
14
15
  for common platforms; elsewhere SFML and CSFML are downloaded and built from source
@@ -17,62 +18,164 @@ email: SealtielFreak@yandex.com
17
18
  executables: []
18
19
  extensions:
19
20
  - ext/extconf.rb
20
- extra_rdoc_files: []
21
+ extra_rdoc_files:
22
+ - README.md
23
+ - CHANGELOG.md
24
+ - LICENSE.md
25
+ - TODO.md
21
26
  files:
27
+ - CHANGELOG.md
22
28
  - LICENSE.md
23
29
  - README.md
24
- - ext/circle.c
25
- - ext/clock.c
26
- - ext/color.c
27
- - ext/drawable.c
28
- - ext/event.c
29
- - ext/event_name.c
30
- - ext/exceptions.c
30
+ - TODO.md
31
+ - ext/audio/audio_enums.c
32
+ - ext/audio/audio_enums.h
33
+ - ext/audio/effect_processor.c
34
+ - ext/audio/effect_processor.h
35
+ - ext/audio/listener.c
36
+ - ext/audio/listener.h
37
+ - ext/audio/music.c
38
+ - ext/audio/music.h
39
+ - ext/audio/sound.c
40
+ - ext/audio/sound.h
41
+ - ext/audio/sound_buffer.c
42
+ - ext/audio/sound_buffer.h
43
+ - ext/audio/sound_buffer_recorder.c
44
+ - ext/audio/sound_buffer_recorder.h
45
+ - ext/audio/sound_recorder.c
46
+ - ext/audio/sound_recorder.h
47
+ - ext/audio/sound_source.h
48
+ - ext/audio/sound_source.inc
49
+ - ext/audio/sound_source_cone.c
50
+ - ext/audio/sound_source_cone.h
51
+ - ext/audio/sound_stream.c
52
+ - ext/audio/sound_stream.h
53
+ - ext/core/exceptions.c
54
+ - ext/core/exceptions.h
55
+ - ext/core/foreign_thread.c
56
+ - ext/core/foreign_thread.h
57
+ - ext/core/macros.h
58
+ - ext/core/sfml.h
59
+ - ext/core/unicode.c
60
+ - ext/core/unicode.h
31
61
  - ext/ext.c
32
- - ext/ext/exceptions.h
33
- - ext/ext/klass/clock.h
34
- - ext/ext/klass/color.h
35
- - ext/ext/klass/drawable/circle.h
36
- - ext/ext/klass/drawable/image.h
37
- - ext/ext/klass/drawable/polygon.h
38
- - ext/ext/klass/drawable/rectangle.h
39
- - ext/ext/klass/drawable/sprite.h
40
- - ext/ext/klass/drawable/texture.h
41
- - ext/ext/klass/event.h
42
- - ext/ext/klass/event/event_name.h
43
- - ext/ext/klass/keyboard.h
44
- - ext/ext/klass/render_state.h
45
- - ext/ext/klass/target.h
46
- - ext/ext/klass/transform.h
47
- - ext/ext/klass/transformable.h
48
- - ext/ext/klass/video_mode.h
49
- - ext/ext/klass/view.h
50
- - ext/ext/klass/window.h
51
- - ext/ext/module.h
52
- - ext/ext/module/drawable/drawable.h
53
- - ext/ext/module/transform.h
54
- - ext/ext/rect.h
55
- - ext/ext/sfml.h
56
- - ext/ext/style_name.h
57
- - ext/ext/vec2.h
58
62
  - ext/extconf.rb
59
- - ext/image.c
60
- - ext/keyboard.c
61
- - ext/polygon.c
63
+ - ext/graphics/blend_mode.c
64
+ - ext/graphics/blend_mode.h
65
+ - ext/graphics/circle.c
66
+ - ext/graphics/circle.h
67
+ - ext/graphics/color.c
68
+ - ext/graphics/color.h
69
+ - ext/graphics/drawable.c
70
+ - ext/graphics/drawable.h
71
+ - ext/graphics/enums.c
72
+ - ext/graphics/enums.h
73
+ - ext/graphics/font.c
74
+ - ext/graphics/font.h
75
+ - ext/graphics/glyph.c
76
+ - ext/graphics/glyph.h
77
+ - ext/graphics/image.c
78
+ - ext/graphics/image.h
79
+ - ext/graphics/polygon.c
80
+ - ext/graphics/polygon.h
81
+ - ext/graphics/rect.c
82
+ - ext/graphics/rect.h
83
+ - ext/graphics/rectangle.c
84
+ - ext/graphics/rectangle.h
85
+ - ext/graphics/render_state.c
86
+ - ext/graphics/render_state.h
87
+ - ext/graphics/render_target.inc
88
+ - ext/graphics/render_texture.c
89
+ - ext/graphics/render_texture.h
90
+ - ext/graphics/shader.c
91
+ - ext/graphics/shader.h
92
+ - ext/graphics/shape.c
93
+ - ext/graphics/shape.h
94
+ - ext/graphics/sprite.c
95
+ - ext/graphics/sprite.h
96
+ - ext/graphics/stencil_mode.c
97
+ - ext/graphics/stencil_mode.h
98
+ - ext/graphics/target.c
99
+ - ext/graphics/target.h
100
+ - ext/graphics/text.c
101
+ - ext/graphics/text.h
102
+ - ext/graphics/texture.c
103
+ - ext/graphics/texture.h
104
+ - ext/graphics/transform.c
105
+ - ext/graphics/transform.h
106
+ - ext/graphics/transformable.c
107
+ - ext/graphics/transformable.h
108
+ - ext/graphics/vertex.c
109
+ - ext/graphics/vertex.h
110
+ - ext/graphics/vertex_array.c
111
+ - ext/graphics/vertex_array.h
112
+ - ext/graphics/vertex_buffer.c
113
+ - ext/graphics/vertex_buffer.h
114
+ - ext/graphics/view.c
115
+ - ext/graphics/view.h
116
+ - ext/network/ftp.c
117
+ - ext/network/ftp.h
118
+ - ext/network/http.c
119
+ - ext/network/http.h
120
+ - ext/network/ip_address.c
121
+ - ext/network/ip_address.h
122
+ - ext/network/network_enums.c
123
+ - ext/network/network_enums.h
124
+ - ext/network/packet.c
125
+ - ext/network/packet.h
126
+ - ext/network/socket_selector.c
127
+ - ext/network/socket_selector.h
128
+ - ext/network/tcp_listener.c
129
+ - ext/network/tcp_listener.h
130
+ - ext/network/tcp_socket.c
131
+ - ext/network/tcp_socket.h
132
+ - ext/network/udp_socket.c
133
+ - ext/network/udp_socket.h
62
134
  - ext/ports.rb
63
- - ext/rect.c
64
- - ext/rectangle.c
65
- - ext/render_state.c
66
- - ext/sprite.c
67
- - ext/style_name.c
68
- - ext/target.c
69
- - ext/texture.c
70
- - ext/transform.c
71
- - ext/transformable.c
72
- - ext/vec2.c
73
- - ext/video_mode.c
74
- - ext/view.c
75
- - ext/window.c
135
+ - ext/system/buffer.c
136
+ - ext/system/buffer.h
137
+ - ext/system/clock.c
138
+ - ext/system/clock.h
139
+ - ext/system/input_stream.c
140
+ - ext/system/input_stream.h
141
+ - ext/system/sleep.c
142
+ - ext/system/sleep.h
143
+ - ext/system/time.c
144
+ - ext/system/time.h
145
+ - ext/system/vec2.c
146
+ - ext/system/vec2.h
147
+ - ext/system/vec3.c
148
+ - ext/system/vec3.h
149
+ - ext/window/clipboard.c
150
+ - ext/window/clipboard.h
151
+ - ext/window/context.c
152
+ - ext/window/context.h
153
+ - ext/window/context_settings.c
154
+ - ext/window/context_settings.h
155
+ - ext/window/cursor.c
156
+ - ext/window/cursor.h
157
+ - ext/window/event.c
158
+ - ext/window/event.h
159
+ - ext/window/event_name.c
160
+ - ext/window/event_name.h
161
+ - ext/window/input_enums.c
162
+ - ext/window/input_enums.h
163
+ - ext/window/joystick.c
164
+ - ext/window/joystick.h
165
+ - ext/window/keyboard.c
166
+ - ext/window/keyboard.h
167
+ - ext/window/mouse.c
168
+ - ext/window/mouse.h
169
+ - ext/window/sensor.c
170
+ - ext/window/sensor.h
171
+ - ext/window/touch.c
172
+ - ext/window/touch.h
173
+ - ext/window/video_mode.c
174
+ - ext/window/video_mode.h
175
+ - ext/window/vulkan.c
176
+ - ext/window/vulkan.h
177
+ - ext/window/window.c
178
+ - ext/window/window.h
76
179
  - lib/sfml.rb
77
180
  - lib/sfml/version.rb
78
181
  homepage: https://github.com/algaves/sfml3.rb
@@ -82,15 +185,19 @@ metadata:
82
185
  source_code_uri: https://github.com/algaves/sfml3.rb
83
186
  bug_tracker_uri: https://github.com/algaves/sfml3.rb/issues
84
187
  changelog_uri: https://github.com/algaves/sfml3.rb/blob/main/CHANGELOG.md
188
+ documentation_uri: https://rubydoc.info/gems/sfml3-rb
189
+ rubygems_mfa_required: 'true'
85
190
  post_install_message:
86
- rdoc_options: []
191
+ rdoc_options:
192
+ - "--main"
193
+ - README.md
87
194
  require_paths:
88
195
  - lib
89
196
  required_ruby_version: !ruby/object:Gem::Requirement
90
197
  requirements:
91
198
  - - ">="
92
199
  - !ruby/object:Gem::Version
93
- version: 2.5.0
200
+ version: '3.1'
94
201
  required_rubygems_version: !ruby/object:Gem::Requirement
95
202
  requirements:
96
203
  - - ">="
@@ -100,5 +207,5 @@ requirements: []
100
207
  rubygems_version: 3.5.22
101
208
  signing_key:
102
209
  specification_version: 4
103
- summary: SFML wrapper for Ruby
210
+ summary: Ruby bindings for SFML 3, with precompiled binaries
104
211
  test_files: []
data/ext/circle.c DELETED
@@ -1,198 +0,0 @@
1
- #include "ext/klass/drawable/circle.h"
2
-
3
- #include <stdio.h>
4
-
5
- #include "ext/module/drawable/drawable.h"
6
- #include "ext/klass/target.h"
7
- #include "ext/klass/render_state.h"
8
- #include "ext/exceptions.h"
9
- #include "ext/module/transform.h"
10
- #include "ext/klass/transformable.h"
11
- #include "ext/klass/color.h"
12
- #include "ext/vec2.h"
13
- #include "ext/rect.h"
14
- #include "ext/module.h"
15
- #include "ext/sfml.h"
16
-
17
-
18
- static VALUE rb_cCircle;
19
-
20
- static sfCircleShape *Circle_create(float r) {
21
- sfCircleShape *circle = sfCircleShape_create();
22
-
23
- sfCircleShape_setRadius(circle, r);
24
-
25
- return circle;
26
- }
27
-
28
- static void Circle_free(void *ptr) {
29
- sfCircleShape_destroy(ptr);
30
- }
31
-
32
- static VALUE Circle_new(int argc, VALUE *argv, VALUE klass) {
33
- sfCircleShape *circle;
34
- float radius;
35
- VALUE self;
36
-
37
- if (argc > 1) {
38
- raise_invalid_arguments_excepted(1, argc);
39
- }
40
-
41
- radius = 0;
42
-
43
- if (argc == 1) {
44
- radius = NUM2DBL(argv[0]);
45
- }
46
-
47
- circle = Circle_create(radius);
48
-
49
- self = Data_Wrap_Struct(klass, 0, Circle_free, circle);
50
-
51
- rb_obj_call_init(self, argc, argv);
52
-
53
- return self;
54
- }
55
-
56
- static VALUE Circle_init(int argc, VALUE *argv, VALUE self) {
57
- return self;
58
- }
59
-
60
- static VALUE Circle_set_fill_color(VALUE self, VALUE rb_color) {
61
- color_check(rb_color);
62
-
63
- sfCircleShape_setFillColor(Get_Circle_Struct(self), color_new_from_rb(rb_color));
64
-
65
- return self;
66
- }
67
-
68
- static VALUE Circle_get_fill_color(VALUE self) {
69
- sfColor color = sfCircleShape_getFillColor(Get_Circle_Struct(self));
70
-
71
- return color_new_from_c(color);
72
- }
73
-
74
- static VALUE Circle_set_radius(VALUE self, VALUE rb_radius) {
75
- sfCircleShape_setRadius(Get_Circle_Struct(self), NUM2DBL(rb_radius));
76
-
77
- return self;
78
- }
79
-
80
- static VALUE Circle_set_position(VALUE self, VALUE rb_position) {
81
- sfCircleShape_setPosition(Get_Circle_Struct(self), vec2f_new_from_ruby(rb_position));
82
-
83
- return self;
84
- }
85
-
86
- static VALUE Circle_set_rotation(VALUE self, VALUE rb_angle) {
87
- sfCircleShape_setRotation(Get_Circle_Struct(self), NUM2DBL(rb_angle));
88
-
89
- return self;
90
- }
91
-
92
- static VALUE Circle_set_origin(VALUE self, VALUE rb_origin) {
93
- sfCircleShape_setOrigin(Get_Circle_Struct(self), vec2f_new_from_ruby(rb_origin));
94
-
95
- return self;
96
- }
97
-
98
- static VALUE Circle_set_scale(VALUE self, VALUE rb_scale) {
99
- sfCircleShape_setScale(Get_Circle_Struct(self), vec2f_new_from_ruby(rb_scale));
100
-
101
- return self;
102
- }
103
-
104
- static VALUE Circle_get_radius(VALUE self) {
105
- return DBL2NUM(sfCircleShape_getRadius(Get_Circle_Struct(self)));
106
- }
107
-
108
- static VALUE Circle_get_position(VALUE self) {
109
- return vec2f_new_from_c(sfCircleShape_getPosition(Get_Circle_Struct(self)));
110
- }
111
-
112
- static VALUE Circle_get_rotation(VALUE self) {
113
- return DBL2NUM(sfCircleShape_getRotation(Get_Circle_Struct(self)));
114
- }
115
-
116
- static VALUE Circle_get_scale(VALUE self) {
117
- return vec2f_new_from_c(sfCircleShape_getPosition(Get_Circle_Struct(self)));
118
- }
119
-
120
- static VALUE Circle_get_origin(VALUE self) {
121
- return vec2f_new_from_c(sfCircleShape_getOrigin(Get_Circle_Struct(self)));
122
- }
123
-
124
- static VALUE Circle_move(VALUE self, VALUE rb_move) {
125
- sfCircleShape_move(Get_Circle_Struct(self), vec2f_new_from_ruby(rb_move));
126
- return self;
127
- }
128
-
129
- static VALUE Circle_rotate(VALUE self, VALUE rb_angle) {
130
- sfCircleShape_rotate(Get_Circle_Struct(self), NUM2DBL(rb_angle));
131
- return self;
132
- }
133
-
134
- static VALUE Circle_scale(VALUE self, VALUE rb_scale) {
135
- sfCircleShape_scale(Get_Circle_Struct(self), vec2f_new_from_ruby(rb_scale));
136
- return self;
137
- }
138
-
139
- static VALUE Circle_get_matrix(VALUE self) {
140
- return Transform_MatrixToArray(sfCircleShape_getTransform(Get_Circle_Struct(self)).matrix);
141
- }
142
-
143
- static VALUE Circle_draw(VALUE self, VALUE rb_target, VALUE rb_state) {
144
- if (!rb_obj_is_kind_of(rb_target, Get_Klass_Target())) {
145
- raise_invalid_argument_class(Get_Klass_Target());
146
- }
147
-
148
- if (!rb_obj_is_kind_of(rb_target, Get_Klass_RenderState())) {
149
- raise_invalid_argument_class(Get_Klass_RenderState());
150
- }
151
-
152
- sfRenderWindow_drawCircleShape(((Target *) Get_Target_Struct(rb_target))->window, Get_Circle_Struct(self),
153
- Get_RenderState_Struct(rb_state));
154
- return Qnil;
155
- }
156
-
157
- void Init_Circle(VALUE rb_module) {
158
- rb_cCircle = rb_define_class_under(rb_module, "Circle", rb_cObject);
159
-
160
- rb_include_module(rb_cCircle, Get_Module_Drawable());
161
-
162
- rb_define_singleton_method(rb_cCircle, "new", Circle_new, -1);
163
-
164
- // methods
165
- rb_define_method(rb_cCircle, "initialize", Circle_init, -1);
166
- rb_define_method(rb_cCircle, "move", Circle_move, 1);
167
- rb_define_method(rb_cCircle, "rotate", Circle_rotate, 1);
168
- rb_define_method(rb_cCircle, "escalate", Circle_scale, 1);
169
- rb_define_method(rb_cCircle, "draw", Circle_draw, 2);
170
-
171
- // setters
172
- rb_define_method(rb_cCircle, "radius=", Circle_set_radius, 1);
173
- rb_define_method(rb_cCircle, "position=", Circle_set_position, 1);
174
- rb_define_method(rb_cCircle, "angle=", Circle_set_rotation, 1);
175
- rb_define_method(rb_cCircle, "scale=", Circle_set_scale, 1);
176
- rb_define_method(rb_cCircle, "origin=", Circle_set_origin, 1);
177
- rb_define_method(rb_cCircle, "fill_color=", Circle_set_fill_color, 1);
178
-
179
- // getters
180
- rb_define_method(rb_cCircle, "radius", Circle_get_radius, 0);
181
- rb_define_method(rb_cCircle, "position", Circle_get_position, 0);
182
- rb_define_method(rb_cCircle, "angle", Circle_get_rotation, 0);
183
- rb_define_method(rb_cCircle, "scale", Circle_get_scale, 0);
184
- rb_define_method(rb_cCircle, "origin", Circle_get_origin, 0);
185
- rb_define_method(rb_cCircle, "fill_color", Circle_get_fill_color, 0);
186
- rb_define_method(rb_cCircle, "matrix", Circle_get_matrix, 0);
187
-
188
- }
189
-
190
- void *Get_Circle_Struct(VALUE self) {
191
- sfCircleShape *ptr;
192
- Data_Get_Struct(self, sfCircleShape, ptr);
193
- return ptr;
194
- }
195
-
196
- VALUE Get_Klass_Circle() {
197
- return rb_cCircle;
198
- }
data/ext/clock.c DELETED
@@ -1,65 +0,0 @@
1
- #include "ext/klass/clock.h"
2
-
3
- #include <stdio.h>
4
-
5
- #include "ext/vec2.h"
6
- #include "ext/module.h"
7
- #include "ext/sfml.h"
8
-
9
- static VALUE rb_cClock;
10
-
11
- static sfClock *Clock_create() {
12
- return sfClock_create();
13
- }
14
-
15
- static void Clock_free(void *ptr) {
16
- sfClock_destroy(ptr);
17
- }
18
-
19
- static VALUE Clock_new(VALUE klass) {
20
- sfClock *clock;
21
- VALUE self;
22
-
23
- clock = Clock_create();
24
-
25
- self = Data_Wrap_Struct(klass, 0, Clock_free, clock);
26
-
27
- rb_obj_call_init(self, 0, NULL);
28
-
29
- return self;
30
- }
31
-
32
- static VALUE Clock_init(VALUE self) {
33
- return self;
34
- }
35
-
36
- static VALUE Clock_get_elapsed_time(VALUE self) {
37
- return DBL2NUM(sfTime_asSeconds(sfClock_getElapsedTime(Get_Clock_Struct(self))));
38
- }
39
-
40
- static VALUE Clock_restart(VALUE self) {
41
- return DBL2NUM(sfTime_asSeconds(sfClock_restart(Get_Clock_Struct(self))));
42
- }
43
-
44
- void Init_Clock(VALUE rb_module) {
45
- rb_cClock = rb_define_class_under(rb_module, "Clock", rb_cObject);
46
-
47
- rb_define_singleton_method(rb_cClock, "new", Clock_new, 0);
48
-
49
- // methods
50
- rb_define_method(rb_cClock, "initialize", Clock_init, 0);
51
- rb_define_method(rb_cClock, "restart!", Clock_restart, 0);
52
-
53
- // getters
54
- rb_define_method(rb_cClock, "elapsed_time", Clock_get_elapsed_time, 0);
55
- }
56
-
57
- void *Get_Clock_Struct(VALUE self) {
58
- sfClock *clock;
59
- Data_Get_Struct(self, sfClock, clock);
60
- return clock;
61
- }
62
-
63
- VALUE Get_Klass_Clock() {
64
- return rb_cClock;
65
- }
data/ext/color.c DELETED
@@ -1,43 +0,0 @@
1
- #include "ext/klass/color.h"
2
-
3
- #include <ruby.h>
4
- #include <stdio.h>
5
-
6
- #include "ext/exceptions.h"
7
-
8
- VALUE color_new(int r, int g, int b, int a) {
9
- VALUE rb_arr;
10
-
11
- rb_arr = rb_ary_new();
12
-
13
- rb_ary_push(rb_arr, INT2NUM(r));
14
- rb_ary_push(rb_arr, INT2NUM(g));
15
- rb_ary_push(rb_arr, INT2NUM(b));
16
- rb_ary_push(rb_arr, INT2NUM(a));
17
-
18
- return rb_arr;
19
- }
20
-
21
- void color_check(VALUE rb_arr) {
22
- if (rb_array_len(rb_arr) != VALID_LENGTH_COLOR) {
23
- raise_invalid_array_length(VALID_LENGTH_COLOR);
24
- }
25
- }
26
-
27
- void color_swap(sfColor *color_a, sfColor *color_b) {
28
- sfColor c;
29
-
30
- c = *color_b;
31
- *color_b = *color_a;
32
- *color_a = c;
33
- }
34
-
35
- sfColor color_new_from_rb(VALUE rb_arr) {
36
- sfColor color = COLOR_RB2C(rb_arr);
37
-
38
- return color;
39
- }
40
-
41
- VALUE color_new_from_c(sfColor color) {
42
- return COLOR_C2RB(color);
43
- }