sfml3-rb 0.3.0-arm-linux-gnu
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 +7 -0
- data/.yardopts +9 -0
- data/CHANGELOG.md +368 -0
- data/LICENSE.md +14 -0
- data/README.md +215 -0
- data/TODO.md +199 -0
- data/lib/sfml/3.1/sfml_ext.so +0 -0
- data/lib/sfml/3.2/sfml_ext.so +0 -0
- data/lib/sfml/3.3/sfml_ext.so +0 -0
- data/lib/sfml/3.4/sfml_ext.so +0 -0
- data/lib/sfml/4.0/sfml_ext.so +0 -0
- data/lib/sfml/version.rb +5 -0
- data/lib/sfml.rb +11 -0
- 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 +131 -0
data/TODO.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Roadmap: SFML 3 API port to Ruby
|
|
2
|
+
|
|
3
|
+
Tracks porting coverage of the SFML 3 API into this gem, module by module and class by class.
|
|
4
|
+
|
|
5
|
+
This binding wraps **CSFML 3** (the C API), not SFML's C++ API directly, so the scope below is
|
|
6
|
+
CSFML 3.0.0's actual header set — not every C++-only construct in the
|
|
7
|
+
[reference docs](https://www.sfml-dev.org/documentation/3.1.0/annotated.html). Out of scope for that
|
|
8
|
+
reason: `String`/`Utf`/`Literals` (SFML C++ uses `std::string`; CSFML takes plain C strings),
|
|
9
|
+
`Exception` (CSFML reports errors via return codes, not C++ exceptions), and C++-utility-only types
|
|
10
|
+
(`SuspendAwareClock`, `TimeoutWithPredicate`, `U8StringCharTraits`). `Glsl` is handled as plain
|
|
11
|
+
`set_*_uniform` calls (its types are CSFML structs, not a templated class), and `InputStream`'s C
|
|
12
|
+
struct form *is* bound (`SFML::InputStream`). `Sftp` is also out of scope: it was added to SFML in
|
|
13
|
+
3.1, and the CSFML 3.0.0 this gem vendors predates it.
|
|
14
|
+
|
|
15
|
+
Status legend: `[x]` bound and tested · `[~]` compiled but not exposed to Ruby, or exposed as an
|
|
16
|
+
internal helper only · `[ ]` not started.
|
|
17
|
+
|
|
18
|
+
**Coverage is tracked per function, not per class.** Every `sf*` entry point in
|
|
19
|
+
`ports/<target>/include/CSFML` is accounted for: bound, or listed in "Deliberately unbound" at the
|
|
20
|
+
bottom. Re-derive the list with:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
grep -rhoE '\bsf[A-Za-z0-9_]+\s*\(' ports/<target>/include/CSFML --include='*.h' \
|
|
24
|
+
| tr -d ' (' | sort -u > /tmp/api.txt
|
|
25
|
+
grep -rhoE '\bsf[A-Za-z0-9_]+' ext --include='*.c' --include='*.h' --include='*.inc' \
|
|
26
|
+
| sort -u > /tmp/used.txt
|
|
27
|
+
comm -23 /tmp/api.txt /tmp/used.txt
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Mind the false positives: functions reached through token paste (`sfSound_*`, `sfMusic_*`,
|
|
31
|
+
`sfSoundStream_*` from `ext/audio/sound_source.inc`; `sfPacket_read*`/`write*` from the macro in
|
|
32
|
+
`ext/network/packet.c`; the shared `sfRenderWindow_*`/`sfRenderTexture_*` render-target methods
|
|
33
|
+
from `ext/graphics/render_target.inc`) never appear literally in the sources and so show up as
|
|
34
|
+
"missing" every time.
|
|
35
|
+
|
|
36
|
+
## System
|
|
37
|
+
|
|
38
|
+
Base module: time, vectors, clocks, streams.
|
|
39
|
+
|
|
40
|
+
- [x] **Clock** — `SFML::Clock` (`ext/system/clock.c`); `elapsed_time`, `restart!`, `reset!`,
|
|
41
|
+
`start!`, `stop!`, `running?`, `copy`
|
|
42
|
+
- [x] **Vector2** — `SFML::Vector2` (`ext/system/vec2.c`); setters still accept `[x, y]`
|
|
43
|
+
- [x] **Vector3** — `SFML::Vector3` (`ext/system/vec3.c`)
|
|
44
|
+
- [x] **Time** — `SFML::Time` (`ext/system/time.c`); arithmetic, comparison, unit conversions
|
|
45
|
+
- [x] **Sleep** — `SFML.sleep` (`ext/system/sleep.c`)
|
|
46
|
+
- [x] **InputStream** — `SFML::InputStream` (`ext/system/input_stream.c`); wraps any `#read`-able
|
|
47
|
+
object and is accepted by every `from_stream` constructor
|
|
48
|
+
- [x] **Buffer** — `SFML::Buffer` (`ext/system/buffer.c`); returned by `Image#save_to_memory`
|
|
49
|
+
|
|
50
|
+
## Window
|
|
51
|
+
|
|
52
|
+
OpenGL-based windows, events, input handling.
|
|
53
|
+
|
|
54
|
+
- [x] **Window** — `SFML::Window` (`ext/window/window.c`); wraps `sfRenderWindow`, so this single
|
|
55
|
+
class covers what SFML splits into `WindowBase` + `Window` + `RenderWindow`. Accepts style,
|
|
56
|
+
state and `ContextSettings`; exposes min/max size, icon, cursor, native handle, settings.
|
|
57
|
+
- [x] **VideoMode** — `SFML::VideoMode` (`ext/window/video_mode.c`); includes `desktop_mode` and
|
|
58
|
+
`fullscreen_modes`
|
|
59
|
+
- [x] **Event** — `SFML::Event` (`ext/window/event.c`, `ext/window/event_name.c`); every payload is
|
|
60
|
+
exposed — text, key, mouse move/raw/button/wheel, joystick move/button/connect, touch, sensor
|
|
61
|
+
- [x] **Keyboard** — `SFML::Keyboard` (`ext/window/keyboard.c`); real-time `pressed?`,
|
|
62
|
+
`scancode_pressed?`, `localize`, `delocalize`, `description`, virtual-keyboard toggle
|
|
63
|
+
- [x] **Mouse** — `SFML::Mouse` (`ext/window/mouse.c`)
|
|
64
|
+
- [x] **Joystick** — `SFML::Joystick` (`ext/window/joystick.c`)
|
|
65
|
+
- [x] **Touch** — `SFML::Touch` (`ext/window/touch.c`)
|
|
66
|
+
- [x] **Sensor** — `SFML::Sensor` (`ext/window/sensor.c`)
|
|
67
|
+
- [x] **Clipboard** — `SFML::Clipboard` (`ext/window/clipboard.c`)
|
|
68
|
+
- [x] **Cursor** — `SFML::Cursor` (`ext/window/cursor.c`)
|
|
69
|
+
- [x] **Context** / **ContextSettings** — `SFML::Context`, `SFML::ContextSettings`
|
|
70
|
+
(`ext/window/context.c`, `ext/window/context_settings.c`)
|
|
71
|
+
- [x] **Vulkan** — `SFML::Vulkan` (`ext/window/vulkan.c`)
|
|
72
|
+
|
|
73
|
+
## Graphics
|
|
74
|
+
|
|
75
|
+
2D rendering: shapes, sprites, text, render targets.
|
|
76
|
+
|
|
77
|
+
- [x] **Transform** — `SFML::Transform` (`ext/graphics/transform.c`); a class wrapping
|
|
78
|
+
`sfTransform` by value. `identity`/`IDENTITY` (frozen), `from_a`, `to_a`/`matrix` (3x3),
|
|
79
|
+
`gl_matrix` (the 16-float 4x4 for `glLoadMatrixf`), `==`, `translate!`, `rotate!`, `scale!`
|
|
80
|
+
(both taking an optional centre), non-mutating `translate`/`rotate`/`scale`,
|
|
81
|
+
`transform_point`, `transform_rect`, `combine!`, `*`, `inverse`, `copy`. The old module
|
|
82
|
+
functions `Transform.combine`/`Transform.inverse` remain, Array-in/Array-out. Every class
|
|
83
|
+
that exposes `#transform` still returns a plain 9-element Array, and anything that *takes*
|
|
84
|
+
a transform accepts either form
|
|
85
|
+
- [x] **Transformable** — `SFML::Transformable` (`ext/graphics/transformable.c`); including
|
|
86
|
+
`inverse_transform` and `copy`
|
|
87
|
+
- [x] **Drawable** — `SFML::Drawable` mixin (`ext/graphics/drawable.c`)
|
|
88
|
+
- [x] **RenderStates** — `SFML::RenderState` (`ext/graphics/render_state.c`); blend mode, stencil
|
|
89
|
+
mode, coordinate type, texture, shader and transform are all settable
|
|
90
|
+
- [x] **RenderTarget** — `SFML::Target` (`ext/graphics/target.c`) dispatches to `sfRenderWindow_*`
|
|
91
|
+
or `sfRenderTexture_*` at runtime for `Drawable#draw`. The methods each concrete target owns
|
|
92
|
+
directly — `map_pixel_to_coords`, `map_coords_to_pixel`, `push_gl_states`, `pop_gl_states`,
|
|
93
|
+
`reset_gl_states`, `draw_primitives`, `draw_vertex_buffer_range`, `clear_stencil`,
|
|
94
|
+
`clear_color_and_stencil`, `viewport`, `scissor`, `srgb?` — are generated once for both
|
|
95
|
+
`Window` and `RenderTexture` from `ext/graphics/render_target.inc`
|
|
96
|
+
- [x] **RenderWindow** — folded into `SFML::Window` (see Window module above)
|
|
97
|
+
- [x] **RenderTexture** — `SFML::RenderTexture` (`ext/graphics/render_texture.c`)
|
|
98
|
+
- [x] **View** — `SFML::View` (`ext/graphics/view.c`); including `View.from_rect` and
|
|
99
|
+
`scissor`/`scissor=`
|
|
100
|
+
- [x] **CircleShape** — `SFML::Circle` (`ext/graphics/circle.c`)
|
|
101
|
+
- [x] **RectangleShape** — `SFML::RectangleShape` (`ext/graphics/rectangle.c`)
|
|
102
|
+
- [x] **ConvexShape** — `SFML::ConvexShape` (`ext/graphics/polygon.c`)
|
|
103
|
+
- [x] **Shape** — `SFML::Shape` (`ext/graphics/shape.c`); subclass and define `point_count`/`point`
|
|
104
|
+
- [x] **Sprite** — `SFML::Sprite` (`ext/graphics/sprite.c`)
|
|
105
|
+
- [x] **Texture** — `SFML::Texture` (`ext/graphics/texture.c`); every constructor in both linear
|
|
106
|
+
and sRGB form, plus `resize`/`resize_srgb` and `swap`
|
|
107
|
+
- [x] **Image** — `SFML::Image` (`ext/graphics/image.c`)
|
|
108
|
+
- [x] **Font** — `SFML::Font` (`ext/graphics/font.c`)
|
|
109
|
+
- [x] **Text** — `SFML::Text` (`ext/graphics/text.c`); `#string` goes through the UTF-32 entry
|
|
110
|
+
points, so non-ASCII round-trips exactly
|
|
111
|
+
- [x] **Glyph** — `SFML::Glyph` (`ext/graphics/glyph.c`)
|
|
112
|
+
- [x] **Shader** — `SFML::Shader` (`ext/graphics/shader.c`); scalar/vector/color/int/bool/matrix
|
|
113
|
+
uniforms, all six array uniforms (float, vec2-4, mat3, mat4), plus a generic `uniform=`
|
|
114
|
+
- [x] **Color** — `SFML::Color` (`ext/graphics/color.c`)
|
|
115
|
+
- [x] **Rect** — `SFML::Rect` (`ext/graphics/rect.c`); `sfFloatRect` and `sfIntRect`
|
|
116
|
+
- [x] **BlendMode** — `SFML::BlendMode` (`ext/graphics/blend_mode.c`)
|
|
117
|
+
- [x] **StencilMode** — `SFML::StencilMode` (`ext/graphics/stencil_mode.c`)
|
|
118
|
+
- [x] **Vertex** / **VertexArray** / **VertexBuffer** — `ext/graphics/vertex*.c`
|
|
119
|
+
|
|
120
|
+
## Audio
|
|
121
|
+
|
|
122
|
+
Sounds, streaming, recording, spatialization.
|
|
123
|
+
|
|
124
|
+
- [x] **Listener** — `SFML::Listener` (`ext/audio/listener.c`); global volume plus
|
|
125
|
+
position/direction/velocity/up-vector/cone
|
|
126
|
+
- [x] **ListenerCone** / **SoundSourceCone** — `SFML::SoundSourceCone` (`ext/audio/sound_source_cone.c`)
|
|
127
|
+
- [x] **SoundSource** — the shared play/pause/stop/status, pitch, pan, volume, spatialization,
|
|
128
|
+
position/direction/velocity, cone, doppler/directional-attenuation, min/max distance/gain,
|
|
129
|
+
attenuation, playing-offset and effect-processor surface, generated per class from
|
|
130
|
+
`ext/audio/sound_source.inc`
|
|
131
|
+
- [x] **SoundStatus** / **SoundChannel** — `SFML::SoundStatus`, `SFML::SoundChannel`
|
|
132
|
+
(`ext/audio/audio_enums.c`)
|
|
133
|
+
- [x] **SoundBuffer** — `SFML::SoundBuffer` (`ext/audio/sound_buffer.c`); loading from file, memory,
|
|
134
|
+
stream and raw samples, saving, sample access and channel map
|
|
135
|
+
- [x] **Sound** — `SFML::Sound` (`ext/audio/sound.c`)
|
|
136
|
+
- [x] **SoundStream** — `SFML::SoundStream` (`ext/audio/sound_stream.c`); subclass and implement
|
|
137
|
+
`#on_get_data` (and optionally `#on_seek`)
|
|
138
|
+
- [x] **SoundBufferRecorder** — `SFML::SoundBufferRecorder` (`ext/audio/sound_buffer_recorder.c`)
|
|
139
|
+
- [x] **SoundRecorder** — `SFML::SoundRecorder` (`ext/audio/sound_recorder.c`); subclass and
|
|
140
|
+
implement `#on_process` (and optionally `#on_start`/`#on_stop`)
|
|
141
|
+
- [x] **Music** — `SFML::Music` (`ext/audio/music.c`); file, memory and stream sources, loop points
|
|
142
|
+
- [x] **EffectProcessor** — `SFML::SoundSource#effect_processor=`; a Ruby proc is dispatched through
|
|
143
|
+
a bounded pool of C thunks (`ext/audio/effect_processor.c`), because `sfEffectProcessor` has
|
|
144
|
+
no `userData` to identify the source
|
|
145
|
+
- [x] **Build support** — `ext/ports.rb` builds Ogg 1.3.5, Vorbis 1.3.7 and FLAC 1.4.3 as pinned,
|
|
146
|
+
static, position-independent ports (SFML 3's audio backend is miniaudio, so no OpenAL), and
|
|
147
|
+
enables `SFML_BUILD_AUDIO` / `CSFML_BUILD_AUDIO`
|
|
148
|
+
|
|
149
|
+
## Network
|
|
150
|
+
|
|
151
|
+
Socket-based communication and higher-level protocols.
|
|
152
|
+
|
|
153
|
+
- [x] **IpAddress** — `SFML::IpAddress` (`ext/network/ip_address.c`); string/bytes/integer
|
|
154
|
+
constructors, `NONE`/`ANY`/`LOCAL_HOST`/`BROADCAST`, local and public address lookup
|
|
155
|
+
- [x] **Packet** — `SFML::Packet` (`ext/network/packet.c`); raw data plus every typed reader/writer
|
|
156
|
+
(booleans, all integer widths, floats, string)
|
|
157
|
+
- [x] **SocketSelector** — `SFML::SocketSelector` (`ext/network/socket_selector.c`); add/remove for
|
|
158
|
+
each socket type, wait and readiness checks
|
|
159
|
+
- [x] **TcpSocket** / **TcpListener** — `SFML::TcpSocket`, `SFML::TcpListener`
|
|
160
|
+
(`ext/network/tcp_socket.c`, `ext/network/tcp_listener.c`); connect/accept, blocking control,
|
|
161
|
+
raw and packet sends/receives
|
|
162
|
+
- [x] **UdpSocket** — `SFML::UdpSocket` (`ext/network/udp_socket.c`); bind/send/receive and packet
|
|
163
|
+
variants, datagram size and any-port helpers
|
|
164
|
+
- [x] **Http** — `SFML::Http`, `SFML::HttpRequest`, `SFML::HttpResponse` (`ext/network/http.c`)
|
|
165
|
+
- [x] **Ftp** — `SFML::Ftp`, `SFML::FtpResponse`, `SFML::FtpDirectoryResponse`,
|
|
166
|
+
`SFML::FtpListingResponse` (`ext/network/ftp.c`)
|
|
167
|
+
- [x] **SocketStatus** / **HttpMethod** / **HttpStatus** / **FtpStatus** / **FtpTransferMode** —
|
|
168
|
+
enum modules (`ext/network/network_enums.c`)
|
|
169
|
+
- [x] **Build support** — `ext/ports.rb` enables `SFML_BUILD_NETWORK` / `CSFML_BUILD_NETWORK`; the
|
|
170
|
+
module needs no external dependency (just `ws2_32` on Windows)
|
|
171
|
+
|
|
172
|
+
Note that CSFML exposes no `sfSocket` base class, so there is nothing to bind for "Socket base" —
|
|
173
|
+
only the concrete TCP/UDP sockets and the selector.
|
|
174
|
+
|
|
175
|
+
## Deliberately unbound
|
|
176
|
+
|
|
177
|
+
These CSFML entry points have no Ruby surface on purpose. Listed so a coverage diff can be read
|
|
178
|
+
without re-deriving the reasoning each time.
|
|
179
|
+
|
|
180
|
+
| Symbols | Why |
|
|
181
|
+
| --- | --- |
|
|
182
|
+
| `sfWindow_*`, `sfWindowBase_*` (~55 functions) | `SFML::Window` wraps `sfRenderWindow`, which subsumes both a plain window and a base window. |
|
|
183
|
+
| `sfMouse_*WindowBase`, `sfTouch_getPositionWindowBase` | Superseded by the `*RenderWindow` forms, which need no downcast. |
|
|
184
|
+
| `sfRenderWindow_create`, `sfText_getString`/`setString`, `sfRenderWindow_setTitle`, `sfFtpDirectoryResponse_getDirectory` | Superseded by their `*Unicode` counterparts; the narrow forms decode through the C locale and mangle non-ASCII. |
|
|
185
|
+
| `sfColor_add`/`subtract`/`modulate`/`fromRGB`/`fromRGBA`/`fromInteger`/`toInteger`, `sfIntRect_contains`/`intersects` | Reimplemented directly in C in `color.c` / `rect.c`; the Ruby methods exist. |
|
|
186
|
+
| `sfSprite_getTexture`, `sfText_getFont`, `sf*Shape_getTexture` | The Ruby getters return the cached wrapper object. CSFML returns a non-owning pointer, so re-wrapping it would hand Ruby an object it must not free. |
|
|
187
|
+
| `sfShape_getPoint`, `sfShape_getPointCount` | `SFML::Shape` reads these from the Ruby subclass, which is where they are defined. |
|
|
188
|
+
| `sfTexture_updateFromWindow` | `Texture#update_from_window` uses `sfTexture_updateFromRenderWindow`, since `SFML::Window` is a render window. |
|
|
189
|
+
| `sfFree` | CSFML's allocator hook; nothing in a Ruby binding should call it. |
|
|
190
|
+
| `sfGlslVec4_fromsfColor`, `sfGlslIvec4_fromsfColor` | Documentation-only helpers; `Shader#set_color` does the conversion. |
|
|
191
|
+
|
|
192
|
+
## References
|
|
193
|
+
|
|
194
|
+
- [SFML 3.1.0 module topics](https://www.sfml-dev.org/documentation/3.1.0/topics.html)
|
|
195
|
+
- [SFML 3.1.0 class index](https://www.sfml-dev.org/documentation/3.1.0/annotated.html)
|
|
196
|
+
- [SFML 3.1.0 namespace index](https://www.sfml-dev.org/documentation/3.1.0/namespaces.html)
|
|
197
|
+
- [CSFML 3.0.0 headers](https://github.com/SFML/CSFML/tree/3.0.0/include/CSFML) — the actual C API
|
|
198
|
+
surface this gem binds against, vendored locally under `ports/<target>/include/CSFML/`
|
|
199
|
+
once `rake ports` has run
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/sfml/version.rb
ADDED
data/lib/sfml.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'sfml/version'
|
|
4
|
+
|
|
5
|
+
begin
|
|
6
|
+
# Binary gems ship one extension per Ruby ABI under lib/sfml/<major.minor>/.
|
|
7
|
+
# A gem built from source installs a single lib/sfml/sfml_ext.so instead.
|
|
8
|
+
require "sfml/#{RUBY_VERSION[/\d+\.\d+/]}/sfml_ext"
|
|
9
|
+
rescue LoadError
|
|
10
|
+
require 'sfml/sfml_ext'
|
|
11
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
module SoundStatus
|
|
3
|
+
STOPPED: Integer
|
|
4
|
+
PAUSED: Integer
|
|
5
|
+
PLAYING: Integer
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module SoundChannel
|
|
9
|
+
UNSPECIFIED: Integer
|
|
10
|
+
MONO: Integer
|
|
11
|
+
FRONT_LEFT: Integer
|
|
12
|
+
FRONT_RIGHT: Integer
|
|
13
|
+
FRONT_CENTER: Integer
|
|
14
|
+
FRONT_LEFT_OF_CENTER: Integer
|
|
15
|
+
FRONT_RIGHT_OF_CENTER: Integer
|
|
16
|
+
LOW_FREQUENCY_EFFECTS: Integer
|
|
17
|
+
BACK_LEFT: Integer
|
|
18
|
+
BACK_RIGHT: Integer
|
|
19
|
+
BACK_CENTER: Integer
|
|
20
|
+
SIDE_LEFT: Integer
|
|
21
|
+
SIDE_RIGHT: Integer
|
|
22
|
+
TOP_CENTER: Integer
|
|
23
|
+
TOP_FRONT_LEFT: Integer
|
|
24
|
+
TOP_FRONT_RIGHT: Integer
|
|
25
|
+
TOP_FRONT_CENTER: Integer
|
|
26
|
+
TOP_BACK_LEFT: Integer
|
|
27
|
+
TOP_BACK_RIGHT: Integer
|
|
28
|
+
TOP_BACK_CENTER: Integer
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
module Listener
|
|
3
|
+
def self.global_volume: () -> Float
|
|
4
|
+
def self.global_volume=: (Float value) -> Float
|
|
5
|
+
def self.position: () -> Vector3
|
|
6
|
+
def self.position=: (Vector3 value) -> Vector3
|
|
7
|
+
def self.direction: () -> Vector3
|
|
8
|
+
def self.direction=: (Vector3 value) -> Vector3
|
|
9
|
+
def self.velocity: () -> Vector3
|
|
10
|
+
def self.velocity=: (Vector3 value) -> Vector3
|
|
11
|
+
def self.up_vector: () -> Vector3
|
|
12
|
+
def self.up_vector=: (Vector3 value) -> Vector3
|
|
13
|
+
def self.cone: () -> SoundSourceCone
|
|
14
|
+
def self.cone=: (SoundSourceCone value) -> SoundSourceCone
|
|
15
|
+
end
|
|
16
|
+
end
|
data/sig/audio/music.rbs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class Music
|
|
3
|
+
def self.from_file: (String path) -> Music
|
|
4
|
+
def self.from_memory: (String data) -> Music
|
|
5
|
+
def self.from_stream: (untyped stream) -> Music
|
|
6
|
+
|
|
7
|
+
def duration: () -> Time
|
|
8
|
+
def channel_count: () -> Integer
|
|
9
|
+
def sample_rate: () -> Integer
|
|
10
|
+
def channel_map: () -> Array[Symbol]
|
|
11
|
+
def loop_points: () -> [Time, Time]
|
|
12
|
+
def loop_points=: ([Time, Time] value) -> [Time, Time]
|
|
13
|
+
|
|
14
|
+
def play: () -> self
|
|
15
|
+
def pause: () -> self
|
|
16
|
+
def stop: () -> self
|
|
17
|
+
def status: () -> (:stopped | :paused | :playing)
|
|
18
|
+
def looping?: () -> bool
|
|
19
|
+
def looping=: (bool value) -> bool
|
|
20
|
+
def pitch: () -> Float
|
|
21
|
+
def pitch=: (Float value) -> Float
|
|
22
|
+
def pan: () -> Float
|
|
23
|
+
def pan=: (Float value) -> Float
|
|
24
|
+
def volume: () -> Float
|
|
25
|
+
def volume=: (Float value) -> Float
|
|
26
|
+
def spatialization_enabled?: () -> bool
|
|
27
|
+
def spatialization_enabled=: (bool value) -> bool
|
|
28
|
+
def position: () -> Vector3
|
|
29
|
+
def position=: (Vector3 value) -> Vector3
|
|
30
|
+
def direction: () -> Vector3
|
|
31
|
+
def direction=: (Vector3 value) -> Vector3
|
|
32
|
+
def velocity: () -> Vector3
|
|
33
|
+
def velocity=: (Vector3 value) -> Vector3
|
|
34
|
+
def cone: () -> SoundSourceCone
|
|
35
|
+
def cone=: (SoundSourceCone value) -> SoundSourceCone
|
|
36
|
+
def doppler_factor: () -> Float
|
|
37
|
+
def doppler_factor=: (Float value) -> Float
|
|
38
|
+
def directional_attenuation_factor: () -> Float
|
|
39
|
+
def directional_attenuation_factor=: (Float value) -> Float
|
|
40
|
+
def relative_to_listener?: () -> bool
|
|
41
|
+
def relative_to_listener=: (bool value) -> bool
|
|
42
|
+
def min_distance: () -> Float
|
|
43
|
+
def min_distance=: (Float value) -> Float
|
|
44
|
+
def max_distance: () -> Float
|
|
45
|
+
def max_distance=: (Float value) -> Float
|
|
46
|
+
def min_gain: () -> Float
|
|
47
|
+
def min_gain=: (Float value) -> Float
|
|
48
|
+
def max_gain: () -> Float
|
|
49
|
+
def max_gain=: (Float value) -> Float
|
|
50
|
+
def attenuation: () -> Float
|
|
51
|
+
def attenuation=: (Float value) -> Float
|
|
52
|
+
def playing_offset: () -> Time
|
|
53
|
+
def playing_offset=: (Time value) -> Time
|
|
54
|
+
def effect_processor=: (Proc proc) -> Proc
|
|
55
|
+
end
|
|
56
|
+
end
|
data/sig/audio/sound.rbs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class Sound
|
|
3
|
+
def self.new: (SoundBuffer buffer) -> Sound
|
|
4
|
+
|
|
5
|
+
def copy: () -> Sound
|
|
6
|
+
def buffer: () -> SoundBuffer
|
|
7
|
+
def buffer=: (SoundBuffer value) -> SoundBuffer
|
|
8
|
+
|
|
9
|
+
def play: () -> self
|
|
10
|
+
def pause: () -> self
|
|
11
|
+
def stop: () -> self
|
|
12
|
+
def status: () -> (:stopped | :paused | :playing)
|
|
13
|
+
def looping?: () -> bool
|
|
14
|
+
def looping=: (bool value) -> bool
|
|
15
|
+
def pitch: () -> Float
|
|
16
|
+
def pitch=: (Float value) -> Float
|
|
17
|
+
def pan: () -> Float
|
|
18
|
+
def pan=: (Float value) -> Float
|
|
19
|
+
def volume: () -> Float
|
|
20
|
+
def volume=: (Float value) -> Float
|
|
21
|
+
def spatialization_enabled?: () -> bool
|
|
22
|
+
def spatialization_enabled=: (bool value) -> bool
|
|
23
|
+
def position: () -> Vector3
|
|
24
|
+
def position=: (Vector3 value) -> Vector3
|
|
25
|
+
def direction: () -> Vector3
|
|
26
|
+
def direction=: (Vector3 value) -> Vector3
|
|
27
|
+
def velocity: () -> Vector3
|
|
28
|
+
def velocity=: (Vector3 value) -> Vector3
|
|
29
|
+
def cone: () -> SoundSourceCone
|
|
30
|
+
def cone=: (SoundSourceCone value) -> SoundSourceCone
|
|
31
|
+
def doppler_factor: () -> Float
|
|
32
|
+
def doppler_factor=: (Float value) -> Float
|
|
33
|
+
def directional_attenuation_factor: () -> Float
|
|
34
|
+
def directional_attenuation_factor=: (Float value) -> Float
|
|
35
|
+
def relative_to_listener?: () -> bool
|
|
36
|
+
def relative_to_listener=: (bool value) -> bool
|
|
37
|
+
def min_distance: () -> Float
|
|
38
|
+
def min_distance=: (Float value) -> Float
|
|
39
|
+
def max_distance: () -> Float
|
|
40
|
+
def max_distance=: (Float value) -> Float
|
|
41
|
+
def min_gain: () -> Float
|
|
42
|
+
def min_gain=: (Float value) -> Float
|
|
43
|
+
def max_gain: () -> Float
|
|
44
|
+
def max_gain=: (Float value) -> Float
|
|
45
|
+
def attenuation: () -> Float
|
|
46
|
+
def attenuation=: (Float value) -> Float
|
|
47
|
+
def playing_offset: () -> Time
|
|
48
|
+
def playing_offset=: (Time value) -> Time
|
|
49
|
+
def effect_processor=: (Proc proc) -> Proc
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class SoundBuffer
|
|
3
|
+
def self.from_file: (String path) -> SoundBuffer
|
|
4
|
+
def self.from_memory: (String data) -> SoundBuffer
|
|
5
|
+
def self.from_stream: (untyped stream) -> SoundBuffer
|
|
6
|
+
def self.from_samples: (Array[Integer] | String samples, Integer channel_count, Integer sample_rate, ?Array[Symbol] channel_map) -> SoundBuffer
|
|
7
|
+
|
|
8
|
+
def copy: () -> SoundBuffer
|
|
9
|
+
def save_to_file: (String path) -> bool
|
|
10
|
+
def samples: () -> Array[Integer]
|
|
11
|
+
def sample_count: () -> Integer
|
|
12
|
+
def sample_rate: () -> Integer
|
|
13
|
+
def channel_count: () -> Integer
|
|
14
|
+
def channel_map: () -> Array[Symbol]
|
|
15
|
+
def duration: () -> Time
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class SoundBufferRecorder
|
|
3
|
+
def self.new: () -> SoundBufferRecorder
|
|
4
|
+
|
|
5
|
+
def start: (Integer sample_rate) -> bool
|
|
6
|
+
def stop: () -> self
|
|
7
|
+
def sample_rate: () -> Integer
|
|
8
|
+
def buffer: () -> SoundBuffer
|
|
9
|
+
def device: () -> String
|
|
10
|
+
def device=: (String value) -> bool
|
|
11
|
+
def channel_count: () -> Integer
|
|
12
|
+
def channel_count=: (Integer value) -> Integer
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class SoundRecorder
|
|
3
|
+
def self.new: () -> SoundRecorder
|
|
4
|
+
def self.available?: () -> bool
|
|
5
|
+
def self.available_devices: () -> Array[String]
|
|
6
|
+
def self.default_device: () -> String?
|
|
7
|
+
|
|
8
|
+
def start: (Integer sample_rate) -> bool
|
|
9
|
+
def stop: () -> self
|
|
10
|
+
def sample_rate: () -> Integer
|
|
11
|
+
def device: () -> String?
|
|
12
|
+
def device=: (String value) -> bool
|
|
13
|
+
def channel_count: () -> Integer
|
|
14
|
+
def channel_count=: (Integer value) -> Integer
|
|
15
|
+
def channel_map: () -> Array[Symbol]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class SoundSourceCone
|
|
3
|
+
def self.new: (Float inner_angle, Float outer_angle, Float outer_gain) -> SoundSourceCone
|
|
4
|
+
|
|
5
|
+
def inner_angle: () -> Float
|
|
6
|
+
def inner_angle=: (Float value) -> Float
|
|
7
|
+
def outer_angle: () -> Float
|
|
8
|
+
def outer_angle=: (Float value) -> Float
|
|
9
|
+
def outer_gain: () -> Float
|
|
10
|
+
def outer_gain=: (Float value) -> Float
|
|
11
|
+
def to_a: () -> [Float, Float, Float]
|
|
12
|
+
def ==: (untyped other) -> bool
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class SoundStream
|
|
3
|
+
def self.new: (Integer channel_count, Integer sample_rate, ?Array[Symbol] channel_map) -> SoundStream
|
|
4
|
+
|
|
5
|
+
def channel_count: () -> Integer
|
|
6
|
+
def sample_rate: () -> Integer
|
|
7
|
+
def channel_map: () -> Array[Symbol]
|
|
8
|
+
|
|
9
|
+
def play: () -> self
|
|
10
|
+
def pause: () -> self
|
|
11
|
+
def stop: () -> self
|
|
12
|
+
def status: () -> (:stopped | :paused | :playing)
|
|
13
|
+
def looping?: () -> bool
|
|
14
|
+
def looping=: (bool value) -> bool
|
|
15
|
+
def pitch: () -> Float
|
|
16
|
+
def pitch=: (Float value) -> Float
|
|
17
|
+
def pan: () -> Float
|
|
18
|
+
def pan=: (Float value) -> Float
|
|
19
|
+
def volume: () -> Float
|
|
20
|
+
def volume=: (Float value) -> Float
|
|
21
|
+
def spatialization_enabled?: () -> bool
|
|
22
|
+
def spatialization_enabled=: (bool value) -> bool
|
|
23
|
+
def position: () -> Vector3
|
|
24
|
+
def position=: (Vector3 value) -> Vector3
|
|
25
|
+
def direction: () -> Vector3
|
|
26
|
+
def direction=: (Vector3 value) -> Vector3
|
|
27
|
+
def velocity: () -> Vector3
|
|
28
|
+
def velocity=: (Vector3 value) -> Vector3
|
|
29
|
+
def cone: () -> SoundSourceCone
|
|
30
|
+
def cone=: (SoundSourceCone value) -> SoundSourceCone
|
|
31
|
+
def doppler_factor: () -> Float
|
|
32
|
+
def doppler_factor=: (Float value) -> Float
|
|
33
|
+
def directional_attenuation_factor: () -> Float
|
|
34
|
+
def directional_attenuation_factor=: (Float value) -> Float
|
|
35
|
+
def relative_to_listener?: () -> bool
|
|
36
|
+
def relative_to_listener=: (bool value) -> bool
|
|
37
|
+
def min_distance: () -> Float
|
|
38
|
+
def min_distance=: (Float value) -> Float
|
|
39
|
+
def max_distance: () -> Float
|
|
40
|
+
def max_distance=: (Float value) -> Float
|
|
41
|
+
def min_gain: () -> Float
|
|
42
|
+
def min_gain=: (Float value) -> Float
|
|
43
|
+
def max_gain: () -> Float
|
|
44
|
+
def max_gain=: (Float value) -> Float
|
|
45
|
+
def attenuation: () -> Float
|
|
46
|
+
def attenuation=: (Float value) -> Float
|
|
47
|
+
def playing_offset: () -> Time
|
|
48
|
+
def playing_offset=: (Time value) -> Time
|
|
49
|
+
def effect_processor=: (Proc proc) -> Proc
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class BlendMode
|
|
3
|
+
def self.new: () -> BlendMode
|
|
4
|
+
| (Symbol | Integer color_src_factor, Symbol | Integer color_dst_factor,
|
|
5
|
+
Symbol | Integer color_equation, Symbol | Integer alpha_src_factor,
|
|
6
|
+
Symbol | Integer alpha_dst_factor, Symbol | Integer alpha_equation) -> BlendMode
|
|
7
|
+
|
|
8
|
+
def color_src_factor: () -> Symbol
|
|
9
|
+
def color_src_factor=: (Symbol | Integer value) -> Symbol
|
|
10
|
+
def color_dst_factor: () -> Symbol
|
|
11
|
+
def color_dst_factor=: (Symbol | Integer value) -> Symbol
|
|
12
|
+
def color_equation: () -> Symbol
|
|
13
|
+
def color_equation=: (Symbol | Integer value) -> Symbol
|
|
14
|
+
def alpha_src_factor: () -> Symbol
|
|
15
|
+
def alpha_src_factor=: (Symbol | Integer value) -> Symbol
|
|
16
|
+
def alpha_dst_factor: () -> Symbol
|
|
17
|
+
def alpha_dst_factor=: (Symbol | Integer value) -> Symbol
|
|
18
|
+
def alpha_equation: () -> Symbol
|
|
19
|
+
def alpha_equation=: (Symbol | Integer value) -> Symbol
|
|
20
|
+
def ==: (untyped other) -> bool
|
|
21
|
+
|
|
22
|
+
NONE: BlendMode
|
|
23
|
+
ALPHA: BlendMode
|
|
24
|
+
ADD: BlendMode
|
|
25
|
+
MULTIPLY: BlendMode
|
|
26
|
+
MIN: BlendMode
|
|
27
|
+
MAX: BlendMode
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class Circle
|
|
3
|
+
include Drawable
|
|
4
|
+
|
|
5
|
+
def self.new: (?Float radius) -> Circle
|
|
6
|
+
|
|
7
|
+
def copy: () -> Circle
|
|
8
|
+
def move: (Vector2 | Array[Float] offset) -> self
|
|
9
|
+
def rotate: (Float angle) -> self
|
|
10
|
+
def scale!: (Vector2 | Array[Float] factors) -> self
|
|
11
|
+
def draw: (untyped target, RenderState state) -> nil
|
|
12
|
+
|
|
13
|
+
def radius=: (Float value) -> Float
|
|
14
|
+
def position=: (Vector2 | Array[Float] value) -> Vector2
|
|
15
|
+
def rotation=: (Float value) -> Float
|
|
16
|
+
def scale=: (Vector2 | Array[Float] value) -> Vector2
|
|
17
|
+
def origin=: (Vector2 | Array[Float] value) -> Vector2
|
|
18
|
+
def fill_color=: (Color value) -> Color
|
|
19
|
+
def outline_color=: (Color value) -> Color
|
|
20
|
+
def outline_thickness=: (Float value) -> Float
|
|
21
|
+
def texture=: (Texture? value) -> Texture?
|
|
22
|
+
def texture_rect=: (Rect value) -> Rect
|
|
23
|
+
def point_count=: (Integer value) -> self
|
|
24
|
+
|
|
25
|
+
def radius: () -> Float
|
|
26
|
+
def position: () -> Vector2
|
|
27
|
+
def rotation: () -> Float
|
|
28
|
+
def scale: () -> Vector2
|
|
29
|
+
def origin: () -> Vector2
|
|
30
|
+
def fill_color: () -> Color
|
|
31
|
+
def outline_color: () -> Color
|
|
32
|
+
def outline_thickness: () -> Float
|
|
33
|
+
def texture: () -> (Texture | nil)
|
|
34
|
+
def texture_rect: () -> Rect
|
|
35
|
+
def point_count: () -> Integer
|
|
36
|
+
def point: (Integer index) -> Vector2
|
|
37
|
+
def geometric_center: () -> Vector2
|
|
38
|
+
def local_bounds: () -> Rect
|
|
39
|
+
def global_bounds: () -> Rect
|
|
40
|
+
def transform: () -> Array[untyped]
|
|
41
|
+
def inverse_transform: () -> Array[untyped]
|
|
42
|
+
def matrix: () -> Array[untyped]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class Color
|
|
3
|
+
def self.new: () -> Color
|
|
4
|
+
| (Integer r, Integer g, Integer b, ?Integer a) -> Color
|
|
5
|
+
| (Array[Integer] rgb_or_rgba) -> Color
|
|
6
|
+
| (Integer packed) -> Color
|
|
7
|
+
| (Color other) -> Color
|
|
8
|
+
def self.from_rgb: (Integer rgb) -> Color
|
|
9
|
+
def self.from_rgba: (Integer rgba) -> Color
|
|
10
|
+
def self.from_integer: (Integer rgba) -> Color
|
|
11
|
+
|
|
12
|
+
def r: () -> Integer
|
|
13
|
+
def r=: (Integer value) -> Integer
|
|
14
|
+
def g: () -> Integer
|
|
15
|
+
def g=: (Integer value) -> Integer
|
|
16
|
+
def b: () -> Integer
|
|
17
|
+
def b=: (Integer value) -> Integer
|
|
18
|
+
def a: () -> Integer
|
|
19
|
+
def a=: (Integer value) -> Integer
|
|
20
|
+
def to_i: () -> Integer
|
|
21
|
+
def to_a: () -> [Integer, Integer, Integer, Integer]
|
|
22
|
+
def to_ary: () -> [Integer, Integer, Integer, Integer]
|
|
23
|
+
def ==: (untyped other) -> bool
|
|
24
|
+
def +: (Color | Array[Integer] | Integer other) -> Color
|
|
25
|
+
def -: (Color | Array[Integer] | Integer other) -> Color
|
|
26
|
+
def *: (Color | Array[Integer] | Integer other) -> Color
|
|
27
|
+
def to_s: () -> String
|
|
28
|
+
|
|
29
|
+
BLACK: Color
|
|
30
|
+
WHITE: Color
|
|
31
|
+
RED: Color
|
|
32
|
+
GREEN: Color
|
|
33
|
+
BLUE: Color
|
|
34
|
+
YELLOW: Color
|
|
35
|
+
MAGENTA: Color
|
|
36
|
+
CYAN: Color
|
|
37
|
+
TRANSPARENT: Color
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module SFML
|
|
2
|
+
class Font
|
|
3
|
+
def self.from_file: (String path) -> Font
|
|
4
|
+
def self.from_memory: (String data) -> Font
|
|
5
|
+
def self.from_stream: (untyped stream) -> Font
|
|
6
|
+
|
|
7
|
+
def copy: () -> Font
|
|
8
|
+
def glyph: (Integer codepoint, Integer size, ?bool bold, ?Float outline_thickness) -> Glyph
|
|
9
|
+
def has_glyph?: (Integer codepoint) -> bool
|
|
10
|
+
def kerning: (Integer first, Integer second, Integer size) -> Float
|
|
11
|
+
def bold_kerning: (Integer first, Integer second, Integer size) -> Float
|
|
12
|
+
def line_spacing: (Integer size) -> Float
|
|
13
|
+
def underline_position: (Integer size) -> Float
|
|
14
|
+
def underline_thickness: (Integer size) -> Float
|
|
15
|
+
def texture: (Integer size) -> Texture
|
|
16
|
+
def smooth=: (bool value) -> bool
|
|
17
|
+
def smooth?: () -> bool
|
|
18
|
+
def info: () -> String
|
|
19
|
+
end
|
|
20
|
+
end
|