sfml3-rb 0.3.0-x86_64-linux-gnu → 0.3.1-x86_64-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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +36 -13
  4. data/TODO.md +18 -11
  5. data/lib/sfml/3.1/sfml_ext.so +0 -0
  6. data/lib/sfml/3.2/sfml_ext.so +0 -0
  7. data/lib/sfml/3.3/sfml_ext.so +0 -0
  8. data/lib/sfml/3.4/sfml_ext.so +0 -0
  9. data/lib/sfml/4.0/sfml_ext.so +0 -0
  10. data/lib/sfml/version.rb +1 -1
  11. data/sig/audio/sound.rbs +1 -1
  12. data/sig/audio/sound_buffer_recorder.rbs +1 -1
  13. data/sig/audio/sound_recorder.rbs +1 -1
  14. data/sig/audio/sound_source_cone.rbs +1 -1
  15. data/sig/audio/sound_stream.rbs +1 -1
  16. data/sig/graphics/blend_mode.rbs +1 -1
  17. data/sig/graphics/circle.rbs +1 -1
  18. data/sig/graphics/color.rbs +5 -5
  19. data/sig/graphics/image.rbs +1 -1
  20. data/sig/graphics/polygon.rbs +1 -1
  21. data/sig/graphics/rect.rbs +5 -5
  22. data/sig/graphics/rectangle.rbs +1 -1
  23. data/sig/graphics/render_state.rbs +2 -2
  24. data/sig/graphics/render_target.rbs +18 -0
  25. data/sig/graphics/render_texture.rbs +4 -2
  26. data/sig/graphics/render_window.rbs +7 -0
  27. data/sig/graphics/shape.rbs +1 -1
  28. data/sig/graphics/sprite.rbs +2 -2
  29. data/sig/graphics/stencil_mode.rbs +2 -2
  30. data/sig/graphics/target.rbs +1 -3
  31. data/sig/graphics/text.rbs +4 -4
  32. data/sig/graphics/texture.rbs +1 -1
  33. data/sig/graphics/transformable.rbs +1 -1
  34. data/sig/graphics/vertex.rbs +4 -4
  35. data/sig/graphics/vertex_array.rbs +1 -1
  36. data/sig/graphics/vertex_buffer.rbs +4 -4
  37. data/sig/graphics/view.rbs +0 -1
  38. data/sig/network/ftp.rbs +1 -1
  39. data/sig/network/http.rbs +2 -2
  40. data/sig/network/ip_address.rbs +1 -1
  41. data/sig/network/packet.rbs +1 -1
  42. data/sig/network/socket_selector.rbs +1 -1
  43. data/sig/network/tcp_listener.rbs +1 -1
  44. data/sig/network/tcp_socket.rbs +1 -1
  45. data/sig/network/udp_socket.rbs +1 -1
  46. data/sig/sfml/version.rbs +3 -0
  47. data/sig/system/buffer.rbs +1 -1
  48. data/sig/system/clock.rbs +1 -1
  49. data/sig/system/input_stream.rbs +1 -1
  50. data/sig/system/time.rbs +4 -4
  51. data/sig/system/vec2.rbs +4 -4
  52. data/sig/system/vec3.rbs +4 -4
  53. data/sig/window/context.rbs +1 -1
  54. data/sig/window/context_settings.rbs +1 -1
  55. data/sig/window/event.rbs +1 -1
  56. data/sig/window/mouse.rbs +2 -2
  57. data/sig/window/touch.rbs +1 -1
  58. data/sig/window/video_mode.rbs +1 -1
  59. data/sig/window/window.rbs +2 -25
  60. data/sig/window/window_base.rbs +33 -0
  61. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4a2991322cd4e17a37fbf02c250f95a3eab45e17ca3b928a3d201d5fcb94e3e
4
- data.tar.gz: a269e2d8e52e99e389f1ad9fc870db938597cacd6441c88938b052e0a8e40691
3
+ metadata.gz: c1d44306e66952e3b58b4b35230ee5a4cd7038da7a7460db54172c9418ab70ce
4
+ data.tar.gz: 1463222892c495802fb7b5d9e887d176be470a5ea6bc13089c1edd8dc54d8727
5
5
  SHA512:
6
- metadata.gz: 04b34de0cfcd80df6be8ba6ec9b195bb508f5156f925804ac21d063ffcc1fe5d88ae6c12d71becb44f47194ef3994bd039ae6c6f16f6173be59a05a3781347a5
7
- data.tar.gz: '00853e272560e6be7b18c1d01c3032914c63208ad178a383cff101fb1278f04f13886d7f27cecc818dfac02b9f49da185b982013d9344b785264c0db120e94f2'
6
+ metadata.gz: d1438aeb1a892efd5008c8991b76dd27b9ee6465deea568e250d878311c0ed80945f6e468ffe0decf180a00fc7a51ccb615ffaa0ff592279130b6976c20c9d0b
7
+ data.tar.gz: 5de2ea99b9d7f67d8357c6ec07c2357954a6c69e0769d9724358d4f90f7c327eab10a323248f69c5cb2cef93413279117dffc00e135639cb35530db086f253e6
data/CHANGELOG.md CHANGED
@@ -6,6 +6,31 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.1] - 2026-09-19
10
+
11
+ ### Added
12
+ * **`SFML::WindowBase`, `SFML::RenderWindow` and the `SFML::RenderTarget` module**, mirroring
13
+ SFML 3's own hierarchy. `WindowBase` wraps `sfWindowBase` -- an OS window and event queue with
14
+ no OpenGL context -- and is constructible, with `Window` and `RenderWindow` derived from it.
15
+ `Window` keeps its existing `sfRenderWindow` behaviour; `RenderWindow` is the same renderable
16
+ window under the name that also includes `RenderTarget`. `RenderTexture` includes
17
+ `RenderTarget` too, so a drawable's `#draw` now accepts a `RenderWindow` or a `RenderTexture`
18
+ directly (the legacy `Target` still works). The shared window surface is generated once, in
19
+ `ext/window/window_base.inc`.
20
+ * **RBS signatures are now checked against the code.** `sig/**/*.rbs` declares `SFML::VERSION`, and
21
+ a `Steepfile` plus the `steep` development gem add `rake steep` to type-check `lib/` against the
22
+ signatures. `check.yaml` runs both `rake rbs` and `rake steep`, on `main` and on `release/**`
23
+ PRs, which previously ran no workflow at all.
24
+
25
+ ### Changed
26
+ * `Mouse.position`, `Mouse.set_position` and `Touch.position` dispatch to the
27
+ `*RenderWindow` or `*WindowBase` CSFML entry point depending on whether the argument is a
28
+ Window/RenderWindow or a WindowBase, instead of passing an `sfRenderWindow*` where an
29
+ `sfWindowBase*` is expected.
30
+ * **RBS constructors use `def initialize`.** Every `def self.new` became
31
+ `def initialize: (…) -> void`, the form RubyMine links to `Foo.new` and Steep checks, and which
32
+ matches the C extension, where every constructor is an `initialize`.
33
+
9
34
  ## [0.3.0] - 2026-09-19
10
35
 
11
36
  ### Added
data/README.md CHANGED
@@ -3,13 +3,14 @@
3
3
  Ruby bindings for [SFML 3](https://www.sfml-dev.org/), via its C API, [CSFML](https://github.com/SFML/CSFML).
4
4
 
5
5
  [![Ruby](https://img.shields.io/badge/ruby-3.1%2B-red?style=flat-square)](https://www.ruby-lang.org/)
6
- [![Test](https://github.com/algaves/sfml3.rb/actions/workflows/test.yaml/badge.svg)](https://github.com/algaves/sfml3.rb/actions/workflows/test.yaml)
7
- [![Check](https://github.com/algaves/sfml3.rb/actions/workflows/check.yaml/badge.svg)](https://github.com/algaves/sfml3.rb/actions/workflows/check.yaml)
6
+ [![Test](https://img.shields.io/github/actions/workflow/status/algaves/sfml3.rb/test.yaml?style=flat-square)](https://img.shields.io/github/actions/workflow/status/algaves/sfml3.rb/test.yaml?style=flat-square)
7
+ [![Check](https://img.shields.io/github/actions/workflow/status/algaves/sfml3.rb/check.yaml?style=flat-square)](https://img.shields.io/github/actions/workflow/status/algaves/sfml3.rb/check.yaml?style=flat-square)
8
+ [![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-4c9a2a?style=flat-square)](https://algaves.github.io/sfml3.rb/)
8
9
  [![Gem Version](https://img.shields.io/gem/v/sfml3-rb?style=flat-square)](https://rubygems.org/gems/sfml3-rb)
9
10
  [![Gem Downloads](https://img.shields.io/gem/dt/sfml3-rb?style=flat-square)](https://rubygems.org/gems/sfml3-rb)
10
11
  [![License](https://img.shields.io/badge/license-0BSD-green?style=flat-square)](LICENSE.md)
11
12
 
12
- Latest release: **0.3.0**, bound against **CSFML 3**.
13
+ Latest release: **0.3.1**, bound against **CSFML 3**.
13
14
 
14
15
  ## Features
15
16
 
@@ -20,10 +21,11 @@ Latest release: **0.3.0**, bound against **CSFML 3**.
20
21
  * **A source fallback everywhere else**, which downloads and builds the pinned, checksum-verified
21
22
  dependencies at install time, so the gem works on macOS, ARM and the BSDs out of the box.
22
23
  * **Complete API documentation and types**: every class, module, method and constant is documented
23
- on [rubydoc.info](https://rubydoc.info/gems/sfml3-rb) and covered by RBS signatures shipped in
24
+ on the [docs site](https://algaves.github.io/sfml3.rb/) and covered by RBS signatures shipped in
24
25
  the gem.
25
- * **A close fit to SFML's own model**: classes mirror the C++ types (Window, Texture, Sprite,
26
- Sound, ...) minus the parts that only exist in C++, like `std::string` and exceptions.
26
+ * **A close fit to SFML's own model**: classes mirror the C++ types (WindowBase, Window,
27
+ RenderWindow, Texture, Sprite, Sound, ...) minus the parts that only exist in C++, like
28
+ `std::string` and exceptions.
27
29
 
28
30
  ## Table of Contents
29
31
 
@@ -124,13 +126,30 @@ part of the test suite.
124
126
 
125
127
  ## Documentation
126
128
 
127
- * [API reference](https://rubydoc.info/gems/sfml3-rb) — every class, module, method and constant,
128
- built from the YARD comments in `ext/**/*.c`.
129
- * RBS type signatures (`sig/**/*.rbs`) ship in the gem for IDE completion (Solargraph, RubyMine)
130
- and static type-checking (Sorbet, Steep). Validate them with `rake rbs`.
129
+ * [API reference](https://algaves.github.io/sfml3.rb/) — every class, module, method and constant,
130
+ built from the YARD comments in `ext/**/*.c` and deployed to GitHub Pages by CI. The same docs
131
+ are also generated on [RubyDoc.info](https://rubydoc.info/gems/sfml3-rb).
132
+ * RBS type signatures (`sig/**/*.rbs`) describe the whole API, including the native classes, for
133
+ RBS-aware editors. `rake rbs` validates the signatures and `rake steep` type-checks `lib/`
134
+ against them.
131
135
  * [CHANGELOG.md](CHANGELOG.md) — what changed in each release.
132
136
  * [TODO.md](TODO.md) — module-by-module porting coverage and what is deliberately unbound.
133
137
 
138
+ ### IDE setup (RubyMine)
139
+
140
+ `sig/**/*.rbs` is the only machine-readable description of the API: the native extension cannot be
141
+ introspected, so an editor either reads the signatures or sees nothing. RBS support lives in
142
+ **RubyMine** (and IntelliJ IDEA Ultimate with the Ruby plugin); CLion and other C/C++ IDEs show
143
+ `.rbs` files as plain text.
144
+
145
+ 1. Open the project in RubyMine and point **Settings → Languages & Frameworks → Ruby SDK** at the
146
+ interpreter you build against (Ruby 3.1+). Keep the C sources in CLion/clangd.
147
+ 2. Run `bundle install` so the `rbs` gem (3.2+) is available to that interpreter.
148
+ 3. RubyMine indexes `sig/` automatically; completion, type info (`Ctrl+Shift+P`), parameter info
149
+ and *Navigate → Type Signature* then work for `Window.new` and the rest of the API.
150
+ 4. For a full type check, run `steep check` from *Run anything* (`Ctrl` twice); `Steepfile` points
151
+ it at `lib/` and `sig/`.
152
+
134
153
  ## Development
135
154
 
136
155
  ```sh
@@ -140,6 +159,7 @@ rake test # compile, then run the test suite
140
159
  rake gem # build the source gem into pkg/
141
160
  rake yard # build API docs into doc/
142
161
  rake rbs # validate sig/**/*.rbs
162
+ rake steep # type-check lib/ against sig/**/*.rbs
143
163
  ```
144
164
 
145
165
  `rake githooks:install` points your checkout at the committed `.githooks/` pre-commit hook, which
@@ -155,9 +175,12 @@ side by side: `core/` (CSFML umbrella header, macros, exceptions, UTF-32 convers
155
175
  devices), `graphics/` (shapes, Color, Transform, View, Texture, Text, Shader, the render targets),
156
176
  `audio/` and `network/`. Includes are subsystem-relative, e.g. `#include "graphics/circle.h"`.
157
177
 
158
- Two `.inc` files hold method bodies shared by several classes and are included once per class with
159
- a different macro prefix: `audio/sound_source.inc` (Sound, Music, SoundStream) and
160
- `graphics/render_target.inc` (Window, RenderTexture).
178
+ Three `.inc` files hold method bodies shared by several classes and are included once per class
179
+ with a different macro prefix: `audio/sound_source.inc` (Sound, Music, SoundStream),
180
+ `window/window_base.inc` (WindowBase, Window) and `graphics/render_target.inc` (Window,
181
+ RenderTexture). `SFML::RenderWindow < SFML::Window < SFML::WindowBase` and includes the
182
+ `SFML::RenderTarget` module, so a drawable's `#draw` accepts a `RenderWindow` or a
183
+ `RenderTexture` directly; `SFML::Target` remains as the legacy generic wrapper.
161
184
 
162
185
  Note that mkmf flattens object files to their basenames, so every `.c` filename has to stay
163
186
  unique across the whole tree — and that `$srcs` is baked into the generated Makefile, so after
data/TODO.md CHANGED
@@ -51,9 +51,14 @@ Base module: time, vectors, clocks, streams.
51
51
 
52
52
  OpenGL-based windows, events, input handling.
53
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.
54
+ - [x] **WindowBase** — `SFML::WindowBase` (`ext/window/window_base.c`); wraps `sfWindowBase`, an OS
55
+ window and event queue with no OpenGL context. The methods shared with `Window` are generated
56
+ from `ext/window/window_base.inc`.
57
+ - [x] **Window** — `SFML::Window` (`ext/window/window.c`); wraps `sfRenderWindow` and derives from
58
+ `WindowBase`, overriding every base method with the matching `sfRenderWindow_*` entry point.
59
+ Accepts style, state and `ContextSettings`; exposes min/max size, icon, cursor, native handle,
60
+ settings, display, and the render-target surface. Deliberately still renderable, so existing
61
+ `Window.new(...).clear` code keeps working.
57
62
  - [x] **VideoMode** — `SFML::VideoMode` (`ext/window/video_mode.c`); includes `desktop_mode` and
58
63
  `fullscreen_modes`
59
64
  - [x] **Event** — `SFML::Event` (`ext/window/event.c`, `ext/window/event_name.c`); every payload is
@@ -87,13 +92,16 @@ OpenGL-based windows, events, input handling.
87
92
  - [x] **Drawable** — `SFML::Drawable` mixin (`ext/graphics/drawable.c`)
88
93
  - [x] **RenderStates** — `SFML::RenderState` (`ext/graphics/render_state.c`); blend mode, stencil
89
94
  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`,
95
+ - [x] **RenderTarget** — `SFML::RenderTarget` module (`ext/graphics/target.c`), included by
96
+ `RenderWindow` and `RenderTexture`, so a drawable's `#draw` accepts either directly. The
97
+ methods — `map_pixel_to_coords`, `map_coords_to_pixel`, `push_gl_states`, `pop_gl_states`,
93
98
  `reset_gl_states`, `draw_primitives`, `draw_vertex_buffer_range`, `clear_stencil`,
94
99
  `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)
100
+ `Window` and `RenderTexture` from `ext/graphics/render_target.inc`. `SFML::Target` remains
101
+ as the legacy runtime-dispatch wrapper for `Drawable#draw`.
102
+ - [x] **RenderWindow** — `SFML::RenderWindow` (`ext/graphics/render_window.c`); derives from
103
+ `Window` and includes `RenderTarget`. Creation, events and the window surface come from
104
+ `Window` / `WindowBase`.
97
105
  - [x] **RenderTexture** — `SFML::RenderTexture` (`ext/graphics/render_texture.c`)
98
106
  - [x] **View** — `SFML::View` (`ext/graphics/view.c`); including `View.from_rect` and
99
107
  `scissor`/`scissor=`
@@ -179,9 +187,8 @@ without re-deriving the reasoning each time.
179
187
 
180
188
  | Symbols | Why |
181
189
  | --- | --- |
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. |
190
+ | `sfWindow_*` (~26 functions) | A plain `sfWindow` (an OpenGL context with no render-target surface); `SFML::Window` wraps `sfRenderWindow` and `SFML::WindowBase` wraps `sfWindowBase`. |
191
+ | `sfRenderWindow_create`, `sfWindowBase_create`, `sfText_getString`/`setString`, `sfRenderWindow_setTitle`, `sfWindowBase_setTitle`, `sfFtpDirectoryResponse_getDirectory` | Superseded by their `*Unicode` counterparts; the narrow forms decode through the C locale and mangle non-ASCII. |
185
192
  | `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
193
  | `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
194
  | `sfShape_getPoint`, `sfShape_getPointCount` | `SFML::Shape` reads these from the Ruby subclass, which is where they are defined. |
Binary file
Binary file
Binary file
Binary file
Binary file
data/lib/sfml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SFML
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
data/sig/audio/sound.rbs CHANGED
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Sound
3
- def self.new: (SoundBuffer buffer) -> Sound
3
+ def initialize: (SoundBuffer buffer) -> void
4
4
 
5
5
  def copy: () -> Sound
6
6
  def buffer: () -> SoundBuffer
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class SoundBufferRecorder
3
- def self.new: () -> SoundBufferRecorder
3
+ def initialize: () -> void
4
4
 
5
5
  def start: (Integer sample_rate) -> bool
6
6
  def stop: () -> self
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class SoundRecorder
3
- def self.new: () -> SoundRecorder
3
+ def initialize: () -> void
4
4
  def self.available?: () -> bool
5
5
  def self.available_devices: () -> Array[String]
6
6
  def self.default_device: () -> String?
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class SoundSourceCone
3
- def self.new: (Float inner_angle, Float outer_angle, Float outer_gain) -> SoundSourceCone
3
+ def initialize: (Float inner_angle, Float outer_angle, Float outer_gain) -> void
4
4
 
5
5
  def inner_angle: () -> Float
6
6
  def inner_angle=: (Float value) -> Float
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class SoundStream
3
- def self.new: (Integer channel_count, Integer sample_rate, ?Array[Symbol] channel_map) -> SoundStream
3
+ def initialize: (Integer channel_count, Integer sample_rate, ?Array[Symbol] channel_map) -> void
4
4
 
5
5
  def channel_count: () -> Integer
6
6
  def sample_rate: () -> Integer
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class BlendMode
3
- def self.new: () -> BlendMode
3
+ def initialize: () -> void
4
4
  | (Symbol | Integer color_src_factor, Symbol | Integer color_dst_factor,
5
5
  Symbol | Integer color_equation, Symbol | Integer alpha_src_factor,
6
6
  Symbol | Integer alpha_dst_factor, Symbol | Integer alpha_equation) -> BlendMode
@@ -2,7 +2,7 @@ module SFML
2
2
  class Circle
3
3
  include Drawable
4
4
 
5
- def self.new: (?Float radius) -> Circle
5
+ def initialize: (?Float radius) -> void
6
6
 
7
7
  def copy: () -> Circle
8
8
  def move: (Vector2 | Array[Float] offset) -> self
@@ -1,10 +1,10 @@
1
1
  module SFML
2
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
3
+ def initialize: () -> void
4
+ | (Integer r, Integer g, Integer b, ?Integer a) -> void
5
+ | (Array[Integer] rgb_or_rgba) -> void
6
+ | (Integer packed) -> void
7
+ | (Color other) -> void
8
8
  def self.from_rgb: (Integer rgb) -> Color
9
9
  def self.from_rgba: (Integer rgba) -> Color
10
10
  def self.from_integer: (Integer rgba) -> Color
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Image
3
- def self.new: (Vector2 | Array[Integer] size) -> Image
3
+ def initialize: (Vector2 | Array[Integer] size) -> void
4
4
  def self.from_color: (Vector2 | Array[Integer] size, Color color) -> Image
5
5
  def self.from_pixels: (Vector2 | Array[Integer] size, String pixels) -> Image
6
6
  def self.from_file: (String path) -> Image
@@ -2,7 +2,7 @@ module SFML
2
2
  class ConvexShape
3
3
  include Drawable
4
4
 
5
- def self.new: (?Integer point_count) -> ConvexShape
5
+ def initialize: (?Integer point_count) -> void
6
6
 
7
7
  def copy: () -> ConvexShape
8
8
  def move: (Vector2 | Array[Float] offset) -> self
@@ -2,11 +2,11 @@ module SFML
2
2
  class Rect
3
3
  include Enumerable[Float]
4
4
 
5
- def self.new: () -> Rect
6
- | (Float left, Float top) -> Rect
7
- | (Float left, Float top, Float width, Float height) -> Rect
8
- | (Array[Float] left_top_width_height) -> Rect
9
- | (Rect other) -> Rect
5
+ def initialize: () -> void
6
+ | (Float left, Float top) -> void
7
+ | (Float left, Float top, Float width, Float height) -> void
8
+ | (Array[Float] left_top_width_height) -> void
9
+ | (Rect other) -> void
10
10
 
11
11
  def left: () -> Float
12
12
  def left=: (Float value) -> Float
@@ -2,7 +2,7 @@ module SFML
2
2
  class RectangleShape
3
3
  include Drawable
4
4
 
5
- def self.new: (?(Vector2 | Array[Float]) size) -> RectangleShape
5
+ def initialize: (?(Vector2 | Array[Float]) size) -> void
6
6
 
7
7
  def copy: () -> RectangleShape
8
8
  def move: (Vector2 | Array[Float] offset) -> self
@@ -1,7 +1,7 @@
1
1
  module SFML
2
2
  class RenderState
3
- def self.new: () -> RenderState
4
- | (Array[Array[Float]] | Array[Float] matrix) -> RenderState
3
+ def initialize: () -> void
4
+ | (Array[Array[Float]] | Array[Float] matrix) -> void
5
5
 
6
6
  def transform: () -> Array[untyped]
7
7
  def transform=: (Array[Array[Float]] | Array[Float] matrix) -> self
@@ -0,0 +1,18 @@
1
+ module SFML
2
+ # Included by RenderWindow and RenderTexture. The method bodies are generated
3
+ # per class from ext/graphics/render_target.inc.
4
+ module RenderTarget
5
+ def srgb?: () -> bool
6
+ def clear_stencil: (Integer value) -> self
7
+ def clear_color_and_stencil: (untyped color, Integer stencil) -> self
8
+ def viewport: (?untyped view) -> untyped
9
+ def scissor: (?untyped view) -> untyped
10
+ def map_pixel_to_coords: (untyped point, ?untyped view) -> untyped
11
+ def map_coords_to_pixel: (untyped point, ?untyped view) -> untyped
12
+ def push_gl_states: () -> self
13
+ def pop_gl_states: () -> self
14
+ def reset_gl_states: () -> self
15
+ def draw_primitives: (untyped vertices, untyped primitive, ?untyped state) -> self
16
+ def draw_vertex_buffer_range: (untyped buffer, Integer first, Integer count, ?untyped state) -> self
17
+ end
18
+ end
@@ -1,6 +1,8 @@
1
1
  module SFML
2
2
  class RenderTexture
3
- def self.new: (Vector2 size, ?untyped settings) -> RenderTexture
3
+ include RenderTarget
4
+
5
+ def initialize: (Vector2 size, ?untyped settings) -> void
4
6
  def self.maximum_antialiasing_level: () -> Integer
5
7
 
6
8
  def size: () -> Vector2
@@ -20,7 +22,7 @@ module SFML
20
22
 
21
23
  def draw: (untyped drawable, ?untyped state) -> self
22
24
 
23
- # Shared with Window via render_target.inc -- see ext/graphics/render_target.inc
25
+ # Shared with RenderWindow via render_target.inc -- see ext/graphics/render_target.inc
24
26
  def srgb?: () -> bool
25
27
  def clear_stencil: (Integer value) -> self
26
28
  def clear_color_and_stencil: (untyped color, Integer stencil) -> self
@@ -0,0 +1,7 @@
1
+ module SFML
2
+ class RenderWindow < Window
3
+ include RenderTarget
4
+
5
+ def draw: (untyped drawable, ?untyped state) -> self
6
+ end
7
+ end
@@ -2,7 +2,7 @@ module SFML
2
2
  class Shape
3
3
  include Drawable
4
4
 
5
- def self.new: () -> Shape
5
+ def initialize: () -> void
6
6
 
7
7
  def update!: () -> self
8
8
  def move: (Vector2 | Array[Float] offset) -> self
@@ -1,7 +1,7 @@
1
1
  module SFML
2
2
  class Sprite
3
- def self.new: () -> Sprite
4
- | (Texture texture) -> Sprite
3
+ def initialize: () -> void
4
+ | (Texture texture) -> void
5
5
 
6
6
  def copy: () -> Sprite
7
7
 
@@ -1,7 +1,7 @@
1
1
  module SFML
2
2
  class StencilMode
3
- def self.new: () -> StencilMode
4
- | (Symbol | Integer comparison, Symbol | Integer update_operation, Integer reference, Integer mask, bool stencil_only) -> StencilMode
3
+ def initialize: () -> void
4
+ | (Symbol | Integer comparison, Symbol | Integer update_operation, Integer reference, Integer mask, bool stencil_only) -> void
5
5
 
6
6
  def comparison: () -> Symbol
7
7
  def comparison=: (Symbol | Integer value) -> (Symbol | Integer)
@@ -1,8 +1,6 @@
1
1
  module SFML
2
2
  class Target
3
- def self.new: (untyped window) -> Target
4
-
5
- def initialize: () -> void
3
+ def initialize: (untyped window) -> void
6
4
  def draw: (untyped drawable, untyped state) -> nil
7
5
  def view: () -> untyped
8
6
  def view=: (untyped value) -> nil
@@ -1,9 +1,9 @@
1
1
  module SFML
2
2
  class Text
3
- def self.new: () -> Text
4
- | (untyped font) -> Text
5
- | (untyped font, String string) -> Text
6
- | (untyped font, String string, Integer character_size) -> Text
3
+ def initialize: () -> void
4
+ | (untyped font) -> void
5
+ | (untyped font, String string) -> void
6
+ | (untyped font, String string, Integer character_size) -> void
7
7
 
8
8
  def copy: () -> Text
9
9
  def font: () -> untyped
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Texture
3
- def self.new: (Vector2 size) -> Texture
3
+ def initialize: (Vector2 size) -> void
4
4
  def self.srgb: (Vector2 size) -> Texture
5
5
  def self.from_file: (String path, ?untyped area) -> Texture
6
6
  def self.srgb_from_file: (String path, ?untyped area) -> Texture
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Transformable
3
- def self.new: () -> Transformable
3
+ def initialize: () -> void
4
4
 
5
5
  def position=: (Vector2 value) -> self
6
6
  def rotation=: (Float value) -> self
@@ -1,9 +1,9 @@
1
1
  module SFML
2
2
  class Vertex
3
- def self.new: () -> Vertex
4
- | (Vector2 position) -> Vertex
5
- | (Vector2 position, untyped color) -> Vertex
6
- | (Vector2 position, untyped color, Vector2 tex_coords) -> Vertex
3
+ def initialize: () -> void
4
+ | (Vector2 position) -> void
5
+ | (Vector2 position, untyped color) -> void
6
+ | (Vector2 position, untyped color, Vector2 tex_coords) -> void
7
7
 
8
8
  def position: () -> Vector2
9
9
  def position=: (Vector2 value) -> Vector2
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class VertexArray
3
- def self.new: () -> VertexArray
3
+ def initialize: () -> void
4
4
 
5
5
  def copy: () -> VertexArray
6
6
  def vertex_count: () -> Integer
@@ -1,9 +1,9 @@
1
1
  module SFML
2
2
  class VertexBuffer
3
- def self.new: () -> VertexBuffer
4
- | (Integer count) -> VertexBuffer
5
- | (Integer count, Symbol primitive) -> VertexBuffer
6
- | (Integer count, Symbol primitive, Symbol usage) -> VertexBuffer
3
+ def initialize: () -> void
4
+ | (Integer count) -> void
5
+ | (Integer count, Symbol primitive) -> void
6
+ | (Integer count, Symbol primitive, Symbol usage) -> void
7
7
  def self.available?: () -> bool
8
8
 
9
9
  def copy: () -> VertexBuffer
@@ -1,6 +1,5 @@
1
1
  module SFML
2
2
  class View
3
- def self.new: () -> View
4
3
  def self.from_rect: (untyped rect) -> View
5
4
 
6
5
  def initialize: () -> void
data/sig/network/ftp.rbs CHANGED
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Ftp
3
- def self.new: () -> Ftp
3
+ def initialize: () -> void
4
4
 
5
5
  def connect: (IpAddress | String | Integer address, ?Integer port, ?Time timeout) -> FtpResponse
6
6
  def login_anonymous: () -> FtpResponse
data/sig/network/http.rbs CHANGED
@@ -1,13 +1,13 @@
1
1
  module SFML
2
2
  class Http
3
- def self.new: () -> Http
3
+ def initialize: () -> void
4
4
 
5
5
  def set_host: (String host, ?Integer port) -> self
6
6
  def send_request: (HttpRequest request, ?Time timeout) -> HttpResponse
7
7
  end
8
8
 
9
9
  class HttpRequest
10
- def self.new: () -> HttpRequest
10
+ def initialize: () -> void
11
11
 
12
12
  def set_field: (String field, String value) -> String
13
13
  def method=: (Symbol | Integer value) -> (Symbol | Integer)
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class IpAddress
3
- def self.new: (Integer | String | IpAddress address) -> IpAddress
3
+ def initialize: (Integer | String | IpAddress address) -> void
4
4
  def self.from_string: (String address) -> IpAddress
5
5
  def self.from_bytes: (Integer byte0, Integer byte1, Integer byte2, Integer byte3) -> IpAddress
6
6
  def self.from_integer: (Integer value) -> IpAddress
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Packet
3
- def self.new: () -> Packet
3
+ def initialize: () -> void
4
4
 
5
5
  def copy: () -> Packet
6
6
  def append: (String data) -> self
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class SocketSelector
3
- def self.new: () -> SocketSelector
3
+ def initialize: () -> void
4
4
 
5
5
  def copy: () -> SocketSelector
6
6
  def add: (TcpListener | TcpSocket | UdpSocket socket) -> self
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class TcpListener
3
- def self.new: () -> TcpListener
3
+ def initialize: () -> void
4
4
  def self.any_port: () -> Integer
5
5
 
6
6
  def blocking?: () -> bool
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class TcpSocket
3
- def self.new: () -> TcpSocket
3
+ def initialize: () -> void
4
4
 
5
5
  def blocking?: () -> bool
6
6
  def blocking=: (bool value) -> bool
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class UdpSocket
3
- def self.new: () -> UdpSocket
3
+ def initialize: () -> void
4
4
  def self.any_port: () -> Integer
5
5
  def self.max_datagram_size: () -> Integer
6
6
 
@@ -0,0 +1,3 @@
1
+ module SFML
2
+ VERSION: String
3
+ end
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Buffer
3
- def self.new: () -> Buffer
3
+ def initialize: () -> void
4
4
 
5
5
  def size: () -> Integer
6
6
  def length: () -> Integer
data/sig/system/clock.rbs CHANGED
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Clock
3
- def self.new: () -> Clock
3
+ def initialize: () -> void
4
4
 
5
5
  def elapsed_time: () -> Time
6
6
  def restart!: () -> Time
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class InputStream
3
- def self.new: (untyped io) -> InputStream
3
+ def initialize: (untyped io) -> void
4
4
 
5
5
  def io: () -> untyped
6
6
  end
data/sig/system/time.rbs CHANGED
@@ -2,10 +2,10 @@ module SFML
2
2
  class Time
3
3
  include Comparable
4
4
 
5
- def self.new: () -> Time
6
- | (Float seconds) -> Time
7
- | (Integer microseconds) -> Time
8
- | (Time other) -> Time
5
+ def initialize: () -> void
6
+ | (Float seconds) -> void
7
+ | (Integer microseconds) -> void
8
+ | (Time other) -> void
9
9
  def self.seconds: (Float value) -> Time
10
10
  def self.milliseconds: (Integer value) -> Time
11
11
  def self.microseconds: (Integer value) -> Time
data/sig/system/vec2.rbs CHANGED
@@ -2,10 +2,10 @@ module SFML
2
2
  class Vector2
3
3
  include Enumerable[Float]
4
4
 
5
- def self.new: () -> Vector2
6
- | (Float x, Float y) -> Vector2
7
- | (Array[Float] xy) -> Vector2
8
- | (Vector2 other) -> Vector2
5
+ def initialize: () -> void
6
+ | (Float x, Float y) -> void
7
+ | (Array[Float] xy) -> void
8
+ | (Vector2 other) -> void
9
9
 
10
10
  def x: () -> Float
11
11
  def x=: (Float value) -> Float
data/sig/system/vec3.rbs CHANGED
@@ -2,10 +2,10 @@ module SFML
2
2
  class Vector3
3
3
  include Enumerable[Float]
4
4
 
5
- def self.new: () -> Vector3
6
- | (Float x, Float y, Float z) -> Vector3
7
- | (Array[Float] xyz) -> Vector3
8
- | (Vector3 other) -> Vector3
5
+ def initialize: () -> void
6
+ | (Float x, Float y, Float z) -> void
7
+ | (Array[Float] xyz) -> void
8
+ | (Vector3 other) -> void
9
9
 
10
10
  def x: () -> Float
11
11
  def x=: (Float value) -> Float
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Context
3
- def self.new: () -> Context
3
+ def initialize: () -> void
4
4
  def self.extension_available?: (String name) -> bool
5
5
  def self.function: (String name) -> Integer
6
6
  def self.active_context_id: () -> Integer
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class ContextSettings
3
- def self.new: (?Integer depth_bits, ?Integer stencil_bits, ?Integer antialiasing_level, ?Integer major_version, ?Integer minor_version, ?(Symbol | Array[Symbol] | Integer) flags, ?bool srgb_capable) -> ContextSettings
3
+ def initialize: (?Integer depth_bits, ?Integer stencil_bits, ?Integer antialiasing_level, ?Integer major_version, ?Integer minor_version, ?(Symbol | Array[Symbol] | Integer) flags, ?bool srgb_capable) -> void
4
4
 
5
5
  def depth_bits: () -> Integer
6
6
  def depth_bits=: (Integer value) -> Integer
data/sig/window/event.rbs CHANGED
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class Event
3
- def self.new: () -> Event
3
+ def initialize: () -> void
4
4
 
5
5
  def type: () -> String
6
6
  def size: () -> Vector2
data/sig/window/mouse.rbs CHANGED
@@ -2,8 +2,8 @@ module SFML
2
2
  module Mouse
3
3
  def self.button_pressed?: (Symbol | Integer button) -> bool
4
4
  def self.pressed?: (Symbol | Integer button) -> bool
5
- def self.position: (?Window? window) -> Vector2
6
- def self.set_position: (Vector2 | Array[Float] position, ?Window? window) -> Vector2
5
+ def self.position: (?WindowBase? window) -> Vector2
6
+ def self.set_position: (Vector2 | Array[Float] position, ?WindowBase? window) -> Vector2
7
7
  def self.position=: (Vector2 | Array[Float] value) -> Vector2
8
8
  end
9
9
  end
data/sig/window/touch.rbs CHANGED
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  module Touch
3
3
  def self.down?: (Integer finger) -> bool
4
- def self.position: (Integer finger, ?Window? window) -> Vector2
4
+ def self.position: (Integer finger, ?WindowBase? window) -> Vector2
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module SFML
2
2
  class VideoMode
3
- def self.new: (Integer width, Integer height, Integer bits_per_pixel) -> VideoMode
3
+ def initialize: (Integer width, Integer height, Integer bits_per_pixel) -> void
4
4
  def self.desktop_mode: () -> VideoMode
5
5
  def self.fullscreen_modes: () -> Array[VideoMode]
6
6
 
@@ -1,44 +1,21 @@
1
1
  module SFML
2
- class Window
3
- def self.new: (VideoMode video_mode, String title, ?Symbol | Array[Symbol] | Integer style, ?Symbol state, ?ContextSettings? settings) -> Window
2
+ class Window < WindowBase
3
+ def initialize: (VideoMode video_mode, String title, ?Symbol | Array[Symbol] | Integer style, ?Symbol state, ?ContextSettings? settings) -> void
4
4
  def self.from_handle: (Integer handle, ?ContextSettings? settings) -> Window
5
5
 
6
- def is_open?: () -> bool
7
- def close!: () -> self
8
6
  def clear: (?untyped color) -> self
9
7
  def display: () -> self
10
- def poll_event!: (Event event) -> bool
11
- def wait_event!: (Event event) -> bool
12
8
 
13
9
  def frame_rate=: (Integer value) -> self
14
10
  def framerate_limit=: (Integer value) -> self
15
- def size=: (Vector2 | Array[Float] value) -> self
16
- def minimum_size=: (Vector2 | Array[Float] value) -> (Vector2 | Array[Float])
17
- def maximum_size=: (Vector2 | Array[Float] value) -> (Vector2 | Array[Float])
18
- def title=: (String value) -> self
19
- def set_icon: (Vector2 | Array[Float] size, String pixels) -> String
20
- def visible=: (bool value) -> self
21
11
  def active=: (bool value) -> bool
22
12
  def vertical_sync_enabled=: (bool value) -> self
23
- def cursor_visible=: (bool value) -> self
24
- def cursor_grabbed=: (bool value) -> self
25
- def mouse_cursor=: (Cursor? value) -> Cursor?
26
- def cursor=: (Cursor? value) -> Cursor?
27
- def key_repeat_enabled=: (bool value) -> self
28
- def joystick_threshold=: (Float value) -> Float
29
- def position=: (Vector2 | Array[Float] value) -> (Vector2 | Array[Float])
30
13
  def view=: (untyped value) -> self
31
14
 
32
- def request_focus: () -> self
33
- def focus?: () -> bool
34
15
  def draw: (untyped drawable, ?untyped state) -> self
35
- def position: () -> Vector2
36
- def size: () -> Vector2
37
16
  def view: () -> untyped
38
17
  def default_view: () -> untyped
39
18
  def settings: () -> ContextSettings
40
- def native_handle: () -> Integer
41
- def create_vulkan_surface: (Integer instance, ?Integer? allocator) -> Integer?
42
19
 
43
20
  # Shared with RenderTexture, via ext/graphics/render_target.inc.
44
21
  def srgb?: () -> bool
@@ -0,0 +1,33 @@
1
+ module SFML
2
+ class WindowBase
3
+ def initialize: (VideoMode video_mode, String title, ?Symbol | Array[Symbol] | Integer style, ?Symbol state) -> void
4
+ def self.from_handle: (Integer handle) -> WindowBase
5
+
6
+ def is_open?: () -> bool
7
+ def close!: () -> self
8
+ def poll_event!: (Event event) -> bool
9
+ def wait_event!: (Event event) -> bool
10
+
11
+ def position: () -> Vector2
12
+ def size: () -> Vector2
13
+ def focus?: () -> bool
14
+ def native_handle: () -> Integer
15
+
16
+ def position=: (Vector2 | Array[Float] value) -> (Vector2 | Array[Float])
17
+ def size=: (Vector2 | Array[Float] value) -> self
18
+ def minimum_size=: (Vector2 | Array[Float] value) -> (Vector2 | Array[Float])
19
+ def maximum_size=: (Vector2 | Array[Float] value) -> (Vector2 | Array[Float])
20
+ def title=: (String value) -> self
21
+ def set_icon: (Vector2 | Array[Float] size, String pixels) -> String
22
+ def visible=: (bool value) -> self
23
+ def cursor_visible=: (bool value) -> self
24
+ def cursor_grabbed=: (bool value) -> self
25
+ def mouse_cursor=: (Cursor? value) -> Cursor?
26
+ def cursor=: (Cursor? value) -> Cursor?
27
+ def key_repeat_enabled=: (bool value) -> self
28
+ def joystick_threshold=: (Float value) -> Float
29
+
30
+ def request_focus: () -> self
31
+ def create_vulkan_surface: (Integer instance, ?Integer? allocator) -> Integer?
32
+ end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfml3-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: x86_64-linux-gnu
6
6
  authors:
7
7
  - Algaves
@@ -54,7 +54,9 @@ files:
54
54
  - sig/graphics/rect.rbs
55
55
  - sig/graphics/rectangle.rbs
56
56
  - sig/graphics/render_state.rbs
57
+ - sig/graphics/render_target.rbs
57
58
  - sig/graphics/render_texture.rbs
59
+ - sig/graphics/render_window.rbs
58
60
  - sig/graphics/shader.rbs
59
61
  - sig/graphics/shape.rbs
60
62
  - sig/graphics/sprite.rbs
@@ -77,6 +79,7 @@ files:
77
79
  - sig/network/tcp_listener.rbs
78
80
  - sig/network/tcp_socket.rbs
79
81
  - sig/network/udp_socket.rbs
82
+ - sig/sfml/version.rbs
80
83
  - sig/system/buffer.rbs
81
84
  - sig/system/clock.rbs
82
85
  - sig/system/input_stream.rbs
@@ -97,6 +100,7 @@ files:
97
100
  - sig/window/video_mode.rbs
98
101
  - sig/window/vulkan.rbs
99
102
  - sig/window/window.rbs
103
+ - sig/window/window_base.rbs
100
104
  homepage: https://github.com/algaves/sfml3.rb
101
105
  licenses:
102
106
  - 0BSD
@@ -104,7 +108,7 @@ metadata:
104
108
  source_code_uri: https://github.com/algaves/sfml3.rb
105
109
  bug_tracker_uri: https://github.com/algaves/sfml3.rb/issues
106
110
  changelog_uri: https://github.com/algaves/sfml3.rb/blob/main/CHANGELOG.md
107
- documentation_uri: https://rubydoc.info/gems/sfml3-rb
111
+ documentation_uri: https://algaves.github.io/sfml3.rb/
108
112
  rubygems_mfa_required: 'true'
109
113
  rdoc_options:
110
114
  - "--main"