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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +342 -0
- data/README.md +51 -14
- data/TODO.md +199 -0
- data/ext/audio/audio_enums.c +131 -0
- data/ext/audio/audio_enums.h +18 -0
- data/ext/audio/effect_processor.c +233 -0
- data/ext/audio/effect_processor.h +25 -0
- data/ext/audio/listener.c +83 -0
- data/ext/audio/listener.h +8 -0
- data/ext/audio/music.c +174 -0
- data/ext/audio/music.h +14 -0
- data/ext/audio/sound.c +139 -0
- data/ext/audio/sound.h +14 -0
- data/ext/audio/sound_buffer.c +274 -0
- data/ext/audio/sound_buffer.h +18 -0
- data/ext/audio/sound_buffer_recorder.c +109 -0
- data/ext/audio/sound_buffer_recorder.h +14 -0
- data/ext/audio/sound_recorder.c +268 -0
- data/ext/audio/sound_recorder.h +14 -0
- data/ext/audio/sound_source.h +13 -0
- data/ext/audio/sound_source.inc +271 -0
- data/ext/audio/sound_source_cone.c +138 -0
- data/ext/audio/sound_source_cone.h +20 -0
- data/ext/audio/sound_stream.c +294 -0
- data/ext/audio/sound_stream.h +14 -0
- data/ext/{exceptions.c → core/exceptions.c} +10 -8
- data/ext/{ext → core}/exceptions.h +3 -3
- data/ext/core/foreign_thread.c +149 -0
- data/ext/core/foreign_thread.h +31 -0
- data/ext/core/macros.h +8 -0
- data/ext/{ext → core}/sfml.h +5 -3
- data/ext/core/unicode.c +46 -0
- data/ext/core/unicode.h +25 -0
- data/ext/ext.c +125 -14
- data/ext/extconf.rb +51 -6
- data/ext/graphics/blend_mode.c +261 -0
- data/ext/graphics/blend_mode.h +18 -0
- data/ext/graphics/circle.c +319 -0
- data/ext/{ext/klass/drawable → graphics}/circle.h +3 -3
- data/ext/graphics/color.c +318 -0
- data/ext/graphics/color.h +37 -0
- data/ext/{drawable.c → graphics/drawable.c} +11 -11
- data/ext/graphics/drawable.h +10 -0
- data/ext/graphics/enums.c +123 -0
- data/ext/graphics/enums.h +20 -0
- data/ext/graphics/font.c +148 -0
- data/ext/graphics/font.h +14 -0
- data/ext/graphics/glyph.c +60 -0
- data/ext/graphics/glyph.h +14 -0
- data/ext/graphics/image.c +205 -0
- data/ext/graphics/image.h +16 -0
- data/ext/graphics/polygon.c +300 -0
- data/ext/graphics/polygon.h +10 -0
- data/ext/graphics/rect.c +287 -0
- data/ext/graphics/rect.h +30 -0
- data/ext/graphics/rectangle.c +302 -0
- data/ext/graphics/rectangle.h +10 -0
- data/ext/graphics/render_state.c +204 -0
- data/ext/graphics/render_state.h +18 -0
- data/ext/graphics/render_target.inc +181 -0
- data/ext/graphics/render_texture.c +182 -0
- data/ext/graphics/render_texture.h +14 -0
- data/ext/graphics/shader.c +540 -0
- data/ext/graphics/shader.h +14 -0
- data/ext/graphics/shape.c +311 -0
- data/ext/graphics/shape.h +10 -0
- data/ext/graphics/sprite.c +249 -0
- data/ext/graphics/sprite.h +10 -0
- data/ext/graphics/stencil_mode.c +211 -0
- data/ext/graphics/stencil_mode.h +18 -0
- data/ext/graphics/target.c +133 -0
- data/ext/graphics/target.h +40 -0
- data/ext/graphics/text.c +344 -0
- data/ext/graphics/text.h +10 -0
- data/ext/graphics/texture.c +379 -0
- data/ext/graphics/texture.h +16 -0
- data/ext/graphics/transform.c +372 -0
- data/ext/graphics/transform.h +35 -0
- data/ext/{transformable.c → graphics/transformable.c} +168 -144
- data/ext/{ext/klass → graphics}/transformable.h +3 -3
- data/ext/graphics/vertex.c +179 -0
- data/ext/graphics/vertex.h +23 -0
- data/ext/graphics/vertex_array.c +127 -0
- data/ext/graphics/vertex_array.h +10 -0
- data/ext/graphics/vertex_buffer.c +211 -0
- data/ext/graphics/vertex_buffer.h +14 -0
- data/ext/{view.c → graphics/view.c} +168 -169
- data/ext/{ext/klass → graphics}/view.h +3 -3
- data/ext/network/ftp.c +405 -0
- data/ext/network/ftp.h +20 -0
- data/ext/network/http.c +243 -0
- data/ext/network/http.h +18 -0
- data/ext/network/ip_address.c +164 -0
- data/ext/network/ip_address.h +20 -0
- data/ext/network/network_enums.c +298 -0
- data/ext/network/network_enums.h +26 -0
- data/ext/network/packet.c +189 -0
- data/ext/network/packet.h +14 -0
- data/ext/network/socket_selector.c +142 -0
- data/ext/network/socket_selector.h +14 -0
- data/ext/network/tcp_listener.c +115 -0
- data/ext/network/tcp_listener.h +14 -0
- data/ext/network/tcp_socket.c +199 -0
- data/ext/network/tcp_socket.h +17 -0
- data/ext/network/udp_socket.c +190 -0
- data/ext/network/udp_socket.h +14 -0
- data/ext/ports.rb +97 -21
- data/ext/system/buffer.c +77 -0
- data/ext/system/buffer.h +14 -0
- data/ext/system/clock.c +100 -0
- data/ext/{ext/klass → system}/clock.h +3 -3
- data/ext/system/input_stream.c +229 -0
- data/ext/system/input_stream.h +23 -0
- data/ext/system/sleep.c +16 -0
- data/ext/system/sleep.h +8 -0
- data/ext/system/time.c +218 -0
- data/ext/system/time.h +18 -0
- data/ext/system/vec2.c +251 -0
- data/ext/system/vec2.h +55 -0
- data/ext/system/vec3.c +219 -0
- data/ext/system/vec3.h +18 -0
- data/ext/window/clipboard.c +89 -0
- data/ext/window/clipboard.h +8 -0
- data/ext/window/context.c +70 -0
- data/ext/window/context.h +8 -0
- data/ext/window/context_settings.c +220 -0
- data/ext/window/context_settings.h +18 -0
- data/ext/window/cursor.c +56 -0
- data/ext/window/cursor.h +14 -0
- data/ext/window/event.c +216 -0
- data/ext/window/event.h +14 -0
- data/ext/{event_name.c → window/event_name.c} +2 -2
- data/ext/window/event_name.h +8 -0
- data/ext/window/input_enums.c +261 -0
- data/ext/window/input_enums.h +36 -0
- data/ext/window/joystick.c +60 -0
- data/ext/window/joystick.h +8 -0
- data/ext/{keyboard.c → window/keyboard.c} +74 -2
- data/ext/window/keyboard.h +12 -0
- data/ext/window/mouse.c +70 -0
- data/ext/window/mouse.h +8 -0
- data/ext/window/sensor.c +30 -0
- data/ext/window/sensor.h +8 -0
- data/ext/window/touch.c +49 -0
- data/ext/window/touch.h +8 -0
- data/ext/window/video_mode.c +133 -0
- data/ext/window/video_mode.h +14 -0
- data/ext/window/vulkan.c +44 -0
- data/ext/window/vulkan.h +8 -0
- data/ext/window/window.c +414 -0
- data/ext/{ext/klass → window}/window.h +3 -3
- data/lib/sfml/version.rb +4 -2
- data/lib/sfml.rb +2 -0
- metadata +163 -56
- data/ext/circle.c +0 -198
- data/ext/clock.c +0 -65
- data/ext/color.c +0 -43
- data/ext/event.c +0 -148
- data/ext/ext/klass/color.h +0 -26
- data/ext/ext/klass/drawable/image.h +0 -4
- data/ext/ext/klass/drawable/polygon.h +0 -4
- data/ext/ext/klass/drawable/rectangle.h +0 -4
- data/ext/ext/klass/drawable/sprite.h +0 -4
- data/ext/ext/klass/drawable/texture.h +0 -4
- data/ext/ext/klass/event/event_name.h +0 -8
- data/ext/ext/klass/event.h +0 -12
- data/ext/ext/klass/keyboard.h +0 -8
- data/ext/ext/klass/render_state.h +0 -16
- data/ext/ext/klass/target.h +0 -18
- data/ext/ext/klass/transform.h +0 -17
- data/ext/ext/klass/video_mode.h +0 -12
- data/ext/ext/module/drawable/drawable.h +0 -10
- data/ext/ext/module/transform.h +0 -18
- data/ext/ext/module.h +0 -10
- data/ext/ext/rect.h +0 -16
- data/ext/ext/style_name.h +0 -11
- data/ext/ext/vec2.h +0 -38
- data/ext/image.c +0 -5
- data/ext/polygon.c +0 -5
- data/ext/rect.c +0 -26
- data/ext/rectangle.c +0 -5
- data/ext/render_state.c +0 -109
- data/ext/sprite.c +0 -5
- data/ext/style_name.c +0 -15
- data/ext/target.c +0 -106
- data/ext/texture.c +0 -5
- data/ext/transform.c +0 -107
- data/ext/vec2.c +0 -42
- data/ext/video_mode.c +0 -78
- data/ext/window.c +0 -274
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc41a984a71094455d29e95d4c529a1e228e5c5442333aca6eb57b9b7c9d3f5e
|
|
4
|
+
data.tar.gz: 835286043ece71ba5dc8c1790cdd6ab0370ae0924823771e03a811cd8acba1af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f75f7ce8244a36a0a8e93903ea0d323513753cfdf3e82f79364b3081a3d5ac651609897a0d4911c2509aac1e5107c37ab9ea9341eede85bb630a05228273ed3d
|
|
7
|
+
data.tar.gz: 68a989c7d4e1147cd5585bf8db85be15c3c1419bbefaeca95791fa37575900d8b841d1b33dd5009f9611e3b5a365b7410c7687ca8eecf96d188a05feb6de269f
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
* **Full YARD API documentation and RBS type signatures**, covering every
|
|
11
|
+
bound class, module, method and constant. Doc comments live in-place in
|
|
12
|
+
the `ext/**/*.c` sources (YARD's C parser, the same convention RDoc uses),
|
|
13
|
+
so they're published automatically to
|
|
14
|
+
[rubydoc.info](https://rubydoc.info/gems/sfml3-rb) on release; `rake yard`
|
|
15
|
+
builds them locally into `doc/`. `sig/**/*.rbs` ships in the gem alongside
|
|
16
|
+
the extension sources, for IDE completion (Solargraph, RubyMine) and
|
|
17
|
+
static type-checking (Sorbet, Steep). Run `rake rbs` to validate the
|
|
18
|
+
signatures.
|
|
19
|
+
|
|
20
|
+
## [0.2.2]
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
* **The macOS binary gems now build.** SFML 3.0.2 defaults
|
|
24
|
+
`CMAKE_OSX_DEPLOYMENT_TARGET` to 13.0, but the osxcross SDK in the
|
|
25
|
+
rake-compiler-dock image is 11.1 and rejects a newer target, so both Darwin
|
|
26
|
+
builds aborted while configuring SFML. The ports toolchain now pins the
|
|
27
|
+
deployment target to macOS 11.0, which is the floor Apple Silicon requires
|
|
28
|
+
anyway.
|
|
29
|
+
|
|
30
|
+
## [0.2.1]
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
* **`SFML::Transform` is now a class**, wrapping `sfTransform` by value. It previously exposed
|
|
34
|
+
only `combine` and `inverse` as module functions over plain 9-element Arrays, leaving 11 of
|
|
35
|
+
CSFML's 13 transform functions unbound: you could read a matrix out of a `Sprite` but not build
|
|
36
|
+
one, apply one to a point, or compose one. It now has `Transform.identity` / `IDENTITY`,
|
|
37
|
+
`Transform.from_a`, `#to_a`/`#matrix`, `#gl_matrix`, `#==`, `#translate!`, `#rotate!`,
|
|
38
|
+
`#scale!` (the last two taking an optional centre), non-mutating `#translate`/`#rotate`/
|
|
39
|
+
`#scale`, `#transform_point`, `#transform_rect`, `#combine!`, `#*`, `#inverse` and `#copy`.
|
|
40
|
+
* **`map_pixel_to_coords` and `map_coords_to_pixel` on both render targets.** The screen-to-world
|
|
41
|
+
conversion behind every click-to-select interaction; without it a zoomed, rotated or
|
|
42
|
+
viewport-shifted `View` could not be hit-tested from Ruby at all.
|
|
43
|
+
* **`SFML::Window` gained the render-target methods only `RenderTexture` had**: `clear_stencil`,
|
|
44
|
+
`clear_color_and_stencil`, `viewport`, `scissor` and `srgb?`. Both classes also gained
|
|
45
|
+
`push_gl_states`, `pop_gl_states`, `reset_gl_states`, `draw_primitives` and
|
|
46
|
+
`draw_vertex_buffer_range`. The shared surface is generated once from
|
|
47
|
+
`ext/graphics/render_target.inc`, the same way `ext/audio/sound_source.inc` already serves the
|
|
48
|
+
three sound sources.
|
|
49
|
+
* `SFML::View.from_rect`, `View#scissor` and `View#scissor=`.
|
|
50
|
+
* `SFML::Transformable#inverse_transform` and `#copy` — every subclass (`Sprite`, `Text`,
|
|
51
|
+
`Circle`, `RectangleShape`, `ConvexShape`, `Shape`) already had both.
|
|
52
|
+
* `SFML::Texture.srgb`, `.srgb_from_stream`, `.srgb_from_image`, `Texture#resize_srgb` and
|
|
53
|
+
`Texture#swap`.
|
|
54
|
+
* `SFML::Shader#set_vec4_array`, `#set_mat3_array` and `#set_mat4_array`, completing the array
|
|
55
|
+
uniforms alongside the existing float/vec2/vec3 forms.
|
|
56
|
+
* `SFML::Circle#point_count=`, `SFML::VertexBuffer#swap`, `SFML::Window.from_handle` and
|
|
57
|
+
`SFML::Window#create_vulkan_surface`.
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
* **Non-ASCII text and window titles were mangled.** `Text#string=`, `Window#title=`, window
|
|
61
|
+
creation and `FtpDirectoryResponse#directory` passed UTF-8 bytes to CSFML's `const char*`
|
|
62
|
+
entry points, which hand them to `sf::String`'s narrow-character constructor and decode them
|
|
63
|
+
with the C locale: `"héllo"` came back as `U+0068 U+FFFFFFFF U+FFFFFFFF U+006C U+006C U+006F`.
|
|
64
|
+
All four now go through the UTF-32 entry points and round-trip exactly, including astral-plane
|
|
65
|
+
characters. The converters live in `ext/core/unicode.c`.
|
|
66
|
+
* **`Mouse.position`, `Mouse.position=` and `Touch.position` reinterpret-cast `sfRenderWindow*`
|
|
67
|
+
to `sfWindowBase*`**, relying on the base being at offset 0 — true of CSFML 3.0.0's layout but
|
|
68
|
+
not guaranteed by it. They now call `sfMouse_getPositionRenderWindow`,
|
|
69
|
+
`sfMouse_setPositionRenderWindow` and `sfTouch_getPositionRenderWindow`, which CSFML ships for
|
|
70
|
+
exactly this reason. Ruby-visible behaviour is unchanged.
|
|
71
|
+
* `Shader#set_float_array`, `#set_vec2_array` and `#set_vec3_array` leaked their conversion
|
|
72
|
+
buffer if an element raised part-way through. All six array setters are now generated from one
|
|
73
|
+
macro built on `ALLOCV_N`, whose buffer Ruby frees while unwinding.
|
|
74
|
+
* `VertexBuffer#update` had the same leak; it now shares `vertices_from_rb`, which validates
|
|
75
|
+
every element before allocating anything.
|
|
76
|
+
* **Audio-thread callbacks re-entered the VM from a foreign native thread.** The
|
|
77
|
+
`SoundStream#on_get_data` / `#on_seek` callbacks and the effect processor run on SFML's audio
|
|
78
|
+
thread, which Ruby never created; calling back into Ruby from it (`rb_thread_call_with_gvl`) is
|
|
79
|
+
a fatal VM error. Each now hands off to one shared Ruby-owned worker
|
|
80
|
+
(`ext/core/foreign_thread.c`). `SoundSource#stop`, `Sound#buffer=` and the `Sound` / `Music` /
|
|
81
|
+
`SoundStream` destructors release the GVL while they wait on the audio thread, and a processor
|
|
82
|
+
that times out degrades to a full buffer of silence rather than stalling playback.
|
|
83
|
+
|
|
84
|
+
### Changed
|
|
85
|
+
* `Window` is created through `sfRenderWindow_createUnicode` rather than `sfRenderWindow_create`,
|
|
86
|
+
so a title given at construction is subject to the same UTF-8 fix as `#title=`.
|
|
87
|
+
* `RenderTexture#viewport` and `#scissor` now take the view as an *optional* argument; omitting
|
|
88
|
+
it means the target's current view, matching CSFML's `NULL`.
|
|
89
|
+
|
|
90
|
+
## [0.2.0]
|
|
91
|
+
|
|
92
|
+
### Added
|
|
93
|
+
* **Full Audio binding.** `SFML::Listener`, `SFML::SoundSourceCone`, `SFML::SoundBuffer`,
|
|
94
|
+
`SFML::Sound`, `SFML::Music`, `SFML::SoundStream`, `SFML::SoundRecorder` and
|
|
95
|
+
`SFML::SoundBufferRecorder`, plus the `SFML::SoundStatus` and `SFML::SoundChannel` enums. The
|
|
96
|
+
shared sound-source surface (play/pause/stop/status, pitch, pan, volume, spatialization,
|
|
97
|
+
position/direction/velocity, cone, doppler and attenuation factors, distance/gain bounds and
|
|
98
|
+
playing offset) is generated once from `ext/audio/sound_source.inc` for all three source classes.
|
|
99
|
+
`SoundStream` and `SoundRecorder` are subclassable through `#on_get_data`/`#on_seek` and
|
|
100
|
+
`#on_process`/`#on_start`/`#on_stop`; their callbacks re-enter Ruby under the GVL and treat an
|
|
101
|
+
exception as "stop", since they run on SFML's audio thread.
|
|
102
|
+
* **Full Network binding.** `SFML::IpAddress` (string/bytes/integer constructors, `NONE`, `ANY`,
|
|
103
|
+
`LOCAL_HOST`, `BROADCAST`, local/public lookup), `SFML::Packet` (raw data plus every typed
|
|
104
|
+
reader/writer), `SFML::SocketSelector`, `SFML::TcpSocket`, `SFML::TcpListener`,
|
|
105
|
+
`SFML::UdpSocket`, `SFML::Http`/`HttpRequest`/`HttpResponse`, `SFML::Ftp` with its response,
|
|
106
|
+
directory-response and listing-response classes, and the `SocketStatus`, `HttpMethod`,
|
|
107
|
+
`HttpStatus`, `FtpStatus` and `FtpTransferMode` enums.
|
|
108
|
+
* `SFML::SoundSource#effect_processor=` accepts a Ruby proc. Because `sfEffectProcessor` carries
|
|
109
|
+
no `userData` (so one C callback cannot tell which source invoked it), the binding dispatches
|
|
110
|
+
through a bounded pool of C thunks, one per active source; exceeding the pool raises.
|
|
111
|
+
|
|
112
|
+
### Changed
|
|
113
|
+
* The vendored CSFML/SFML archives are now linked by **full path** instead of `-l`. mkmf puts the
|
|
114
|
+
host's `-L/usr/lib64` ahead of the ports prefix, which made `-lfreetype` (and the new codec
|
|
115
|
+
libraries) resolve to the host's shared objects and silently add runtime dependencies. The
|
|
116
|
+
built extension again has no `libsfml`/`libcsfml`/`libfreetype`/`libvorbis`/`libFLAC`/`libogg`
|
|
117
|
+
shared dependency.
|
|
118
|
+
|
|
119
|
+
### Build
|
|
120
|
+
* `ext/ports.rb` now builds **Ogg 1.3.5, Vorbis 1.3.7 and FLAC 1.4.3** as pinned,
|
|
121
|
+
checksum-verified, static and position-independent ports, alongside FreeType. SFML 3's audio
|
|
122
|
+
backend is miniaudio, so OpenAL is not needed.
|
|
123
|
+
* `SFML_BUILD_AUDIO`, `SFML_BUILD_NETWORK`, `CSFML_BUILD_AUDIO` and `CSFML_BUILD_NETWORK` are
|
|
124
|
+
enabled; `ws2_32` was added to the Windows system libraries and the CoreAudio/CoreFoundation
|
|
125
|
+
frameworks to the macOS ones. `CMakeLists.txt` finds and links the `Audio`/`Network` components.
|
|
126
|
+
* Archive extraction accepts `.tar.xz` as well as `.tar.gz`, since the FLAC release ships only as
|
|
127
|
+
xz.
|
|
128
|
+
|
|
129
|
+
### Known issues
|
|
130
|
+
* Audio playback and capture need an audio device; the CI suite stays headless, so
|
|
131
|
+
`SoundStream#on_get_data` and `SoundRecorder` are exercised by construction and mapping only,
|
|
132
|
+
never by actually playing or capturing.
|
|
133
|
+
* `Http` and `Ftp` perform real network I/O and are not exercised in CI beyond construction and
|
|
134
|
+
enum mapping.
|
|
135
|
+
|
|
136
|
+
## [0.1.1]
|
|
137
|
+
|
|
138
|
+
### Added
|
|
139
|
+
* **Full Graphics binding.** `RectangleShape`, `ConvexShape`, a callback-based custom `Shape`, `Sprite`,
|
|
140
|
+
`Texture`, `Image`, `Font`, `Text`, `RenderTexture`, `Shader`, `Vertex`, `VertexArray`,
|
|
141
|
+
`VertexBuffer`, `Glyph`, and the value types `BlendMode`, `StencilMode`. `Circle` gained the
|
|
142
|
+
outline/texture/bounds surface it was missing.
|
|
143
|
+
* **Full Window/input binding.** `Keyboard` real-time queries (`pressed?`, `scancode_pressed?`,
|
|
144
|
+
`localize`, `delocalize`, `description`), and the `Mouse`, `Joystick`, `Touch`, `Sensor`,
|
|
145
|
+
`Clipboard`, `Cursor`, `Context`, `ContextSettings` and `Vulkan` modules/classes. `Event` now
|
|
146
|
+
exposes every payload (text, mouse move/raw/button/wheel, joystick move/button/connect, touch,
|
|
147
|
+
sensor).
|
|
148
|
+
* **System completeness.** `SFML::Time` (arithmetic, comparison, unit conversions), `SFML.sleep`,
|
|
149
|
+
`SFML::Buffer`, and `SFML::InputStream` (wraps any `#read`-able object so `Font`/`Texture`/`Image`/
|
|
150
|
+
`Shader` can load from streams).
|
|
151
|
+
* **Value classes.** `Vector2`, `Vector3`, `Color`, `Rect` are now real Ruby classes; every setter
|
|
152
|
+
still accepts a plain array, and getters return the class (which behaves like an array via
|
|
153
|
+
`to_ary`/`Enumerable`).
|
|
154
|
+
* `RenderTexture` is a draw target alongside `Window`: both route through the shared `Target`
|
|
155
|
+
dispatcher, so every drawable renders to either.
|
|
156
|
+
* Predefined `Color` constants, `BlendMode`/`StencilMode` predefined values, `ContextSettings`,
|
|
157
|
+
and `VideoMode.desktop_mode` / `.fullscreen_modes`.
|
|
158
|
+
* Initial project scaffolding: C extension wrapping CSFML (SFML 2 bindings).
|
|
159
|
+
* Windows, video modes, events, keyboard input, transforms, drawables (circle, rectangle, sprite, image), textures, views, clocks, and render targets.
|
|
160
|
+
* Unit tests (minitest) for Clock, Transformable, Circle, RenderState, VideoMode — headless, deterministic.
|
|
161
|
+
* RuboCop configuration and CI integration (test, check, publish workflows).
|
|
162
|
+
* Publish GitHub Action to build and upload the gem on release.
|
|
163
|
+
* `ext/ports.rb`: downloads, checksum-verifies, and builds SFML 3.0.2 and CSFML 3.0.0 from source into a static, position-independent prefix. Ships inside the gem, so `gem install sfml3-rb` builds its own dependencies with no CSFML pre-installed. Shared by `rake ports` (development) and `ext/extconf.rb` (install time).
|
|
164
|
+
* `ext/extconf.rb` three-way dependency resolution: `--enable-system-libraries` (or `SFML_USE_SYSTEM_LIBRARIES`) links a system CSFML 3; otherwise an existing `ports/<host>` prefix is reused, or built automatically.
|
|
165
|
+
* A compile-time `CSFML_VERSION_MAJOR < 3` guard (`ext/ext/sfml.h`) and an `extconf.rb` header check, so a CSFML 2.x install fails with one actionable message instead of a wall of compiler errors.
|
|
166
|
+
* `CMakeLists.txt` rewritten into a real, buildable configuration (CLion/IDE use only — `rake compile` remains the build of record): resolves the vendored `ports/<host>` prefix, links `find_package(SFML 3 ...)` and the CSFML static archives, and links through the C++ driver, since SFML is C++.
|
|
167
|
+
|
|
168
|
+
### Changed
|
|
169
|
+
* **Rebuilt the drawing path around `Target`.** `Target` now carries a `{type, handle}` union and
|
|
170
|
+
dispatches each draw call to the window or render-texture variant; `Window#draw` and every
|
|
171
|
+
drawable's `#draw` go through it. `RenderState` is initialized from `sfRenderStates_default`
|
|
172
|
+
instead of field-by-field, fixing the `stencilMode`/`coordinateType` fields that were left
|
|
173
|
+
uninitialized under CSFML 3, and it now exposes `blend_mode`, `stencil_mode`, `coordinate_type`,
|
|
174
|
+
`texture` and `shader`.
|
|
175
|
+
* **Naming aligned with SFML 3, typos fixed.** `angle`/`angle=` → `rotation`/`rotation=`;
|
|
176
|
+
`escalate` → `scale!` (the mutating operation; `scale` remains the getter); `matrix` → `transform`
|
|
177
|
+
(`matrix` kept as an alias). `View#position`/`position=` were removed: the old setter wrote the
|
|
178
|
+
viewport rather than the center — use `center`/`viewport`.
|
|
179
|
+
* `Clock#elapsed_time`/`#restart!` now return `SFML::Time` rather than bare `Float` seconds.
|
|
180
|
+
* `Window.new` accepts `(video_mode, title, style = :default, state = :windowed, settings = nil)`
|
|
181
|
+
instead of hardcoding `sfDefaultStyle`/`sfWindowed`/no settings.
|
|
182
|
+
* **The C extension is now organised by SFML subsystem.** The 24 sources no longer sit flat in `ext/`
|
|
183
|
+
with their headers in a doubled `ext/ext/` tree; each binding's `.c` and `.h` live together under
|
|
184
|
+
`ext/core/`, `ext/system/`, `ext/window/` or `ext/graphics/`, matching how SFML and CSFML split
|
|
185
|
+
themselves, so a binding's home follows from the CSFML header it wraps. Includes became
|
|
186
|
+
subsystem-relative (`#include "graphics/circle.h"`) and header guards path-derived
|
|
187
|
+
(`SFML_RB_GRAPHICS_CIRCLE_H`), retiring three `CANDY2D_EXT_*` guards left over from a previous
|
|
188
|
+
project name. `ext/extconf.rb` sets `$srcs` from a recursive glob and extends `$VPATH`, because mkmf
|
|
189
|
+
globs only the top level; objects stay flat, which is why every `.c` basename must remain unique.
|
|
190
|
+
`Rakefile` gained `source_pattern = '**/*.{c,h}'` — recursive so the new tree is seen at all, and
|
|
191
|
+
including headers because editing one previously triggered no rebuild. `CMakeLists.txt` globs
|
|
192
|
+
recursively to match.
|
|
193
|
+
* `ext/ext/klass/transform.h` deleted: a stale duplicate of the live `module/transform.h` that nothing
|
|
194
|
+
included, and which would have collided with it in the new tree. The five unbound placeholders
|
|
195
|
+
(Image, Polygon, Rectangle, Sprite, Texture) were kept, so the layout still shows where they will
|
|
196
|
+
land.
|
|
197
|
+
* `CrossBuild#build` now clears **every** staging directory under `pkg/`, not just the current
|
|
198
|
+
platform's. `rake native:<platform> gem` also runs the shared source-gem task, so a stale
|
|
199
|
+
`pkg/<name>-<version>/` fails the cross build with `... are not files` about files that plainly
|
|
200
|
+
exist — which is exactly what the restructuring triggered.
|
|
201
|
+
* **The C extension moved from the untyped `Data_Wrap_Struct` family to `TypedData`.** All wrapped
|
|
202
|
+
types now carry an `rb_data_type_t`. `Data_*` has been deprecated since Ruby 2.3 and warns on every
|
|
203
|
+
use under Ruby 4.0, which was the extension's only compile-time portability problem — the build is
|
|
204
|
+
now warning-clean under `-Wall -Wextra` from Ruby 3.1 to 4.0. `TypedData_Get_Struct` also
|
|
205
|
+
type-checks, where `Data_Get_Struct` silently reinterpreted whatever pointer it was handed.
|
|
206
|
+
* `ext/extconf.rb` now always compiles with `-Wall -Wextra`, and with `-Werror=deprecated-declarations`
|
|
207
|
+
when `SFML_STRICT=1`. CI sets it, so a regression to the deprecated API fails the build rather than
|
|
208
|
+
adding noise. It is opt-in because an unfamiliar compiler at `gem install` time must never fail on a
|
|
209
|
+
warning.
|
|
210
|
+
* **Minimum Ruby raised from 2.5.0 to 3.1**, matched by `TargetRubyVersion` in `.rubocop.yml` and by
|
|
211
|
+
the binary gems, which is the point: there is now **one** floor rather than a source/binary split.
|
|
212
|
+
`>= 2.5.0` had never been exercised — every workflow ran only Ruby 3.3. 3.1 is the oldest
|
|
213
|
+
cross-ruby the `x64-mingw-ucrt` rake-compiler-dock image carries, so it is what lets a single
|
|
214
|
+
`RUBY_CC_VERSION` serve every platform.
|
|
215
|
+
* `test.yaml` now runs the suite across 3.1, 3.2, 3.3, 3.4 and 4.0 — exactly the ABI set the binary
|
|
216
|
+
gems ship — so every Ruby that can receive a precompiled gem is also proven to build from source,
|
|
217
|
+
with `SFML_STRICT=1`.
|
|
218
|
+
* `publish.yaml` gained a `verify-source` gate that installs the freshly built source gem on the floor
|
|
219
|
+
and requires `sfml`, so a release cannot ship a source gem that fails to build. Every supported
|
|
220
|
+
Ruby now has a binary gem, but most *platforms* (macOS, ARM, the BSDs) still do not, and that path
|
|
221
|
+
stays load-bearing.
|
|
222
|
+
* `Gemfile` gained a `:test` group pinning `minitest` to `~> 5.0`; minitest 6 requires Ruby >= 3.2,
|
|
223
|
+
still above the floor. The cross-compile containers now install with `BUNDLE_WITHOUT="development
|
|
224
|
+
test"`.
|
|
225
|
+
* `.rubocop.yml` excludes `pkg/`, `tmp/` and `ports/`. Those hold staged copies of `lib/` and `ext/`,
|
|
226
|
+
so every offence in a real source file was being counted twice or more.
|
|
227
|
+
* **Packaging now produces precompiled binary gems** alongside the source gem. `rake gem:native`
|
|
228
|
+
cross-compiles inside [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock);
|
|
229
|
+
`rake platforms` lists the targets. On a covered platform `gem install sfml3-rb` no longer needs a
|
|
230
|
+
toolchain, CMake, or a source build at all. The source gem remains the fallback everywhere else,
|
|
231
|
+
unchanged in behaviour.
|
|
232
|
+
* **Binary gems now cover i686 as well as x86_64, on both glibc and musl Linux and on 32- and 64-bit
|
|
233
|
+
Windows**: `x86-linux-gnu`, `x86-linux-musl` and `x86-mingw32` join `x86_64-linux-gnu`,
|
|
234
|
+
`x86_64-linux-musl` and `x64-mingw-ucrt`, with `aarch64-linux-gnu`, `x86_64-darwin` and
|
|
235
|
+
`arm64-darwin` still experimental. Two gaps are upstream, not ours: RubyInstaller publishes no
|
|
236
|
+
32-bit Ruby 4.0, so `x86-mingw32` stops at 3.4; and 64-bit Windows before Ruby 3.1 is a different
|
|
237
|
+
platform (`x64-mingw32`), which is not built.
|
|
238
|
+
* `rakelib/package.rake` asserts the ABIs of each gem it builds against `EXPECTED_ABIS`.
|
|
239
|
+
rake-compiler only *warns* when an image lacks a cross-ruby it was asked for, so without this a gem
|
|
240
|
+
could quietly ship fewer ABIs than intended.
|
|
241
|
+
* `ext/ports.rb` targets gained a `multiarch` key. i686 compiles with `i686-linux-gnu-gcc` but its
|
|
242
|
+
libraries live in `/usr/lib/i386-linux-gnu`, and feeding the compiler triple to
|
|
243
|
+
`CMAKE_LIBRARY_ARCHITECTURE` would have pointed CMake at a directory that does not exist.
|
|
244
|
+
* The extension build moved from a hand-rolled `rake compile` (`ruby extconf.rb && make` inside
|
|
245
|
+
`ext/`, then a manual copy) to `rake-compiler`'s `Rake::ExtensionTask`. Builds are now out of tree
|
|
246
|
+
in `tmp/`, so `ext/` no longer accumulates `.o` files, a `Makefile` and `mkmf.log` beside its
|
|
247
|
+
sources.
|
|
248
|
+
* `lib/sfml.rb` prefers `sfml/<major.minor>/sfml_ext` — the per-ABI layout binary gems use — and falls
|
|
249
|
+
back to `sfml/sfml_ext` for a source build.
|
|
250
|
+
* `ext/ports.rb` is now cross-aware: prefixes and build trees are keyed by target (`ports/<target>`)
|
|
251
|
+
rather than by host, and a CMake toolchain file is generated per target. `SFML_TARGET` selects one;
|
|
252
|
+
a native build is unaffected.
|
|
253
|
+
* Project renamed to sfml3.rb; **migrated from SFML 2 to SFML 3** (via CSFML 3) — no longer just
|
|
254
|
+
planned. Distro CSFML packages are frequently still 2.x and are no longer supported.
|
|
255
|
+
* Native extension renamed from the bare `ext` to `sfml/sfml_ext`, matching the `sfml` gem namespace
|
|
256
|
+
and what `rake-compiler` cross-compilation expects.
|
|
257
|
+
* `event_name.c` and `keyboard.c` name tables are now indexed by named enum constant (C99 designated
|
|
258
|
+
initializers) instead of raw ordinal position, so a future upstream reorder is a compile error
|
|
259
|
+
rather than a silently wrong event or key name.
|
|
260
|
+
* `Window#clear` now takes a single `[r, g, b, a]` color array, matching every other color-setting
|
|
261
|
+
method in the API, instead of three positional numbers.
|
|
262
|
+
* Removed the dead `install-package` extconf hook and its accompanying `ext/linux.sh` (empty) and
|
|
263
|
+
`ext/msys2.sh` stubs, and the unused `run_script`/`Arguments`/`library_nofound` helpers in
|
|
264
|
+
`ext/auxlib.rb`.
|
|
265
|
+
* Removed the vendored `include/ruby/*.h` stubs and the empty `include/SFML/CSFML headers` placeholder;
|
|
266
|
+
nothing referenced them once `CMakeLists.txt` was fixed to query the real Ruby headers.
|
|
267
|
+
* `sfml3-rb.gemspec` carries more information: a `documentation_uri` alongside the existing
|
|
268
|
+
source/bug-tracker/changelog links, a summary that actually names SFML 3 and the precompiled
|
|
269
|
+
binaries (it is the line `gem search` shows), and `extra_rdoc_files`/`rdoc_options`. It also ships
|
|
270
|
+
`CHANGELOG.md` and `TODO.md` — the latter being the module-by-module record of what is bound, which
|
|
271
|
+
is what tells someone whether the gem covers their case. Comments now record what a reader cannot
|
|
272
|
+
infer: that rake-compiler rewrites `platform`, `required_ruby_version` and `extensions` for binary
|
|
273
|
+
gems, and that `required_rubygems_version` is deliberately unset because pinning `>= 3.3.22` here
|
|
274
|
+
would lock Ruby 3.1.0 (RubyGems 3.3.3) out of the source gem. Reformatted to 2-space indentation.
|
|
275
|
+
No `homepage_uri`: it would duplicate `source_code_uri`, and RubyGems warns that only the first of a
|
|
276
|
+
duplicated link is shown.
|
|
277
|
+
* `sfml.gemspec` → `sfml3-rb.gemspec`: description now describes the self-building install rather
|
|
278
|
+
than a still-planned migration; license changed to `0BSD`, matching `LICENSE.md`.
|
|
279
|
+
* **Gem package renamed from `sfml` to `sfml3-rb`** (`gem install sfml3-rb`). `require 'sfml'` and the
|
|
280
|
+
`SFML` Ruby module are unchanged — only the RubyGems package name moved.
|
|
281
|
+
|
|
282
|
+
### Fixed
|
|
283
|
+
* `Circle#scale` returned the position, not the scale.
|
|
284
|
+
* `RenderState` was missing a `dmark` slot; the wrapped struct now holds its texture/shader Ruby
|
|
285
|
+
references so a GC cannot collect them while the states are in use.
|
|
286
|
+
* `View#position`/`position=` wrote the viewport under a misleading name (removed).
|
|
287
|
+
* `raise_method_no_implemented` crashed on `NULL` and never reached its message branch.
|
|
288
|
+
* `Window#joystick_threshold=` treated the threshold as a boolean.
|
|
289
|
+
* `Circle#draw` raised unconditionally: its second argument check tested `rb_target` against
|
|
290
|
+
`RenderState` instead of `rb_state` (`ext/circle.c`), and a valid `Target` is never a `RenderState`,
|
|
291
|
+
so no call could get past it.
|
|
292
|
+
* `Target#draw` unwrapped its `state` argument with no class check — the one remaining place a
|
|
293
|
+
caller-supplied object reached a struct accessor unguarded. Combined with the untyped
|
|
294
|
+
`Data_Get_Struct` it used to call, passing the wrong object there reinterpreted an arbitrary
|
|
295
|
+
pointer; it now raises before that can happen.
|
|
296
|
+
* `ext/ext/module.h` and `ext/ext/klass/transform.h` each declared a `static VALUE` at file scope in a
|
|
297
|
+
**header**, giving every one of the ~10 including translation units its own zero-initialized copy.
|
|
298
|
+
`rb_mExt` moved into `ext.c`, its only user; `rb_cTransform` was dead and is gone.
|
|
299
|
+
* An unused `hash` local in `Event_key` (`ext/event.c`).
|
|
300
|
+
* Gem metadata: summary typo, empty description, incorrect homepage.
|
|
301
|
+
* Double-free crash (`free(): double free detected in tcache`) in `Circle`, `Clock`, `Transformable`,
|
|
302
|
+
and `Window`: their `_free` functions called both CSFML's own `sfX_destroy` *and* `free()` on the
|
|
303
|
+
same pointer, though `sfX_destroy` already releases it.
|
|
304
|
+
* `Event#size` read `event->size.height` for both components, so a resize event always reported a
|
|
305
|
+
square. Also fixes the CSFML 3 struct layout (`sfSizeEvent.size` is now a vector, not flat
|
|
306
|
+
`width`/`height`).
|
|
307
|
+
* `View#get_rotation` and `RenderTarget#draw` were missing `return` statements, so both handed an
|
|
308
|
+
uninitialized `VALUE` back to Ruby — the same crash class as the double-free above, just not yet
|
|
309
|
+
triggered by the test suite.
|
|
310
|
+
* `Transform.inverse` was bound to `Transform_combine` instead of `Transform_inverse` — a copy-paste
|
|
311
|
+
bug that made `.inverse` silently wrong (and unusable at 1 argument).
|
|
312
|
+
* `Window#view=`, `#view`, and `#default_view` were fully implemented but never registered — calling
|
|
313
|
+
them raised `NoMethodError`.
|
|
314
|
+
* CSFML 3 API port: video mode fields, `sfRenderWindow_create`'s new window-state parameter,
|
|
315
|
+
`sfRenderWindow_waitEvent`'s new timeout parameter, and `sfFloatRect`'s `position`/`size` fields
|
|
316
|
+
(was flat `left/top/width/height`).
|
|
317
|
+
* A `%ul` printf format-string bug in `ext/exceptions.c` produced garbled error messages (e.g.
|
|
318
|
+
"given 3l"); corrected to `%lu`.
|
|
319
|
+
* `test/sfml_test.rb`: `require 'minitest/unit'` (removed from modern minitest) →
|
|
320
|
+
`require 'minitest/autorun'`; classes referenced without their `SFML::` namespace;
|
|
321
|
+
`assert_in_epsilon` used directly on arrays, which fails because it calls `.abs` on the expected
|
|
322
|
+
value.
|
|
323
|
+
|
|
324
|
+
### Known issues
|
|
325
|
+
* Classes that wrap `T_DATA` never call `rb_define_alloc_func`, so Ruby prints `undefining the
|
|
326
|
+
allocator of T_DATA class ...` once per class on first construction. Harmless and long-standing;
|
|
327
|
+
fixing it means moving construction out of the singleton `new` into an alloc func plus
|
|
328
|
+
`initialize`.
|
|
329
|
+
* Of the nine binary-gem targets, only `x86_64-linux-gnu` has been verified end to end (built,
|
|
330
|
+
installed, full suite passes). `x64-mingw-ucrt` cross-builds and links cleanly with correct PE
|
|
331
|
+
imports but has not been run on Windows. The rest have not been run on their target hardware;
|
|
332
|
+
`aarch64-linux-gnu`, `x86_64-darwin` and `arm64-darwin` are marked `experimental` in
|
|
333
|
+
`publish.yaml`, so a failure can't hold back a release.
|
|
334
|
+
* The Windows gem imports `libwinpthread-1.dll`, which RubyInstaller ships in its
|
|
335
|
+
`ruby_builtin_dlls` directory. If that ever proves unreliable, add `-lwinpthread` to the
|
|
336
|
+
`-Wl,-Bstatic` group in `Ports.cxx_runtime`.
|
|
337
|
+
* `bundle exec rubocop` does not pass on the repository as a whole (55 offenses across 14 files, 40
|
|
338
|
+
autocorrectable, mostly `Style/FrozenStringLiteralComment`) — this predates the packaging work and
|
|
339
|
+
`check.yaml` has been failing on it. The gemspec's own remaining offence is
|
|
340
|
+
`Gemspec/RequireMFA`, left deliberately: setting `rubygems_mfa_required` requires MFA on every
|
|
341
|
+
owner's RubyGems account, and `publish.yaml` pushes with an API token.
|
|
342
|
+
* [TODO.md](TODO.md) tracks SFML 3 → Ruby API porting coverage, module by module.
|
data/README.md
CHANGED
|
@@ -4,8 +4,13 @@ Ruby bindings for [SFML 3](https://www.sfml-dev.org/), via its C API, [CSFML](ht
|
|
|
4
4
|
|
|
5
5
|
## Status
|
|
6
6
|
|
|
7
|
-
Bound against **CSFML 3**. See [TODO.md](TODO.md) for which parts of the
|
|
8
|
-
far, and [CHANGELOG.md](CHANGELOG.md) for what changed recently.
|
|
7
|
+
Latest release: **0.2.2**. Bound against **CSFML 3**. See [TODO.md](TODO.md) for which parts of the
|
|
8
|
+
SFML 3 API are ported so far, and [CHANGELOG.md](CHANGELOG.md) for what changed recently.
|
|
9
|
+
|
|
10
|
+
API docs (every class, module, method and constant) are on
|
|
11
|
+
[rubydoc.info](https://rubydoc.info/gems/sfml3-rb). The gem also ships RBS type signatures
|
|
12
|
+
(`sig/**/*.rbs`) alongside the extension sources, for IDE completion (Solargraph, RubyMine) and
|
|
13
|
+
static type-checking (Sorbet, Steep).
|
|
9
14
|
|
|
10
15
|
## Install
|
|
11
16
|
|
|
@@ -16,18 +21,25 @@ gem install sfml3-rb
|
|
|
16
21
|
On a platform with a precompiled gem this installs a binary with FreeType, SFML 3 and CSFML 3
|
|
17
22
|
already linked in — no toolchain, no build, nothing to install system-wide:
|
|
18
23
|
|
|
19
|
-
| Platform | Status |
|
|
20
|
-
| --- | --- |
|
|
21
|
-
| `x86_64-linux-gnu` | built, installed and tested |
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
| Platform | Ruby | Status |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| `x86_64-linux-gnu` | 3.1 – 4.0 | built, installed and tested |
|
|
27
|
+
| `x86-linux-gnu` | 3.1 – 4.0 | 32-bit glibc Linux |
|
|
28
|
+
| `x86_64-linux-musl` | 3.1 – 4.0 | Alpine and other musl systems |
|
|
29
|
+
| `x86-linux-musl` | 3.1 – 4.0 | 32-bit musl |
|
|
30
|
+
| `x64-mingw-ucrt` | 3.1 – 4.0 | 64-bit Windows, RubyInstaller 3.1+ |
|
|
31
|
+
| `x86-mingw32` | 3.1 – **3.4** | 32-bit Windows |
|
|
32
|
+
| `aarch64-linux-gnu`, `x86_64-darwin`, `arm64-darwin` | 3.1 – 4.0 | experimental, not yet built |
|
|
33
|
+
|
|
34
|
+
Each gem carries one extension per Ruby ABI. Two gaps come from upstream rather than from this
|
|
35
|
+
project: **RubyInstaller publishes no 32-bit Ruby 4.0**, so `x86-mingw32` stops at 3.4; and 64-bit
|
|
36
|
+
Windows before Ruby 3.1 used a different platform (`x64-mingw32`), which is not built.
|
|
37
|
+
|
|
38
|
+
Anywhere else — macOS, ARM, the BSDs — RubyGems falls back to the source gem, which downloads and
|
|
39
|
+
builds FreeType, SFML 3 and CSFML 3 from pinned, checksum-verified tarballs at install time. That
|
|
40
|
+
takes a few minutes and needs:
|
|
41
|
+
|
|
42
|
+
* Ruby >= 3.1
|
|
31
43
|
* A C/C++ toolchain and CMake >= 3.22
|
|
32
44
|
* On Linux, the X11/udev/OpenGL development headers SFML links against — these can't be bundled.
|
|
33
45
|
On Fedora:
|
|
@@ -80,11 +92,32 @@ rake ports # build the vendored FreeType + SFML 3 + CSFML 3 (rake compile doe
|
|
|
80
92
|
rake compile # build the C extension into lib/sfml/
|
|
81
93
|
rake test # compile, then run the test suite
|
|
82
94
|
rake gem # build the source gem into pkg/
|
|
95
|
+
rake yard # build API docs into doc/
|
|
96
|
+
rake rbs # validate sig/**/*.rbs
|
|
83
97
|
```
|
|
84
98
|
|
|
99
|
+
`rake githooks:install` points your checkout at the committed `.githooks/` pre-commit hook, which
|
|
100
|
+
lints staged Ruby with RuboCop and auto-formats staged C with clang-format (`sudo dnf install
|
|
101
|
+
clang-tools-extra` on Fedora for the C side).
|
|
102
|
+
|
|
85
103
|
`CMakeLists.txt` is a CLion/IDE convenience build against the same vendored `ports/` prefix — `rake`
|
|
86
104
|
is the build of record.
|
|
87
105
|
|
|
106
|
+
The C extension under `ext/` mirrors SFML's own subsystems, with each binding's `.c` and `.h`
|
|
107
|
+
side by side: `core/` (CSFML umbrella header, macros, exceptions, UTF-32 conversion),
|
|
108
|
+
`system/` (Clock, Time, vectors, streams), `window/` (Window, Event, VideoMode, and the input
|
|
109
|
+
devices), `graphics/` (shapes, Color, Transform, View, Texture, Text, Shader, the render targets),
|
|
110
|
+
`audio/` and `network/`. Includes are subsystem-relative, e.g. `#include "graphics/circle.h"`.
|
|
111
|
+
|
|
112
|
+
Two `.inc` files hold method bodies shared by several classes and are included once per class with
|
|
113
|
+
a different macro prefix: `audio/sound_source.inc` (Sound, Music, SoundStream) and
|
|
114
|
+
`graphics/render_target.inc` (Window, RenderTexture).
|
|
115
|
+
|
|
116
|
+
Note that mkmf flattens object files to their basenames, so every `.c` filename has to stay
|
|
117
|
+
unique across the whole tree — and that `$srcs` is baked into the generated Makefile, so after
|
|
118
|
+
adding a `.c` file run `touch ext/extconf.rb && rake compile` (or `rake clean compile`), otherwise
|
|
119
|
+
it is silently left out of the link.
|
|
120
|
+
|
|
88
121
|
### Building the binary gems
|
|
89
122
|
|
|
90
123
|
Cross-compilation runs in [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock),
|
|
@@ -108,3 +141,7 @@ that and falls back to the single `lib/sfml/sfml_ext.so` a source build installs
|
|
|
108
141
|
## License
|
|
109
142
|
|
|
110
143
|
[0BSD](LICENSE.md)
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
Developed by: [Algaves](https://github.com/algaves/sfml3.rb) @ 2026
|