sdl2-bindings 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +134 -108
  3. data/LICENSE.txt +0 -0
  4. data/README.md +86 -68
  5. data/lib/sdl2.rb +131 -127
  6. data/lib/sdl2_audio.rb +261 -261
  7. data/lib/sdl2_blendmode.rb +72 -72
  8. data/lib/sdl2_clipboard.rb +56 -56
  9. data/lib/sdl2_cpuinfo.rb +129 -129
  10. data/lib/sdl2_error.rb +71 -71
  11. data/lib/sdl2_events.rb +564 -552
  12. data/lib/sdl2_filesystem.rb +52 -52
  13. data/lib/sdl2_framerate.rb +74 -74
  14. data/lib/sdl2_gamecontroller.rb +329 -329
  15. data/lib/sdl2_gesture.rb +61 -61
  16. data/lib/sdl2_gfxPrimitives.rb +283 -283
  17. data/lib/sdl2_haptic.rb +301 -301
  18. data/lib/sdl2_hidapi.rb +139 -139
  19. data/lib/sdl2_hints.rb +221 -207
  20. data/lib/sdl2_image.rb +296 -232
  21. data/lib/sdl2_imageFilter.rb +164 -164
  22. data/lib/sdl2_joystick.rb +294 -294
  23. data/lib/sdl2_keyboard.rb +125 -117
  24. data/lib/sdl2_keycode.rb +307 -307
  25. data/lib/sdl2_log.rb +131 -131
  26. data/lib/sdl2_main.rb +74 -74
  27. data/lib/sdl2_messagebox.rb +102 -102
  28. data/lib/sdl2_misc.rb +48 -48
  29. data/lib/sdl2_mixer.rb +464 -392
  30. data/lib/sdl2_mouse.rb +136 -136
  31. data/lib/sdl2_pixels.rb +240 -240
  32. data/lib/sdl2_platform.rb +48 -48
  33. data/lib/sdl2_power.rb +54 -54
  34. data/lib/sdl2_rect.rb +145 -109
  35. data/lib/sdl2_render.rb +408 -404
  36. data/lib/sdl2_rotozoom.rb +76 -76
  37. data/lib/sdl2_rwops.rb +242 -238
  38. data/lib/sdl2_scancode.rb +289 -289
  39. data/lib/sdl2_sensor.rb +115 -115
  40. data/lib/sdl2_shape.rb +83 -83
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +548 -564
  43. data/lib/sdl2_surface.rb +229 -229
  44. data/lib/sdl2_syswm.rb +160 -160
  45. data/lib/sdl2_timer.rb +74 -74
  46. data/lib/sdl2_touch.rb +86 -82
  47. data/lib/sdl2_ttf.rb +414 -357
  48. data/lib/sdl2_version.rb +67 -67
  49. data/lib/sdl2_video.rb +540 -540
  50. data/lib/sdl2_vulkan.rb +72 -72
  51. metadata +3 -2
data/lib/sdl2_image.rb CHANGED
@@ -1,232 +1,296 @@
1
- # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/sdl2-bindings
4
- #
5
- # [NOTICE] This is an automatically generated file.
6
-
7
- require 'ffi'
8
-
9
- module SDL
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
- IMAGE_MAJOR_VERSION = 2
14
- IMAGE_MINOR_VERSION = 0
15
- IMAGE_PATCHLEVEL = 5
16
-
17
- # Enum
18
-
19
- IMG_INIT_JPG = 1
20
- IMG_INIT_PNG = 2
21
- IMG_INIT_TIF = 4
22
- IMG_INIT_WEBP = 8
23
-
24
- # Typedef
25
-
26
- typedef :int, :IMG_InitFlags
27
-
28
- # Struct
29
-
30
-
31
- # Function
32
-
33
- def self.setup_image_symbols(output_error = false)
34
- symbols = [
35
- :IMG_Linked_Version,
36
- :IMG_Init,
37
- :IMG_Quit,
38
- :IMG_LoadTyped_RW,
39
- :IMG_Load,
40
- :IMG_Load_RW,
41
- :IMG_LoadTexture,
42
- :IMG_LoadTexture_RW,
43
- :IMG_LoadTextureTyped_RW,
44
- :IMG_isICO,
45
- :IMG_isCUR,
46
- :IMG_isBMP,
47
- :IMG_isGIF,
48
- :IMG_isJPG,
49
- :IMG_isLBM,
50
- :IMG_isPCX,
51
- :IMG_isPNG,
52
- :IMG_isPNM,
53
- :IMG_isSVG,
54
- :IMG_isTIF,
55
- :IMG_isXCF,
56
- :IMG_isXPM,
57
- :IMG_isXV,
58
- :IMG_isWEBP,
59
- :IMG_LoadICO_RW,
60
- :IMG_LoadCUR_RW,
61
- :IMG_LoadBMP_RW,
62
- :IMG_LoadGIF_RW,
63
- :IMG_LoadJPG_RW,
64
- :IMG_LoadLBM_RW,
65
- :IMG_LoadPCX_RW,
66
- :IMG_LoadPNG_RW,
67
- :IMG_LoadPNM_RW,
68
- :IMG_LoadSVG_RW,
69
- :IMG_LoadTGA_RW,
70
- :IMG_LoadTIF_RW,
71
- :IMG_LoadXCF_RW,
72
- :IMG_LoadXPM_RW,
73
- :IMG_LoadXV_RW,
74
- :IMG_LoadWEBP_RW,
75
- :IMG_ReadXPMFromArray,
76
- :IMG_SavePNG,
77
- :IMG_SavePNG_RW,
78
- :IMG_SaveJPG,
79
- :IMG_SaveJPG_RW,
80
- ]
81
- apis = {
82
- :IMG_Linked_Version => :IMG_Linked_Version,
83
- :IMG_Init => :IMG_Init,
84
- :IMG_Quit => :IMG_Quit,
85
- :IMG_LoadTyped_RW => :IMG_LoadTyped_RW,
86
- :IMG_Load => :IMG_Load,
87
- :IMG_Load_RW => :IMG_Load_RW,
88
- :IMG_LoadTexture => :IMG_LoadTexture,
89
- :IMG_LoadTexture_RW => :IMG_LoadTexture_RW,
90
- :IMG_LoadTextureTyped_RW => :IMG_LoadTextureTyped_RW,
91
- :IMG_isICO => :IMG_isICO,
92
- :IMG_isCUR => :IMG_isCUR,
93
- :IMG_isBMP => :IMG_isBMP,
94
- :IMG_isGIF => :IMG_isGIF,
95
- :IMG_isJPG => :IMG_isJPG,
96
- :IMG_isLBM => :IMG_isLBM,
97
- :IMG_isPCX => :IMG_isPCX,
98
- :IMG_isPNG => :IMG_isPNG,
99
- :IMG_isPNM => :IMG_isPNM,
100
- :IMG_isSVG => :IMG_isSVG,
101
- :IMG_isTIF => :IMG_isTIF,
102
- :IMG_isXCF => :IMG_isXCF,
103
- :IMG_isXPM => :IMG_isXPM,
104
- :IMG_isXV => :IMG_isXV,
105
- :IMG_isWEBP => :IMG_isWEBP,
106
- :IMG_LoadICO_RW => :IMG_LoadICO_RW,
107
- :IMG_LoadCUR_RW => :IMG_LoadCUR_RW,
108
- :IMG_LoadBMP_RW => :IMG_LoadBMP_RW,
109
- :IMG_LoadGIF_RW => :IMG_LoadGIF_RW,
110
- :IMG_LoadJPG_RW => :IMG_LoadJPG_RW,
111
- :IMG_LoadLBM_RW => :IMG_LoadLBM_RW,
112
- :IMG_LoadPCX_RW => :IMG_LoadPCX_RW,
113
- :IMG_LoadPNG_RW => :IMG_LoadPNG_RW,
114
- :IMG_LoadPNM_RW => :IMG_LoadPNM_RW,
115
- :IMG_LoadSVG_RW => :IMG_LoadSVG_RW,
116
- :IMG_LoadTGA_RW => :IMG_LoadTGA_RW,
117
- :IMG_LoadTIF_RW => :IMG_LoadTIF_RW,
118
- :IMG_LoadXCF_RW => :IMG_LoadXCF_RW,
119
- :IMG_LoadXPM_RW => :IMG_LoadXPM_RW,
120
- :IMG_LoadXV_RW => :IMG_LoadXV_RW,
121
- :IMG_LoadWEBP_RW => :IMG_LoadWEBP_RW,
122
- :IMG_ReadXPMFromArray => :IMG_ReadXPMFromArray,
123
- :IMG_SavePNG => :IMG_SavePNG,
124
- :IMG_SavePNG_RW => :IMG_SavePNG_RW,
125
- :IMG_SaveJPG => :IMG_SaveJPG,
126
- :IMG_SaveJPG_RW => :IMG_SaveJPG_RW,
127
- }
128
- args = {
129
- :IMG_Linked_Version => [],
130
- :IMG_Init => [:int],
131
- :IMG_Quit => [],
132
- :IMG_LoadTyped_RW => [:pointer, :int, :pointer],
133
- :IMG_Load => [:pointer],
134
- :IMG_Load_RW => [:pointer, :int],
135
- :IMG_LoadTexture => [:pointer, :pointer],
136
- :IMG_LoadTexture_RW => [:pointer, :pointer, :int],
137
- :IMG_LoadTextureTyped_RW => [:pointer, :pointer, :int, :pointer],
138
- :IMG_isICO => [:pointer],
139
- :IMG_isCUR => [:pointer],
140
- :IMG_isBMP => [:pointer],
141
- :IMG_isGIF => [:pointer],
142
- :IMG_isJPG => [:pointer],
143
- :IMG_isLBM => [:pointer],
144
- :IMG_isPCX => [:pointer],
145
- :IMG_isPNG => [:pointer],
146
- :IMG_isPNM => [:pointer],
147
- :IMG_isSVG => [:pointer],
148
- :IMG_isTIF => [:pointer],
149
- :IMG_isXCF => [:pointer],
150
- :IMG_isXPM => [:pointer],
151
- :IMG_isXV => [:pointer],
152
- :IMG_isWEBP => [:pointer],
153
- :IMG_LoadICO_RW => [:pointer],
154
- :IMG_LoadCUR_RW => [:pointer],
155
- :IMG_LoadBMP_RW => [:pointer],
156
- :IMG_LoadGIF_RW => [:pointer],
157
- :IMG_LoadJPG_RW => [:pointer],
158
- :IMG_LoadLBM_RW => [:pointer],
159
- :IMG_LoadPCX_RW => [:pointer],
160
- :IMG_LoadPNG_RW => [:pointer],
161
- :IMG_LoadPNM_RW => [:pointer],
162
- :IMG_LoadSVG_RW => [:pointer],
163
- :IMG_LoadTGA_RW => [:pointer],
164
- :IMG_LoadTIF_RW => [:pointer],
165
- :IMG_LoadXCF_RW => [:pointer],
166
- :IMG_LoadXPM_RW => [:pointer],
167
- :IMG_LoadXV_RW => [:pointer],
168
- :IMG_LoadWEBP_RW => [:pointer],
169
- :IMG_ReadXPMFromArray => [:pointer],
170
- :IMG_SavePNG => [:pointer, :pointer],
171
- :IMG_SavePNG_RW => [:pointer, :pointer, :int],
172
- :IMG_SaveJPG => [:pointer, :pointer, :int],
173
- :IMG_SaveJPG_RW => [:pointer, :pointer, :int, :int],
174
- }
175
- retvals = {
176
- :IMG_Linked_Version => :pointer,
177
- :IMG_Init => :int,
178
- :IMG_Quit => :void,
179
- :IMG_LoadTyped_RW => :pointer,
180
- :IMG_Load => :pointer,
181
- :IMG_Load_RW => :pointer,
182
- :IMG_LoadTexture => :pointer,
183
- :IMG_LoadTexture_RW => :pointer,
184
- :IMG_LoadTextureTyped_RW => :pointer,
185
- :IMG_isICO => :int,
186
- :IMG_isCUR => :int,
187
- :IMG_isBMP => :int,
188
- :IMG_isGIF => :int,
189
- :IMG_isJPG => :int,
190
- :IMG_isLBM => :int,
191
- :IMG_isPCX => :int,
192
- :IMG_isPNG => :int,
193
- :IMG_isPNM => :int,
194
- :IMG_isSVG => :int,
195
- :IMG_isTIF => :int,
196
- :IMG_isXCF => :int,
197
- :IMG_isXPM => :int,
198
- :IMG_isXV => :int,
199
- :IMG_isWEBP => :int,
200
- :IMG_LoadICO_RW => :pointer,
201
- :IMG_LoadCUR_RW => :pointer,
202
- :IMG_LoadBMP_RW => :pointer,
203
- :IMG_LoadGIF_RW => :pointer,
204
- :IMG_LoadJPG_RW => :pointer,
205
- :IMG_LoadLBM_RW => :pointer,
206
- :IMG_LoadPCX_RW => :pointer,
207
- :IMG_LoadPNG_RW => :pointer,
208
- :IMG_LoadPNM_RW => :pointer,
209
- :IMG_LoadSVG_RW => :pointer,
210
- :IMG_LoadTGA_RW => :pointer,
211
- :IMG_LoadTIF_RW => :pointer,
212
- :IMG_LoadXCF_RW => :pointer,
213
- :IMG_LoadXPM_RW => :pointer,
214
- :IMG_LoadXV_RW => :pointer,
215
- :IMG_LoadWEBP_RW => :pointer,
216
- :IMG_ReadXPMFromArray => :pointer,
217
- :IMG_SavePNG => :int,
218
- :IMG_SavePNG_RW => :int,
219
- :IMG_SaveJPG => :int,
220
- :IMG_SaveJPG_RW => :int,
221
- }
222
- symbols.each do |sym|
223
- begin
224
- attach_function apis[sym], sym, args[sym], retvals[sym]
225
- rescue FFI::NotFoundError => error
226
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
227
- end
228
- end
229
- end
230
-
231
- end
232
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ IMAGE_MAJOR_VERSION = 2
14
+ IMAGE_MINOR_VERSION = 6
15
+ IMAGE_PATCHLEVEL = 0
16
+
17
+ # Enum
18
+
19
+ IMG_INIT_JPG = 1
20
+ IMG_INIT_PNG = 2
21
+ IMG_INIT_TIF = 4
22
+ IMG_INIT_WEBP = 8
23
+ IMG_INIT_JXL = 16
24
+ IMG_INIT_AVIF = 32
25
+
26
+ # Typedef
27
+
28
+ typedef :int, :IMG_InitFlags
29
+
30
+ # Struct
31
+
32
+ class IMG_Animation < FFI::Struct
33
+ layout(
34
+ :w, :int,
35
+ :h, :int,
36
+ :count, :int,
37
+ :frames, :pointer,
38
+ :delays, :pointer,
39
+ )
40
+ end
41
+
42
+
43
+ # Function
44
+
45
+ def self.setup_image_symbols(output_error = false)
46
+ symbols = [
47
+ :IMG_Linked_Version,
48
+ :IMG_Init,
49
+ :IMG_Quit,
50
+ :IMG_LoadTyped_RW,
51
+ :IMG_Load,
52
+ :IMG_Load_RW,
53
+ :IMG_LoadTexture,
54
+ :IMG_LoadTexture_RW,
55
+ :IMG_LoadTextureTyped_RW,
56
+ :IMG_isAVIF,
57
+ :IMG_isICO,
58
+ :IMG_isCUR,
59
+ :IMG_isBMP,
60
+ :IMG_isGIF,
61
+ :IMG_isJPG,
62
+ :IMG_isJXL,
63
+ :IMG_isLBM,
64
+ :IMG_isPCX,
65
+ :IMG_isPNG,
66
+ :IMG_isPNM,
67
+ :IMG_isSVG,
68
+ :IMG_isQOI,
69
+ :IMG_isTIF,
70
+ :IMG_isXCF,
71
+ :IMG_isXPM,
72
+ :IMG_isXV,
73
+ :IMG_isWEBP,
74
+ :IMG_LoadAVIF_RW,
75
+ :IMG_LoadICO_RW,
76
+ :IMG_LoadCUR_RW,
77
+ :IMG_LoadBMP_RW,
78
+ :IMG_LoadGIF_RW,
79
+ :IMG_LoadJPG_RW,
80
+ :IMG_LoadJXL_RW,
81
+ :IMG_LoadLBM_RW,
82
+ :IMG_LoadPCX_RW,
83
+ :IMG_LoadPNG_RW,
84
+ :IMG_LoadPNM_RW,
85
+ :IMG_LoadSVG_RW,
86
+ :IMG_LoadQOI_RW,
87
+ :IMG_LoadTGA_RW,
88
+ :IMG_LoadTIF_RW,
89
+ :IMG_LoadXCF_RW,
90
+ :IMG_LoadXPM_RW,
91
+ :IMG_LoadXV_RW,
92
+ :IMG_LoadWEBP_RW,
93
+ :IMG_LoadSizedSVG_RW,
94
+ :IMG_ReadXPMFromArray,
95
+ :IMG_ReadXPMFromArrayToRGB888,
96
+ :IMG_SavePNG,
97
+ :IMG_SavePNG_RW,
98
+ :IMG_SaveJPG,
99
+ :IMG_SaveJPG_RW,
100
+ :IMG_LoadAnimation,
101
+ :IMG_LoadAnimation_RW,
102
+ :IMG_LoadAnimationTyped_RW,
103
+ :IMG_FreeAnimation,
104
+ :IMG_LoadGIFAnimation_RW,
105
+ ]
106
+ apis = {
107
+ :IMG_Linked_Version => :IMG_Linked_Version,
108
+ :IMG_Init => :IMG_Init,
109
+ :IMG_Quit => :IMG_Quit,
110
+ :IMG_LoadTyped_RW => :IMG_LoadTyped_RW,
111
+ :IMG_Load => :IMG_Load,
112
+ :IMG_Load_RW => :IMG_Load_RW,
113
+ :IMG_LoadTexture => :IMG_LoadTexture,
114
+ :IMG_LoadTexture_RW => :IMG_LoadTexture_RW,
115
+ :IMG_LoadTextureTyped_RW => :IMG_LoadTextureTyped_RW,
116
+ :IMG_isAVIF => :IMG_isAVIF,
117
+ :IMG_isICO => :IMG_isICO,
118
+ :IMG_isCUR => :IMG_isCUR,
119
+ :IMG_isBMP => :IMG_isBMP,
120
+ :IMG_isGIF => :IMG_isGIF,
121
+ :IMG_isJPG => :IMG_isJPG,
122
+ :IMG_isJXL => :IMG_isJXL,
123
+ :IMG_isLBM => :IMG_isLBM,
124
+ :IMG_isPCX => :IMG_isPCX,
125
+ :IMG_isPNG => :IMG_isPNG,
126
+ :IMG_isPNM => :IMG_isPNM,
127
+ :IMG_isSVG => :IMG_isSVG,
128
+ :IMG_isQOI => :IMG_isQOI,
129
+ :IMG_isTIF => :IMG_isTIF,
130
+ :IMG_isXCF => :IMG_isXCF,
131
+ :IMG_isXPM => :IMG_isXPM,
132
+ :IMG_isXV => :IMG_isXV,
133
+ :IMG_isWEBP => :IMG_isWEBP,
134
+ :IMG_LoadAVIF_RW => :IMG_LoadAVIF_RW,
135
+ :IMG_LoadICO_RW => :IMG_LoadICO_RW,
136
+ :IMG_LoadCUR_RW => :IMG_LoadCUR_RW,
137
+ :IMG_LoadBMP_RW => :IMG_LoadBMP_RW,
138
+ :IMG_LoadGIF_RW => :IMG_LoadGIF_RW,
139
+ :IMG_LoadJPG_RW => :IMG_LoadJPG_RW,
140
+ :IMG_LoadJXL_RW => :IMG_LoadJXL_RW,
141
+ :IMG_LoadLBM_RW => :IMG_LoadLBM_RW,
142
+ :IMG_LoadPCX_RW => :IMG_LoadPCX_RW,
143
+ :IMG_LoadPNG_RW => :IMG_LoadPNG_RW,
144
+ :IMG_LoadPNM_RW => :IMG_LoadPNM_RW,
145
+ :IMG_LoadSVG_RW => :IMG_LoadSVG_RW,
146
+ :IMG_LoadQOI_RW => :IMG_LoadQOI_RW,
147
+ :IMG_LoadTGA_RW => :IMG_LoadTGA_RW,
148
+ :IMG_LoadTIF_RW => :IMG_LoadTIF_RW,
149
+ :IMG_LoadXCF_RW => :IMG_LoadXCF_RW,
150
+ :IMG_LoadXPM_RW => :IMG_LoadXPM_RW,
151
+ :IMG_LoadXV_RW => :IMG_LoadXV_RW,
152
+ :IMG_LoadWEBP_RW => :IMG_LoadWEBP_RW,
153
+ :IMG_LoadSizedSVG_RW => :IMG_LoadSizedSVG_RW,
154
+ :IMG_ReadXPMFromArray => :IMG_ReadXPMFromArray,
155
+ :IMG_ReadXPMFromArrayToRGB888 => :IMG_ReadXPMFromArrayToRGB888,
156
+ :IMG_SavePNG => :IMG_SavePNG,
157
+ :IMG_SavePNG_RW => :IMG_SavePNG_RW,
158
+ :IMG_SaveJPG => :IMG_SaveJPG,
159
+ :IMG_SaveJPG_RW => :IMG_SaveJPG_RW,
160
+ :IMG_LoadAnimation => :IMG_LoadAnimation,
161
+ :IMG_LoadAnimation_RW => :IMG_LoadAnimation_RW,
162
+ :IMG_LoadAnimationTyped_RW => :IMG_LoadAnimationTyped_RW,
163
+ :IMG_FreeAnimation => :IMG_FreeAnimation,
164
+ :IMG_LoadGIFAnimation_RW => :IMG_LoadGIFAnimation_RW,
165
+ }
166
+ args = {
167
+ :IMG_Linked_Version => [],
168
+ :IMG_Init => [:int],
169
+ :IMG_Quit => [],
170
+ :IMG_LoadTyped_RW => [:pointer, :int, :pointer],
171
+ :IMG_Load => [:pointer],
172
+ :IMG_Load_RW => [:pointer, :int],
173
+ :IMG_LoadTexture => [:pointer, :pointer],
174
+ :IMG_LoadTexture_RW => [:pointer, :pointer, :int],
175
+ :IMG_LoadTextureTyped_RW => [:pointer, :pointer, :int, :pointer],
176
+ :IMG_isAVIF => [:pointer],
177
+ :IMG_isICO => [:pointer],
178
+ :IMG_isCUR => [:pointer],
179
+ :IMG_isBMP => [:pointer],
180
+ :IMG_isGIF => [:pointer],
181
+ :IMG_isJPG => [:pointer],
182
+ :IMG_isJXL => [:pointer],
183
+ :IMG_isLBM => [:pointer],
184
+ :IMG_isPCX => [:pointer],
185
+ :IMG_isPNG => [:pointer],
186
+ :IMG_isPNM => [:pointer],
187
+ :IMG_isSVG => [:pointer],
188
+ :IMG_isQOI => [:pointer],
189
+ :IMG_isTIF => [:pointer],
190
+ :IMG_isXCF => [:pointer],
191
+ :IMG_isXPM => [:pointer],
192
+ :IMG_isXV => [:pointer],
193
+ :IMG_isWEBP => [:pointer],
194
+ :IMG_LoadAVIF_RW => [:pointer],
195
+ :IMG_LoadICO_RW => [:pointer],
196
+ :IMG_LoadCUR_RW => [:pointer],
197
+ :IMG_LoadBMP_RW => [:pointer],
198
+ :IMG_LoadGIF_RW => [:pointer],
199
+ :IMG_LoadJPG_RW => [:pointer],
200
+ :IMG_LoadJXL_RW => [:pointer],
201
+ :IMG_LoadLBM_RW => [:pointer],
202
+ :IMG_LoadPCX_RW => [:pointer],
203
+ :IMG_LoadPNG_RW => [:pointer],
204
+ :IMG_LoadPNM_RW => [:pointer],
205
+ :IMG_LoadSVG_RW => [:pointer],
206
+ :IMG_LoadQOI_RW => [:pointer],
207
+ :IMG_LoadTGA_RW => [:pointer],
208
+ :IMG_LoadTIF_RW => [:pointer],
209
+ :IMG_LoadXCF_RW => [:pointer],
210
+ :IMG_LoadXPM_RW => [:pointer],
211
+ :IMG_LoadXV_RW => [:pointer],
212
+ :IMG_LoadWEBP_RW => [:pointer],
213
+ :IMG_LoadSizedSVG_RW => [:pointer, :int, :int],
214
+ :IMG_ReadXPMFromArray => [:pointer],
215
+ :IMG_ReadXPMFromArrayToRGB888 => [:pointer],
216
+ :IMG_SavePNG => [:pointer, :pointer],
217
+ :IMG_SavePNG_RW => [:pointer, :pointer, :int],
218
+ :IMG_SaveJPG => [:pointer, :pointer, :int],
219
+ :IMG_SaveJPG_RW => [:pointer, :pointer, :int, :int],
220
+ :IMG_LoadAnimation => [:pointer],
221
+ :IMG_LoadAnimation_RW => [:pointer, :int],
222
+ :IMG_LoadAnimationTyped_RW => [:pointer, :int, :pointer],
223
+ :IMG_FreeAnimation => [:pointer],
224
+ :IMG_LoadGIFAnimation_RW => [:pointer],
225
+ }
226
+ retvals = {
227
+ :IMG_Linked_Version => :pointer,
228
+ :IMG_Init => :int,
229
+ :IMG_Quit => :void,
230
+ :IMG_LoadTyped_RW => :pointer,
231
+ :IMG_Load => :pointer,
232
+ :IMG_Load_RW => :pointer,
233
+ :IMG_LoadTexture => :pointer,
234
+ :IMG_LoadTexture_RW => :pointer,
235
+ :IMG_LoadTextureTyped_RW => :pointer,
236
+ :IMG_isAVIF => :int,
237
+ :IMG_isICO => :int,
238
+ :IMG_isCUR => :int,
239
+ :IMG_isBMP => :int,
240
+ :IMG_isGIF => :int,
241
+ :IMG_isJPG => :int,
242
+ :IMG_isJXL => :int,
243
+ :IMG_isLBM => :int,
244
+ :IMG_isPCX => :int,
245
+ :IMG_isPNG => :int,
246
+ :IMG_isPNM => :int,
247
+ :IMG_isSVG => :int,
248
+ :IMG_isQOI => :int,
249
+ :IMG_isTIF => :int,
250
+ :IMG_isXCF => :int,
251
+ :IMG_isXPM => :int,
252
+ :IMG_isXV => :int,
253
+ :IMG_isWEBP => :int,
254
+ :IMG_LoadAVIF_RW => :pointer,
255
+ :IMG_LoadICO_RW => :pointer,
256
+ :IMG_LoadCUR_RW => :pointer,
257
+ :IMG_LoadBMP_RW => :pointer,
258
+ :IMG_LoadGIF_RW => :pointer,
259
+ :IMG_LoadJPG_RW => :pointer,
260
+ :IMG_LoadJXL_RW => :pointer,
261
+ :IMG_LoadLBM_RW => :pointer,
262
+ :IMG_LoadPCX_RW => :pointer,
263
+ :IMG_LoadPNG_RW => :pointer,
264
+ :IMG_LoadPNM_RW => :pointer,
265
+ :IMG_LoadSVG_RW => :pointer,
266
+ :IMG_LoadQOI_RW => :pointer,
267
+ :IMG_LoadTGA_RW => :pointer,
268
+ :IMG_LoadTIF_RW => :pointer,
269
+ :IMG_LoadXCF_RW => :pointer,
270
+ :IMG_LoadXPM_RW => :pointer,
271
+ :IMG_LoadXV_RW => :pointer,
272
+ :IMG_LoadWEBP_RW => :pointer,
273
+ :IMG_LoadSizedSVG_RW => :pointer,
274
+ :IMG_ReadXPMFromArray => :pointer,
275
+ :IMG_ReadXPMFromArrayToRGB888 => :pointer,
276
+ :IMG_SavePNG => :int,
277
+ :IMG_SavePNG_RW => :int,
278
+ :IMG_SaveJPG => :int,
279
+ :IMG_SaveJPG_RW => :int,
280
+ :IMG_LoadAnimation => :pointer,
281
+ :IMG_LoadAnimation_RW => :pointer,
282
+ :IMG_LoadAnimationTyped_RW => :pointer,
283
+ :IMG_FreeAnimation => :void,
284
+ :IMG_LoadGIFAnimation_RW => :pointer,
285
+ }
286
+ symbols.each do |sym|
287
+ begin
288
+ attach_function apis[sym], sym, args[sym], retvals[sym]
289
+ rescue FFI::NotFoundError => error
290
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
291
+ end
292
+ end
293
+ end
294
+
295
+ end
296
+