sdl2-bindings 0.0.9 → 0.1.2

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 +129 -96
  3. data/LICENSE.txt +0 -0
  4. data/README.md +78 -55
  5. data/lib/sdl2.rb +131 -172
  6. data/lib/sdl2_audio.rb +261 -222
  7. data/lib/sdl2_blendmode.rb +72 -69
  8. data/lib/sdl2_clipboard.rb +56 -51
  9. data/lib/sdl2_cpuinfo.rb +129 -106
  10. data/lib/sdl2_error.rb +71 -64
  11. data/lib/sdl2_events.rb +564 -533
  12. data/lib/sdl2_filesystem.rb +52 -48
  13. data/lib/sdl2_framerate.rb +74 -67
  14. data/lib/sdl2_gamecontroller.rb +329 -274
  15. data/lib/sdl2_gesture.rb +61 -55
  16. data/lib/sdl2_gfxPrimitives.rb +283 -222
  17. data/lib/sdl2_haptic.rb +301 -269
  18. data/lib/sdl2_hidapi.rb +139 -118
  19. data/lib/sdl2_hints.rb +221 -198
  20. data/lib/sdl2_image.rb +232 -185
  21. data/lib/sdl2_imageFilter.rb +164 -132
  22. data/lib/sdl2_joystick.rb +294 -239
  23. data/lib/sdl2_keyboard.rb +125 -99
  24. data/lib/sdl2_keycode.rb +307 -305
  25. data/lib/sdl2_log.rb +131 -115
  26. data/lib/sdl2_main.rb +74 -67
  27. data/lib/sdl2_messagebox.rb +102 -98
  28. data/lib/sdl2_misc.rb +48 -45
  29. data/lib/sdl2_mixer.rb +392 -317
  30. data/lib/sdl2_mouse.rb +136 -117
  31. data/lib/sdl2_pixels.rb +240 -224
  32. data/lib/sdl2_platform.rb +48 -45
  33. data/lib/sdl2_power.rb +54 -51
  34. data/lib/sdl2_rect.rb +145 -102
  35. data/lib/sdl2_render.rb +408 -322
  36. data/lib/sdl2_rotozoom.rb +76 -66
  37. data/lib/sdl2_rwops.rb +242 -208
  38. data/lib/sdl2_scancode.rb +289 -287
  39. data/lib/sdl2_sensor.rb +115 -97
  40. data/lib/sdl2_shape.rb +83 -77
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +556 -439
  43. data/lib/sdl2_surface.rb +229 -188
  44. data/lib/sdl2_syswm.rb +160 -157
  45. data/lib/sdl2_timer.rb +74 -65
  46. data/lib/sdl2_touch.rb +86 -75
  47. data/lib/sdl2_ttf.rb +358 -202
  48. data/lib/sdl2_version.rb +67 -62
  49. data/lib/sdl2_video.rb +540 -446
  50. data/lib/sdl2_vulkan.rb +72 -64
  51. metadata +18 -3
data/lib/sdl2_image.rb CHANGED
@@ -1,185 +1,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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
- SDL_IMAGE_MAJOR_VERSION = 2
14
- SDL_IMAGE_MINOR_VERSION = 0
15
- SDL_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()
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
- args = {
82
- :IMG_Linked_Version => [],
83
- :IMG_Init => [:int],
84
- :IMG_Quit => [],
85
- :IMG_LoadTyped_RW => [:pointer, :int, :pointer],
86
- :IMG_Load => [:pointer],
87
- :IMG_Load_RW => [:pointer, :int],
88
- :IMG_LoadTexture => [:pointer, :pointer],
89
- :IMG_LoadTexture_RW => [:pointer, :pointer, :int],
90
- :IMG_LoadTextureTyped_RW => [:pointer, :pointer, :int, :pointer],
91
- :IMG_isICO => [:pointer],
92
- :IMG_isCUR => [:pointer],
93
- :IMG_isBMP => [:pointer],
94
- :IMG_isGIF => [:pointer],
95
- :IMG_isJPG => [:pointer],
96
- :IMG_isLBM => [:pointer],
97
- :IMG_isPCX => [:pointer],
98
- :IMG_isPNG => [:pointer],
99
- :IMG_isPNM => [:pointer],
100
- :IMG_isSVG => [:pointer],
101
- :IMG_isTIF => [:pointer],
102
- :IMG_isXCF => [:pointer],
103
- :IMG_isXPM => [:pointer],
104
- :IMG_isXV => [:pointer],
105
- :IMG_isWEBP => [:pointer],
106
- :IMG_LoadICO_RW => [:pointer],
107
- :IMG_LoadCUR_RW => [:pointer],
108
- :IMG_LoadBMP_RW => [:pointer],
109
- :IMG_LoadGIF_RW => [:pointer],
110
- :IMG_LoadJPG_RW => [:pointer],
111
- :IMG_LoadLBM_RW => [:pointer],
112
- :IMG_LoadPCX_RW => [:pointer],
113
- :IMG_LoadPNG_RW => [:pointer],
114
- :IMG_LoadPNM_RW => [:pointer],
115
- :IMG_LoadSVG_RW => [:pointer],
116
- :IMG_LoadTGA_RW => [:pointer],
117
- :IMG_LoadTIF_RW => [:pointer],
118
- :IMG_LoadXCF_RW => [:pointer],
119
- :IMG_LoadXPM_RW => [:pointer],
120
- :IMG_LoadXV_RW => [:pointer],
121
- :IMG_LoadWEBP_RW => [:pointer],
122
- :IMG_ReadXPMFromArray => [:pointer],
123
- :IMG_SavePNG => [:pointer, :pointer],
124
- :IMG_SavePNG_RW => [:pointer, :pointer, :int],
125
- :IMG_SaveJPG => [:pointer, :pointer, :int],
126
- :IMG_SaveJPG_RW => [:pointer, :pointer, :int, :int],
127
- }
128
- retvals = {
129
- :IMG_Linked_Version => :pointer,
130
- :IMG_Init => :int,
131
- :IMG_Quit => :void,
132
- :IMG_LoadTyped_RW => :pointer,
133
- :IMG_Load => :pointer,
134
- :IMG_Load_RW => :pointer,
135
- :IMG_LoadTexture => :pointer,
136
- :IMG_LoadTexture_RW => :pointer,
137
- :IMG_LoadTextureTyped_RW => :pointer,
138
- :IMG_isICO => :int,
139
- :IMG_isCUR => :int,
140
- :IMG_isBMP => :int,
141
- :IMG_isGIF => :int,
142
- :IMG_isJPG => :int,
143
- :IMG_isLBM => :int,
144
- :IMG_isPCX => :int,
145
- :IMG_isPNG => :int,
146
- :IMG_isPNM => :int,
147
- :IMG_isSVG => :int,
148
- :IMG_isTIF => :int,
149
- :IMG_isXCF => :int,
150
- :IMG_isXPM => :int,
151
- :IMG_isXV => :int,
152
- :IMG_isWEBP => :int,
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 => :int,
171
- :IMG_SavePNG_RW => :int,
172
- :IMG_SaveJPG => :int,
173
- :IMG_SaveJPG_RW => :int,
174
- }
175
- symbols.each do |sym|
176
- begin
177
- attach_function sym, args[sym], retvals[sym]
178
- rescue FFI::NotFoundError => error
179
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
180
- end
181
- end
182
- end
183
-
184
- end
185
-
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
+