sdl3-bindings 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ChangeLog +159 -0
- data/LICENSE.txt +21 -0
- data/README.md +132 -0
- data/lib/sdl3.rb +150 -0
- data/lib/sdl3_assert.rb +61 -0
- data/lib/sdl3_asyncio.rb +68 -0
- data/lib/sdl3_atomic.rb +64 -0
- data/lib/sdl3_audio.rb +120 -0
- data/lib/sdl3_bits.rb +38 -0
- data/lib/sdl3_blendmode.rb +63 -0
- data/lib/sdl3_camera.rb +67 -0
- data/lib/sdl3_clipboard.rb +49 -0
- data/lib/sdl3_cpuinfo.rb +55 -0
- data/lib/sdl3_dialog.rb +60 -0
- data/lib/sdl3_endian.rb +39 -0
- data/lib/sdl3_error.rb +41 -0
- data/lib/sdl3_events.rb +680 -0
- data/lib/sdl3_filesystem.rb +82 -0
- data/lib/sdl3_gamepad.rb +216 -0
- data/lib/sdl3_gpu.rb +836 -0
- data/lib/sdl3_guid.rb +44 -0
- data/lib/sdl3_haptic.rb +209 -0
- data/lib/sdl3_hidapi.rb +84 -0
- data/lib/sdl3_hints.rb +285 -0
- data/lib/sdl3_image.rb +108 -0
- data/lib/sdl3_init.rb +71 -0
- data/lib/sdl3_iostream.rb +115 -0
- data/lib/sdl3_joystick.rb +174 -0
- data/lib/sdl3_keyboard.rb +81 -0
- data/lib/sdl3_keycode.rb +310 -0
- data/lib/sdl3_loadso.rb +39 -0
- data/lib/sdl3_locale.rb +44 -0
- data/lib/sdl3_log.rb +85 -0
- data/lib/sdl3_messagebox.rb +88 -0
- data/lib/sdl3_misc.rb +37 -0
- data/lib/sdl3_mixer.rb +179 -0
- data/lib/sdl3_mouse.rb +90 -0
- data/lib/sdl3_mutex.rb +77 -0
- data/lib/sdl3_pen.rb +56 -0
- data/lib/sdl3_pixels.rb +296 -0
- data/lib/sdl3_platform.rb +37 -0
- data/lib/sdl3_power.rb +44 -0
- data/lib/sdl3_process.rb +65 -0
- data/lib/sdl3_properties.rb +67 -0
- data/lib/sdl3_rect.rb +98 -0
- data/lib/sdl3_render.rb +240 -0
- data/lib/sdl3_revision.rb +37 -0
- data/lib/sdl3_scancode.rb +286 -0
- data/lib/sdl3_sensor.rb +61 -0
- data/lib/sdl3_sound.rb +98 -0
- data/lib/sdl3_stdinc.rb +229 -0
- data/lib/sdl3_storage.rb +70 -0
- data/lib/sdl3_surface.rb +122 -0
- data/lib/sdl3_thread.rb +65 -0
- data/lib/sdl3_time.rb +66 -0
- data/lib/sdl3_timer.rb +54 -0
- data/lib/sdl3_touch.rb +56 -0
- data/lib/sdl3_tray.rb +66 -0
- data/lib/sdl3_ttf.rb +216 -0
- data/lib/sdl3_version.rb +41 -0
- data/lib/sdl3_video.rb +341 -0
- data/lib/sdl3_vulkan.rb +46 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1c12c2977e8e8f0680329636e3d24b46b25baac800d2bf096ee12a8e4fe9bd8a
|
4
|
+
data.tar.gz: '0689c67c1b15cadd406ec22559cd986ae5561ab3017af2851d9a4ab80c2e2334'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: adcae0eea26b78dfaf0e89b2700c0b4c82d6bf7c3ba6e3b7d36e598bb232a926ea9e7789e8ab20b29626f7a9b43ad3eba2e251b505d0aa9e0fcad23e5d3df52f
|
7
|
+
data.tar.gz: 0426a69c92d66633841b5c24a110f637f0d1a59820238154a19762c24a0b774be0db1ee55f1cf35bc378070ceb5f871c8d40ccff3a0b84523799bca8968e64f9
|
data/ChangeLog
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
2025-01-26 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
|
+
|
3
|
+
* SDL 3.2.0 ( https://github.com/libsdl-org/SDL/releases/tag/release-3.2.0 )
|
4
|
+
* Improved generator to produce shorter binding code.
|
5
|
+
|
6
|
+
2023-02-05 vaiorabbit <http://twitter.com/vaiorabbit>
|
7
|
+
|
8
|
+
* lib/sdl2_syswm.rb: Added X11 support
|
9
|
+
* Added Linux (on WSL) as a tested environment
|
10
|
+
|
11
|
+
2022-11-23 vaiorabbit <http://twitter.com/vaiorabbit>
|
12
|
+
|
13
|
+
* SDL 2.26.0 ( https://github.com/libsdl-org/SDL/releases/tag/release-2.26.0 )
|
14
|
+
|
15
|
+
2022-10-09 vaiorabbit <http://twitter.com/vaiorabbit>
|
16
|
+
|
17
|
+
* SDL 2.24.1 ( https://github.com/libsdl-org/SDL/releases/tag/release-2.24.1 )
|
18
|
+
* Fixed wrong value definitions
|
19
|
+
|
20
|
+
2022-08-20 vaiorabbit <http://twitter.com/vaiorabbit>
|
21
|
+
|
22
|
+
* SDL 2.24.0 ( https://github.com/libsdl-org/SDL/releases/tag/release-2.24.0 )
|
23
|
+
* Generated for SDL_image 2.6.2, SDL_mixer 2.6.2 and SDL_ttf 2.20.1
|
24
|
+
* SDL::JoystickGUID is now defined as an alias of SDL::GUID ( https://github.com/libsdl-org/SDL/commit/3a20274ddff20d9c3ea4895353b23ff252954b87 )
|
25
|
+
|
26
|
+
2022-07-31 vaiorabbit <http://twitter.com/vaiorabbit>
|
27
|
+
|
28
|
+
* Regenerated bindings to fix bugs (size_t interpretation)
|
29
|
+
* Regenerated bindings for SDL_image 2.6.0, SDL_mixer 2.6.0 and SDL_ttf 2.20.0
|
30
|
+
|
31
|
+
2022-05-01 vaiorabbit <http://twitter.com/vaiorabbit>
|
32
|
+
|
33
|
+
* lib/sdl2_rwops.rb: Added RW_SEEK_SET, RW_SEEK_CUR and RW_SEEK_END
|
34
|
+
|
35
|
+
2022-04-29 vaiorabbit <http://twitter.com/vaiorabbit>
|
36
|
+
|
37
|
+
* Added SDL 2.0.22 features ( https://github.com/libsdl-org/SDL/releases/tag/release-2.0.22 )
|
38
|
+
* third_party/sdl2_build_dll.cmd: Updated to refer 2.0.22
|
39
|
+
|
40
|
+
2022-03-28 vaiorabbit <http://twitter.com/vaiorabbit>
|
41
|
+
|
42
|
+
* lib/sdl2_sound.rb: Added
|
43
|
+
|
44
|
+
2022-02-13 vaiorabbit <http://twitter.com/vaiorabbit>
|
45
|
+
|
46
|
+
* Removed unavailable inline functions (SDL_memset4, SDL_memcpy4)
|
47
|
+
|
48
|
+
2022-02-12 vaiorabbit <http://twitter.com/vaiorabbit>
|
49
|
+
|
50
|
+
* Some tests are now available on Windows
|
51
|
+
|
52
|
+
2022-01-26 vaiorabbit <http://twitter.com/vaiorabbit>
|
53
|
+
|
54
|
+
* test/test*.rb: Changed namespace
|
55
|
+
* load_lib: Now accepts argument 'output_error'
|
56
|
+
|
57
|
+
2022-01-22 vaiorabbit <http://twitter.com/vaiorabbit>
|
58
|
+
|
59
|
+
* lib/sdl2_ttf.rb: Generated for version 2.0.18
|
60
|
+
* generator: Fixed wrong 'by_value' handling
|
61
|
+
* .gitignore: Added
|
62
|
+
* test/test_opengl.rb: Use opengl-bindings2
|
63
|
+
|
64
|
+
2022-01-11 vaiorabbit <http://twitter.com/vaiorabbit>
|
65
|
+
|
66
|
+
* Added SDL 2.0.20 features ( https://github.com/libsdl-org/SDL/releases/tag/release-2.0.20 )
|
67
|
+
|
68
|
+
2021-12-02 vaiorabbit <http://twitter.com/vaiorabbit>
|
69
|
+
|
70
|
+
* Added SDL 2.0.18 features ( https://github.com/libsdl-org/SDL/releases/tag/release-2.0.18 )
|
71
|
+
|
72
|
+
2021-08-12 vaiorabbit <http://twitter.com/vaiorabbit>
|
73
|
+
|
74
|
+
* Added SDL 2.0.14 features (SDL_misc).
|
75
|
+
* Added SDL 2.0.16 features (SDL_sensor).
|
76
|
+
|
77
|
+
2021-02-21 vaiorabbit <http://twitter.com/vaiorabbit>
|
78
|
+
|
79
|
+
* Added defines from Audio, Mixer and TTF
|
80
|
+
|
81
|
+
2020-12-27 vaiorabbit <http://twitter.com/vaiorabbit>
|
82
|
+
|
83
|
+
* Added SDL 2.0.14 features.
|
84
|
+
* third_party/sdl2_build_dll.sh: Added to build x64 DLL for Windows
|
85
|
+
* test/util.rb: Added
|
86
|
+
|
87
|
+
2020-12-20 vaiorabbit <http://twitter.com/vaiorabbit>
|
88
|
+
|
89
|
+
* third_party/sdl2_build_dylib.sh: Added to build x86_64|arm64 Universal Binary
|
90
|
+
|
91
|
+
2020-06-08 vaiorabbit <http://twitter.com/vaiorabbit>
|
92
|
+
|
93
|
+
* lib/sdl2_syswm.rb: Added
|
94
|
+
* lib/sdl2_hints.rb: Added hint string symboles
|
95
|
+
|
96
|
+
2020-03-22 vaiorabbit <http://twitter.com/vaiorabbit>
|
97
|
+
|
98
|
+
* Added SDL 2.0.12 features.
|
99
|
+
* Generate callback types correctly.
|
100
|
+
|
101
|
+
2019-10-27 vaiorabbit <http://twitter.com/vaiorabbit>
|
102
|
+
|
103
|
+
* lib/sdl2_stdinc.rb: Added.
|
104
|
+
|
105
|
+
2019-08-31 vaiorabbit <http://twitter.com/vaiorabbit>
|
106
|
+
|
107
|
+
* Refactoring + Cleanup
|
108
|
+
* Some tests are usable again
|
109
|
+
|
110
|
+
2019-08-28 vaiorabbit <http://twitter.com/vaiorabbit>
|
111
|
+
|
112
|
+
* Exception-safety
|
113
|
+
|
114
|
+
2019-08-27 vaiorabbit <http://twitter.com/vaiorabbit>
|
115
|
+
|
116
|
+
* lib/sdl2_mixer.rb: Added (experimental)
|
117
|
+
|
118
|
+
2019-08-24 vaiorabbit <http://twitter.com/vaiorabbit>
|
119
|
+
|
120
|
+
* Added SDL 2.0.10 features.
|
121
|
+
* Added generator. Binding codes are generated semi-automatically.
|
122
|
+
* Now depends on Ruby/FFI. Note that some codes in 'test' directory are still not usable.
|
123
|
+
|
124
|
+
2016-04-03 vaiorabbit <http://twitter.com/vaiorabbit>
|
125
|
+
|
126
|
+
* lib/sdl2_gfx.rb, test/test_gfx.rb: Added.
|
127
|
+
|
128
|
+
2016-04-02 vaiorabbit <http://twitter.com/vaiorabbit>
|
129
|
+
|
130
|
+
* Added SDL 2.0.4 features.
|
131
|
+
* lib/version.rb: Added SDL_MAJOR_VERSION, etc.
|
132
|
+
|
133
|
+
2015-09-29 vaiorabbit <http://twitter.com/vaiorabbit>
|
134
|
+
|
135
|
+
* lib/sdl2_ttf.rb: Added.
|
136
|
+
|
137
|
+
2015-09-28 vaiorabbit <http://twitter.com/vaiorabbit>
|
138
|
+
|
139
|
+
* lib/sdl2_image.rb: Added.
|
140
|
+
* lib/sdl2_mixer.rb: Added.
|
141
|
+
|
142
|
+
2015-09-22 vaiorabbit <http://twitter.com/vaiorabbit>
|
143
|
+
|
144
|
+
* lib/pixels.rb, lib/gamecontroller.rb, lib/joystick.rb: Added.
|
145
|
+
* lib/rwops.rb, lib/syswm.rb, lib/surface.rb, lib/render.rb: Added.
|
146
|
+
* lib/cpuinfo.rb, lib/gesture.rb, lib/touch.rb, lib/audio.rb: Added.
|
147
|
+
|
148
|
+
2015-09-21 vaiorabbit <http://twitter.com/vaiorabbit>
|
149
|
+
|
150
|
+
* lib/events.rb, lib/timer.rb, lib/video.rb: Added.
|
151
|
+
* lib/keyboard.rb, lib/keycode.rb, lib/scancode.rb: Added.
|
152
|
+
* lib/error.rb: Added.
|
153
|
+
* lib/blendmode.rb, lib/clipboard.rb, lib/filesystem.rb, lib/version.rb: Added.
|
154
|
+
* lib/platform.rb, lib/rect.rb, lib/mouse.rb: Added.
|
155
|
+
* lib/messagebox.rb, lib/pixels.rb: Added.
|
156
|
+
|
157
|
+
2015-09-19 vaiorabbit <http://twitter.com/vaiorabbit>
|
158
|
+
|
159
|
+
* Project started.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
sdl3-bindings : SDL3 wrapper for Ruby
|
2
|
+
Copyright (c) 2015-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
3
|
+
|
4
|
+
This software is provided 'as-is', without any express or implied
|
5
|
+
warranty. In no event will the authors be held liable for any damages
|
6
|
+
arising from the use of this software.
|
7
|
+
|
8
|
+
Permission is granted to anyone to use this software for any purpose,
|
9
|
+
including commercial applications, and to alter it and redistribute it
|
10
|
+
freely, subject to the following restrictions:
|
11
|
+
|
12
|
+
1. The origin of this software must not be misrepresented; you must not
|
13
|
+
claim that you wrote the original software. If you use this software
|
14
|
+
in a product, an acknowledgment in the product documentation would be
|
15
|
+
appreciated but is not required.
|
16
|
+
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
18
|
+
misrepresented as being the original software.
|
19
|
+
|
20
|
+
3. This notice may not be removed or altered from any source
|
21
|
+
distribution.
|
data/README.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
<!-- -*- mode:markdown; coding:utf-8; -*- -->
|
2
|
+
|
3
|
+
# sdl3-bindings : SDL3 wrapper for Ruby #
|
4
|
+
|
5
|
+
* Created : 2015-09-19
|
6
|
+
* Last modified : 2025-01-26
|
7
|
+
|
8
|
+
## Features ##
|
9
|
+
|
10
|
+
* Generated semi-automatically
|
11
|
+
* Based on Ruby/FFI
|
12
|
+
* No need to build C extension library
|
13
|
+
|
14
|
+
See the project below to learn how to use this library:
|
15
|
+
|
16
|
+
* Whac-a-Mole! : Ruby SDL2 bindings demo
|
17
|
+
* <https://github.com/vaiorabbit/sdl2-bindings-whacamole>
|
18
|
+
* [](https://www.youtube.com/watch?v=HroP-_EWcg8)
|
19
|
+
|
20
|
+
## Limitations ##
|
21
|
+
|
22
|
+
* Several original APIs originally defined with pre-processor macro are unavailable in this library (e.g. `SDL_TriggerBreakpoint`, `SDL_stack_alloc`, `SDL_BUTTON_MASK`, etc.)
|
23
|
+
|
24
|
+
## Target version ##
|
25
|
+
|
26
|
+
* [2025-01-26]
|
27
|
+
* SDL : 3.2.0
|
28
|
+
* SDL_image : 3.1.1
|
29
|
+
* SDL_mixer : 3.0.0
|
30
|
+
* SDL_ttf : 3.1.0
|
31
|
+
* SDL_sound : 3.0.0
|
32
|
+
|
33
|
+
<details>
|
34
|
+
<summary>Older versions</summary>
|
35
|
+
|
36
|
+
* [2015-09-19] SDL 2.0.3
|
37
|
+
* [2016-04-03] SDL 2.0.4
|
38
|
+
* [2019-08-31] SDL 2.0.10
|
39
|
+
* [2020-03-22] SDL 2.0.12
|
40
|
+
* [2020-12-27] SDL 2.0.14
|
41
|
+
* [2021-08-12] SDL 2.0.16
|
42
|
+
* [2021-12-02] SDL 2.0.18
|
43
|
+
* [2022-03-28]
|
44
|
+
* SDL : 2.0.20
|
45
|
+
* SDL_image : 2.0.5
|
46
|
+
* SDL_mixer : 2.0.4
|
47
|
+
* SDL_ttf : 2.0.18
|
48
|
+
* SDL2_gfx : 1.0.4
|
49
|
+
* SDL_sound : 2.0.1
|
50
|
+
* [2022-04-29]
|
51
|
+
* SDL : 2.0.22
|
52
|
+
* SDL_image : 2.0.5
|
53
|
+
* SDL_mixer : 2.0.4
|
54
|
+
* SDL_ttf : 2.0.18
|
55
|
+
* SDL2_gfx : 1.0.4
|
56
|
+
* SDL_sound : 2.0.1
|
57
|
+
* [2022-07-31]
|
58
|
+
* SDL : 2.0.22
|
59
|
+
* SDL_image : 2.6.0
|
60
|
+
* SDL_mixer : 2.6.0
|
61
|
+
* SDL_ttf : 2.20.0
|
62
|
+
* SDL2_gfx : 1.0.4
|
63
|
+
* SDL_sound : 2.0.1
|
64
|
+
* [2022-08-20]
|
65
|
+
* SDL : 2.24.0
|
66
|
+
* SDL_image : 2.6.2
|
67
|
+
* SDL_mixer : 2.6.2
|
68
|
+
* SDL_ttf : 2.20.1
|
69
|
+
* SDL2_gfx : 1.0.4
|
70
|
+
* SDL_sound : 2.0.1
|
71
|
+
* [2022-10-09]
|
72
|
+
* SDL : 2.24.1
|
73
|
+
* SDL_image : 2.6.2
|
74
|
+
* SDL_mixer : 2.6.2
|
75
|
+
* SDL_ttf : 2.20.1
|
76
|
+
* SDL2_gfx : 1.0.4
|
77
|
+
* SDL_sound : 2.0.1
|
78
|
+
* [2022-11-03]
|
79
|
+
* SDL : 2.24.2
|
80
|
+
* SDL_image : 2.6.2
|
81
|
+
* SDL_mixer : 2.6.2
|
82
|
+
* SDL_ttf : 2.20.1
|
83
|
+
* SDL2_gfx : 1.0.4
|
84
|
+
* SDL_sound : 2.0.1
|
85
|
+
* [2022-11-23]
|
86
|
+
* SDL : 2.26.0 - 2.26.2
|
87
|
+
* SDL_image : 2.6.2
|
88
|
+
* SDL_mixer : 2.6.2
|
89
|
+
* SDL_ttf : 2.20.1
|
90
|
+
* SDL2_gfx : 1.0.4
|
91
|
+
* SDL_sound : 2.0.1
|
92
|
+
|
93
|
+
</details>
|
94
|
+
|
95
|
+
## Tested Environments ##
|
96
|
+
|
97
|
+
* [2025-01-26] Windows 11 (24H2), ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x64-mingw-ucrt]
|
98
|
+
|
99
|
+
<details>
|
100
|
+
<summary>Older Environments</summary>
|
101
|
+
|
102
|
+
* [2023-02-05] Ubuntu Linux 22.04 LTS (jammy) on WSL/Windows 11, ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]
|
103
|
+
* [2023-01-07] Windows 11 (22H2), ruby 3.2.0 (2022-12-25 revision a528908271) [x64-mingw-ucrt]
|
104
|
+
* [2023-01-07] macOS Ventura (13.1) ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin21]
|
105
|
+
* [2022-10-09] Debian 11 (bullseye) on ASUS Chromebook Detachable CZ1, ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [aarch64-linux]
|
106
|
+
* [2022-04-29] Windows 10 (21H1), ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x64-mingw-ucrt]
|
107
|
+
* [2022-10-09] macOS Monterey (12.5.1), ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
|
108
|
+
* [2022-07-31] macOS Monterey (12.4), ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin21]
|
109
|
+
* [2022-02-12] Windows 10 (21H1), ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
|
110
|
+
* [2022-01-11] macOS Monterey (12.1), ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
|
111
|
+
* [2021-12-02] macOS Big Sur (11.6), ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
|
112
|
+
* [2021-08-12] macOS Big Sur (11.5), ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]
|
113
|
+
* [2020-12-27] macOS Big Sur (11.0.1), ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]
|
114
|
+
* [2016-04-03] Mac OS X 10.11.4, ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
|
115
|
+
* [2015-09-19] Mac OS X 10.10.5, ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
|
116
|
+
|
117
|
+
</details>
|
118
|
+
|
119
|
+
## License ##
|
120
|
+
|
121
|
+
The zlib/libpng License ( http://opensource.org/licenses/Zlib ).
|
122
|
+
|
123
|
+
sdl3-bindings : SDL3 wrapper for Ruby
|
124
|
+
Copyright (c) 2015-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
125
|
+
|
126
|
+
This software is provided 'as-is', without any express or implied
|
127
|
+
warranty. In no event will the authors be held liable for any damages
|
128
|
+
arising from the use of this software.
|
129
|
+
|
130
|
+
Permission is granted to anyone to use this software for any purpose,
|
131
|
+
including commercial applications, and to alter it and redistribute it
|
132
|
+
freely, subject to the following restrictions:
|
data/lib/sdl3.rb
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
# Ruby-SDL3 : SDL3 wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/sdl3-bindings
|
4
|
+
|
5
|
+
require 'ffi'
|
6
|
+
require_relative 'sdl3_assert.rb'
|
7
|
+
require_relative 'sdl3_asyncio.rb'
|
8
|
+
require_relative 'sdl3_atomic.rb'
|
9
|
+
require_relative 'sdl3_audio.rb'
|
10
|
+
require_relative 'sdl3_bits.rb'
|
11
|
+
require_relative 'sdl3_blendmode.rb'
|
12
|
+
require_relative 'sdl3_camera.rb'
|
13
|
+
require_relative 'sdl3_clipboard.rb'
|
14
|
+
require_relative 'sdl3_cpuinfo.rb'
|
15
|
+
require_relative 'sdl3_dialog.rb'
|
16
|
+
require_relative 'sdl3_endian.rb'
|
17
|
+
require_relative 'sdl3_error.rb'
|
18
|
+
require_relative 'sdl3_events.rb'
|
19
|
+
require_relative 'sdl3_filesystem.rb'
|
20
|
+
require_relative 'sdl3_gamepad.rb'
|
21
|
+
require_relative 'sdl3_gpu.rb'
|
22
|
+
require_relative 'sdl3_guid.rb'
|
23
|
+
require_relative 'sdl3_haptic.rb'
|
24
|
+
require_relative 'sdl3_hints.rb'
|
25
|
+
require_relative 'sdl3_init.rb'
|
26
|
+
require_relative 'sdl3_iostream.rb'
|
27
|
+
require_relative 'sdl3_joystick.rb'
|
28
|
+
require_relative 'sdl3_keyboard.rb'
|
29
|
+
require_relative 'sdl3_keycode.rb'
|
30
|
+
require_relative 'sdl3_loadso.rb'
|
31
|
+
require_relative 'sdl3_log.rb'
|
32
|
+
require_relative 'sdl3_messagebox.rb'
|
33
|
+
require_relative 'sdl3_misc.rb'
|
34
|
+
require_relative 'sdl3_mouse.rb'
|
35
|
+
require_relative 'sdl3_mutex.rb'
|
36
|
+
require_relative 'sdl3_pen.rb'
|
37
|
+
require_relative 'sdl3_pixels.rb'
|
38
|
+
require_relative 'sdl3_platform.rb'
|
39
|
+
require_relative 'sdl3_power.rb'
|
40
|
+
require_relative 'sdl3_process.rb'
|
41
|
+
require_relative 'sdl3_properties.rb'
|
42
|
+
require_relative 'sdl3_rect.rb'
|
43
|
+
require_relative 'sdl3_render.rb'
|
44
|
+
require_relative 'sdl3_revision.rb'
|
45
|
+
require_relative 'sdl3_scancode.rb'
|
46
|
+
require_relative 'sdl3_sensor.rb'
|
47
|
+
require_relative 'sdl3_stdinc.rb'
|
48
|
+
require_relative 'sdl3_storage.rb'
|
49
|
+
require_relative 'sdl3_surface.rb'
|
50
|
+
require_relative 'sdl3_thread.rb'
|
51
|
+
require_relative 'sdl3_time.rb'
|
52
|
+
require_relative 'sdl3_timer.rb'
|
53
|
+
require_relative 'sdl3_touch.rb'
|
54
|
+
require_relative 'sdl3_tray.rb'
|
55
|
+
require_relative 'sdl3_version.rb'
|
56
|
+
require_relative 'sdl3_video.rb'
|
57
|
+
require_relative 'sdl3_vulkan.rb'
|
58
|
+
|
59
|
+
# SDL_image
|
60
|
+
require_relative 'sdl3_image.rb'
|
61
|
+
# SDL_mixer
|
62
|
+
require_relative 'sdl3_mixer.rb'
|
63
|
+
# SDL_ttf
|
64
|
+
require_relative 'sdl3_ttf.rb'
|
65
|
+
# SDL_sound
|
66
|
+
require_relative 'sdl3_sound.rb'
|
67
|
+
|
68
|
+
module SDL
|
69
|
+
extend FFI::Library
|
70
|
+
|
71
|
+
@@sdl3_import_done = false
|
72
|
+
def self.load_lib(libpath, output_error: false, image_libpath: nil, ttf_libpath: nil, mixer_libpath: nil, sound_libpath: nil)
|
73
|
+
|
74
|
+
unless @@sdl3_import_done
|
75
|
+
# Ref.: Using Multiple and Alternate Libraries
|
76
|
+
# https://github.com/ffi/ffi/wiki/Using-Multiple-and-Alternate-Libraries
|
77
|
+
begin
|
78
|
+
lib_paths = [libpath, image_libpath, ttf_libpath, mixer_libpath, sound_libpath].compact
|
79
|
+
|
80
|
+
ffi_lib_flags :now, :global
|
81
|
+
ffi_lib *lib_paths
|
82
|
+
setup_symbols(output_error)
|
83
|
+
|
84
|
+
setup_image_symbols(output_error) if image_libpath
|
85
|
+
setup_ttf_symbols(output_error) if ttf_libpath
|
86
|
+
setup_mixer_symbols(output_error) if mixer_libpath
|
87
|
+
setup_sound_symbols(output_error) if sound_libpath
|
88
|
+
rescue => error
|
89
|
+
$stderr.puts("[Warning] Failed to load libraries (#{error}).") if output_error
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.setup_symbols(output_error = false)
|
96
|
+
setup_assert_symbols(output_error)
|
97
|
+
setup_asyncio_symbols(output_error)
|
98
|
+
setup_atomic_symbols(output_error)
|
99
|
+
setup_audio_symbols(output_error)
|
100
|
+
setup_bits_symbols(output_error)
|
101
|
+
setup_blendmode_symbols(output_error)
|
102
|
+
setup_camera_symbols(output_error)
|
103
|
+
setup_clipboard_symbols(output_error)
|
104
|
+
setup_cpuinfo_symbols(output_error)
|
105
|
+
setup_dialog_symbols(output_error)
|
106
|
+
setup_endian_symbols(output_error)
|
107
|
+
setup_error_symbols(output_error)
|
108
|
+
setup_events_symbols(output_error)
|
109
|
+
setup_filesystem_symbols(output_error)
|
110
|
+
setup_gamepad_symbols(output_error)
|
111
|
+
setup_gpu_symbols(output_error)
|
112
|
+
setup_guid_symbols(output_error)
|
113
|
+
setup_haptic_symbols(output_error)
|
114
|
+
setup_hints_symbols(output_error)
|
115
|
+
setup_init_symbols(output_error)
|
116
|
+
setup_iostream_symbols(output_error)
|
117
|
+
setup_joystick_symbols(output_error)
|
118
|
+
setup_keyboard_symbols(output_error)
|
119
|
+
setup_keycode_symbols(output_error)
|
120
|
+
setup_loadso_symbols(output_error)
|
121
|
+
setup_log_symbols(output_error)
|
122
|
+
setup_messagebox_symbols(output_error)
|
123
|
+
setup_misc_symbols(output_error)
|
124
|
+
setup_mouse_symbols(output_error)
|
125
|
+
setup_mutex_symbols(output_error)
|
126
|
+
setup_pen_symbols(output_error)
|
127
|
+
setup_pixels_symbols(output_error)
|
128
|
+
setup_platform_symbols(output_error)
|
129
|
+
setup_power_symbols(output_error)
|
130
|
+
setup_process_symbols(output_error)
|
131
|
+
setup_properties_symbols(output_error)
|
132
|
+
setup_rect_symbols(output_error)
|
133
|
+
setup_render_symbols(output_error)
|
134
|
+
setup_revision_symbols(output_error)
|
135
|
+
setup_scancode_symbols(output_error)
|
136
|
+
setup_sensor_symbols(output_error)
|
137
|
+
setup_stdinc_symbols(output_error)
|
138
|
+
setup_storage_symbols(output_error)
|
139
|
+
setup_surface_symbols(output_error)
|
140
|
+
setup_thread_symbols(output_error)
|
141
|
+
setup_time_symbols(output_error)
|
142
|
+
setup_timer_symbols(output_error)
|
143
|
+
setup_touch_symbols(output_error)
|
144
|
+
setup_tray_symbols(output_error)
|
145
|
+
setup_version_symbols(output_error)
|
146
|
+
setup_video_symbols(output_error)
|
147
|
+
setup_vulkan_symbols(output_error)
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
data/lib/sdl3_assert.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Ruby-SDL3 : SDL3 wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/sdl3-bindings
|
4
|
+
#
|
5
|
+
# [NOTICE] Autogenerated. Do not edit.
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
|
9
|
+
module SDL
|
10
|
+
extend FFI::Library
|
11
|
+
# Define/Macro
|
12
|
+
|
13
|
+
|
14
|
+
# Enum
|
15
|
+
|
16
|
+
ASSERTION_RETRY = 0
|
17
|
+
ASSERTION_BREAK = 1
|
18
|
+
ASSERTION_ABORT = 2
|
19
|
+
ASSERTION_IGNORE = 3
|
20
|
+
ASSERTION_ALWAYS_IGNORE = 4
|
21
|
+
|
22
|
+
# Typedef
|
23
|
+
|
24
|
+
typedef :int, :SDL_AssertState
|
25
|
+
callback :SDL_AssertionHandler, [:pointer, :pointer], :int
|
26
|
+
|
27
|
+
# Struct
|
28
|
+
|
29
|
+
class AssertData < FFI::Struct
|
30
|
+
layout(
|
31
|
+
:always_ignore, :bool,
|
32
|
+
:trigger_count, :uint,
|
33
|
+
:condition, :pointer,
|
34
|
+
:filename, :pointer,
|
35
|
+
:linenum, :int,
|
36
|
+
:function, :pointer,
|
37
|
+
:next, :pointer,
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
# Function
|
43
|
+
|
44
|
+
def self.setup_assert_symbols(output_error = false)
|
45
|
+
entries = [
|
46
|
+
[:ReportAssertion, :SDL_ReportAssertion, [:pointer, :pointer, :pointer, :int], :int],
|
47
|
+
[:SetAssertionHandler, :SDL_SetAssertionHandler, [:SDL_AssertionHandler, :pointer], :void],
|
48
|
+
[:GetDefaultAssertionHandler, :SDL_GetDefaultAssertionHandler, [], :pointer],
|
49
|
+
[:GetAssertionHandler, :SDL_GetAssertionHandler, [:pointer], :pointer],
|
50
|
+
[:GetAssertionReport, :SDL_GetAssertionReport, [], :pointer],
|
51
|
+
[:ResetAssertionReport, :SDL_ResetAssertionReport, [], :void],
|
52
|
+
]
|
53
|
+
entries.each do |entry|
|
54
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
55
|
+
rescue FFI::NotFoundError => e
|
56
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
data/lib/sdl3_asyncio.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Ruby-SDL3 : SDL3 wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/sdl3-bindings
|
4
|
+
#
|
5
|
+
# [NOTICE] Autogenerated. Do not edit.
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
|
9
|
+
module SDL
|
10
|
+
extend FFI::Library
|
11
|
+
# Define/Macro
|
12
|
+
|
13
|
+
|
14
|
+
# Enum
|
15
|
+
|
16
|
+
ASYNCIO_TASK_READ = 0
|
17
|
+
ASYNCIO_TASK_WRITE = 1
|
18
|
+
ASYNCIO_TASK_CLOSE = 2
|
19
|
+
ASYNCIO_COMPLETE = 0
|
20
|
+
ASYNCIO_FAILURE = 1
|
21
|
+
ASYNCIO_CANCELED = 2
|
22
|
+
|
23
|
+
# Typedef
|
24
|
+
|
25
|
+
typedef :int, :SDL_AsyncIOTaskType
|
26
|
+
typedef :int, :SDL_AsyncIOResult
|
27
|
+
|
28
|
+
# Struct
|
29
|
+
|
30
|
+
class AsyncIOOutcome < FFI::Struct
|
31
|
+
layout(
|
32
|
+
:asyncio, :pointer,
|
33
|
+
:type, :int,
|
34
|
+
:result, :int,
|
35
|
+
:buffer, :pointer,
|
36
|
+
:offset, :ulong_long,
|
37
|
+
:bytes_requested, :ulong_long,
|
38
|
+
:bytes_transferred, :ulong_long,
|
39
|
+
:userdata, :pointer,
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
# Function
|
45
|
+
|
46
|
+
def self.setup_asyncio_symbols(output_error = false)
|
47
|
+
entries = [
|
48
|
+
[:AsyncIOFromFile, :SDL_AsyncIOFromFile, [:pointer, :pointer], :pointer],
|
49
|
+
[:GetAsyncIOSize, :SDL_GetAsyncIOSize, [:pointer], :long_long],
|
50
|
+
[:ReadAsyncIO, :SDL_ReadAsyncIO, [:pointer, :pointer, :ulong_long, :ulong_long, :pointer, :pointer], :bool],
|
51
|
+
[:WriteAsyncIO, :SDL_WriteAsyncIO, [:pointer, :pointer, :ulong_long, :ulong_long, :pointer, :pointer], :bool],
|
52
|
+
[:CloseAsyncIO, :SDL_CloseAsyncIO, [:pointer, :bool, :pointer, :pointer], :bool],
|
53
|
+
[:CreateAsyncIOQueue, :SDL_CreateAsyncIOQueue, [], :pointer],
|
54
|
+
[:DestroyAsyncIOQueue, :SDL_DestroyAsyncIOQueue, [:pointer], :void],
|
55
|
+
[:GetAsyncIOResult, :SDL_GetAsyncIOResult, [:pointer, :pointer], :bool],
|
56
|
+
[:WaitAsyncIOResult, :SDL_WaitAsyncIOResult, [:pointer, :pointer, :int], :bool],
|
57
|
+
[:SignalAsyncIOQueue, :SDL_SignalAsyncIOQueue, [:pointer], :void],
|
58
|
+
[:LoadFileAsync, :SDL_LoadFileAsync, [:pointer, :pointer, :pointer], :bool],
|
59
|
+
]
|
60
|
+
entries.each do |entry|
|
61
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
62
|
+
rescue FFI::NotFoundError => e
|
63
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
data/lib/sdl3_atomic.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Ruby-SDL3 : SDL3 wrapper for Ruby
|
2
|
+
#
|
3
|
+
# * https://github.com/vaiorabbit/sdl3-bindings
|
4
|
+
#
|
5
|
+
# [NOTICE] Autogenerated. Do not edit.
|
6
|
+
|
7
|
+
require 'ffi'
|
8
|
+
|
9
|
+
module SDL
|
10
|
+
extend FFI::Library
|
11
|
+
# Define/Macro
|
12
|
+
|
13
|
+
|
14
|
+
# Enum
|
15
|
+
|
16
|
+
|
17
|
+
# Typedef
|
18
|
+
|
19
|
+
typedef :int, :SDL_SpinLock
|
20
|
+
|
21
|
+
# Struct
|
22
|
+
|
23
|
+
class AtomicInt < FFI::Struct
|
24
|
+
layout(
|
25
|
+
:value, :int,
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
class AtomicU32 < FFI::Struct
|
30
|
+
layout(
|
31
|
+
:value, :uint,
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
# Function
|
37
|
+
|
38
|
+
def self.setup_atomic_symbols(output_error = false)
|
39
|
+
entries = [
|
40
|
+
[:TryLockSpinlock, :SDL_TryLockSpinlock, [:pointer], :bool],
|
41
|
+
[:LockSpinlock, :SDL_LockSpinlock, [:pointer], :void],
|
42
|
+
[:UnlockSpinlock, :SDL_UnlockSpinlock, [:pointer], :void],
|
43
|
+
[:MemoryBarrierReleaseFunction, :SDL_MemoryBarrierReleaseFunction, [], :void],
|
44
|
+
[:MemoryBarrierAcquireFunction, :SDL_MemoryBarrierAcquireFunction, [], :void],
|
45
|
+
[:CompareAndSwapAtomicInt, :SDL_CompareAndSwapAtomicInt, [:pointer, :int, :int], :bool],
|
46
|
+
[:SetAtomicInt, :SDL_SetAtomicInt, [:pointer, :int], :int],
|
47
|
+
[:GetAtomicInt, :SDL_GetAtomicInt, [:pointer], :int],
|
48
|
+
[:AddAtomicInt, :SDL_AddAtomicInt, [:pointer, :int], :int],
|
49
|
+
[:CompareAndSwapAtomicU32, :SDL_CompareAndSwapAtomicU32, [:pointer, :uint, :uint], :bool],
|
50
|
+
[:SetAtomicU32, :SDL_SetAtomicU32, [:pointer, :uint], :uint],
|
51
|
+
[:GetAtomicU32, :SDL_GetAtomicU32, [:pointer], :uint],
|
52
|
+
[:CompareAndSwapAtomicPointer, :SDL_CompareAndSwapAtomicPointer, [:pointer, :pointer, :pointer], :bool],
|
53
|
+
[:SetAtomicPointer, :SDL_SetAtomicPointer, [:pointer, :pointer], :pointer],
|
54
|
+
[:GetAtomicPointer, :SDL_GetAtomicPointer, [:pointer], :pointer],
|
55
|
+
]
|
56
|
+
entries.each do |entry|
|
57
|
+
attach_function entry[0], entry[1], entry[2], entry[3]
|
58
|
+
rescue FFI::NotFoundError => e
|
59
|
+
warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|