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_pixels.rb CHANGED
@@ -1,224 +1,240 @@
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_ALPHA_OPAQUE = 255
14
- SDL_ALPHA_TRANSPARENT = 0
15
-
16
- # Enum
17
-
18
- SDL_PIXELTYPE_UNKNOWN = 0
19
- SDL_PIXELTYPE_INDEX1 = 1
20
- SDL_PIXELTYPE_INDEX4 = 2
21
- SDL_PIXELTYPE_INDEX8 = 3
22
- SDL_PIXELTYPE_PACKED8 = 4
23
- SDL_PIXELTYPE_PACKED16 = 5
24
- SDL_PIXELTYPE_PACKED32 = 6
25
- SDL_PIXELTYPE_ARRAYU8 = 7
26
- SDL_PIXELTYPE_ARRAYU16 = 8
27
- SDL_PIXELTYPE_ARRAYU32 = 9
28
- SDL_PIXELTYPE_ARRAYF16 = 10
29
- SDL_PIXELTYPE_ARRAYF32 = 11
30
- SDL_BITMAPORDER_NONE = 0
31
- SDL_BITMAPORDER_4321 = 1
32
- SDL_BITMAPORDER_1234 = 2
33
- SDL_PACKEDORDER_NONE = 0
34
- SDL_PACKEDORDER_XRGB = 1
35
- SDL_PACKEDORDER_RGBX = 2
36
- SDL_PACKEDORDER_ARGB = 3
37
- SDL_PACKEDORDER_RGBA = 4
38
- SDL_PACKEDORDER_XBGR = 5
39
- SDL_PACKEDORDER_BGRX = 6
40
- SDL_PACKEDORDER_ABGR = 7
41
- SDL_PACKEDORDER_BGRA = 8
42
- SDL_ARRAYORDER_NONE = 0
43
- SDL_ARRAYORDER_RGB = 1
44
- SDL_ARRAYORDER_RGBA = 2
45
- SDL_ARRAYORDER_ARGB = 3
46
- SDL_ARRAYORDER_BGR = 4
47
- SDL_ARRAYORDER_BGRA = 5
48
- SDL_ARRAYORDER_ABGR = 6
49
- SDL_PACKEDLAYOUT_NONE = 0
50
- SDL_PACKEDLAYOUT_332 = 1
51
- SDL_PACKEDLAYOUT_4444 = 2
52
- SDL_PACKEDLAYOUT_1555 = 3
53
- SDL_PACKEDLAYOUT_5551 = 4
54
- SDL_PACKEDLAYOUT_565 = 5
55
- SDL_PACKEDLAYOUT_8888 = 6
56
- SDL_PACKEDLAYOUT_2101010 = 7
57
- SDL_PACKEDLAYOUT_1010102 = 8
58
- SDL_PIXELFORMAT_UNKNOWN = 0
59
- SDL_PIXELFORMAT_INDEX1LSB = 286261504
60
- SDL_PIXELFORMAT_INDEX1MSB = 287310080
61
- SDL_PIXELFORMAT_INDEX4LSB = 303039488
62
- SDL_PIXELFORMAT_INDEX4MSB = 304088064
63
- SDL_PIXELFORMAT_INDEX8 = 318769153
64
- SDL_PIXELFORMAT_RGB332 = 336660481
65
- SDL_PIXELFORMAT_XRGB4444 = 353504258
66
- SDL_PIXELFORMAT_RGB444 = 353504258
67
- SDL_PIXELFORMAT_XBGR4444 = 357698562
68
- SDL_PIXELFORMAT_BGR444 = 357698562
69
- SDL_PIXELFORMAT_XRGB1555 = 353570562
70
- SDL_PIXELFORMAT_RGB555 = 353570562
71
- SDL_PIXELFORMAT_XBGR1555 = 357764866
72
- SDL_PIXELFORMAT_BGR555 = 357764866
73
- SDL_PIXELFORMAT_ARGB4444 = 355602434
74
- SDL_PIXELFORMAT_RGBA4444 = 356651010
75
- SDL_PIXELFORMAT_ABGR4444 = 359796738
76
- SDL_PIXELFORMAT_BGRA4444 = 360845314
77
- SDL_PIXELFORMAT_ARGB1555 = 355667970
78
- SDL_PIXELFORMAT_RGBA5551 = 356782082
79
- SDL_PIXELFORMAT_ABGR1555 = 359862274
80
- SDL_PIXELFORMAT_BGRA5551 = 360976386
81
- SDL_PIXELFORMAT_RGB565 = 353701890
82
- SDL_PIXELFORMAT_BGR565 = 357896194
83
- SDL_PIXELFORMAT_RGB24 = 386930691
84
- SDL_PIXELFORMAT_BGR24 = 390076419
85
- SDL_PIXELFORMAT_XRGB8888 = 370546692
86
- SDL_PIXELFORMAT_RGB888 = 370546692
87
- SDL_PIXELFORMAT_RGBX8888 = 371595268
88
- SDL_PIXELFORMAT_XBGR8888 = 374740996
89
- SDL_PIXELFORMAT_BGR888 = 374740996
90
- SDL_PIXELFORMAT_BGRX8888 = 375789572
91
- SDL_PIXELFORMAT_ARGB8888 = 372645892
92
- SDL_PIXELFORMAT_RGBA8888 = 373694468
93
- SDL_PIXELFORMAT_ABGR8888 = 376840196
94
- SDL_PIXELFORMAT_BGRA8888 = 377888772
95
- SDL_PIXELFORMAT_ARGB2101010 = 372711428
96
- SDL_PIXELFORMAT_RGBA32 = 376840196
97
- SDL_PIXELFORMAT_ARGB32 = 377888772
98
- SDL_PIXELFORMAT_BGRA32 = 372645892
99
- SDL_PIXELFORMAT_ABGR32 = 373694468
100
- SDL_PIXELFORMAT_YV12 = 842094169
101
- SDL_PIXELFORMAT_IYUV = 1448433993
102
- SDL_PIXELFORMAT_YUY2 = 844715353
103
- SDL_PIXELFORMAT_UYVY = 1498831189
104
- SDL_PIXELFORMAT_YVYU = 1431918169
105
- SDL_PIXELFORMAT_NV12 = 842094158
106
- SDL_PIXELFORMAT_NV21 = 825382478
107
- SDL_PIXELFORMAT_EXTERNAL_OES = 542328143
108
-
109
- # Typedef
110
-
111
- typedef :int, :SDL_PixelType
112
- typedef :int, :SDL_BitmapOrder
113
- typedef :int, :SDL_PackedOrder
114
- typedef :int, :SDL_ArrayOrder
115
- typedef :int, :SDL_PackedLayout
116
- typedef :int, :SDL_PixelFormatEnum
117
-
118
- # Struct
119
-
120
- class SDL_Color < FFI::Struct
121
- layout(
122
- :r, :uchar,
123
- :g, :uchar,
124
- :b, :uchar,
125
- :a, :uchar,
126
- )
127
- end
128
-
129
- class SDL_Palette < FFI::Struct
130
- layout(
131
- :ncolors, :int,
132
- :colors, :pointer,
133
- :version, :uint,
134
- :refcount, :int,
135
- )
136
- end
137
-
138
- class SDL_PixelFormat < FFI::Struct
139
- layout(
140
- :format, :uint,
141
- :palette, :pointer,
142
- :BitsPerPixel, :uchar,
143
- :BytesPerPixel, :uchar,
144
- :padding, [:uchar, 2],
145
- :Rmask, :uint,
146
- :Gmask, :uint,
147
- :Bmask, :uint,
148
- :Amask, :uint,
149
- :Rloss, :uchar,
150
- :Gloss, :uchar,
151
- :Bloss, :uchar,
152
- :Aloss, :uchar,
153
- :Rshift, :uchar,
154
- :Gshift, :uchar,
155
- :Bshift, :uchar,
156
- :Ashift, :uchar,
157
- :refcount, :int,
158
- :next, :pointer,
159
- )
160
- end
161
-
162
-
163
- # Function
164
-
165
- def self.setup_pixels_symbols()
166
- symbols = [
167
- :SDL_GetPixelFormatName,
168
- :SDL_PixelFormatEnumToMasks,
169
- :SDL_MasksToPixelFormatEnum,
170
- :SDL_AllocFormat,
171
- :SDL_FreeFormat,
172
- :SDL_AllocPalette,
173
- :SDL_SetPixelFormatPalette,
174
- :SDL_SetPaletteColors,
175
- :SDL_FreePalette,
176
- :SDL_MapRGB,
177
- :SDL_MapRGBA,
178
- :SDL_GetRGB,
179
- :SDL_GetRGBA,
180
- :SDL_CalculateGammaRamp,
181
- ]
182
- args = {
183
- :SDL_GetPixelFormatName => [:uint],
184
- :SDL_PixelFormatEnumToMasks => [:uint, :pointer, :pointer, :pointer, :pointer, :pointer],
185
- :SDL_MasksToPixelFormatEnum => [:int, :uint, :uint, :uint, :uint],
186
- :SDL_AllocFormat => [:uint],
187
- :SDL_FreeFormat => [:pointer],
188
- :SDL_AllocPalette => [:int],
189
- :SDL_SetPixelFormatPalette => [:pointer, :pointer],
190
- :SDL_SetPaletteColors => [:pointer, :pointer, :int, :int],
191
- :SDL_FreePalette => [:pointer],
192
- :SDL_MapRGB => [:pointer, :uchar, :uchar, :uchar],
193
- :SDL_MapRGBA => [:pointer, :uchar, :uchar, :uchar, :uchar],
194
- :SDL_GetRGB => [:uint, :pointer, :pointer, :pointer, :pointer],
195
- :SDL_GetRGBA => [:uint, :pointer, :pointer, :pointer, :pointer, :pointer],
196
- :SDL_CalculateGammaRamp => [:float, :pointer],
197
- }
198
- retvals = {
199
- :SDL_GetPixelFormatName => :pointer,
200
- :SDL_PixelFormatEnumToMasks => :int,
201
- :SDL_MasksToPixelFormatEnum => :uint,
202
- :SDL_AllocFormat => :pointer,
203
- :SDL_FreeFormat => :void,
204
- :SDL_AllocPalette => :pointer,
205
- :SDL_SetPixelFormatPalette => :int,
206
- :SDL_SetPaletteColors => :int,
207
- :SDL_FreePalette => :void,
208
- :SDL_MapRGB => :uint,
209
- :SDL_MapRGBA => :uint,
210
- :SDL_GetRGB => :void,
211
- :SDL_GetRGBA => :void,
212
- :SDL_CalculateGammaRamp => :void,
213
- }
214
- symbols.each do |sym|
215
- begin
216
- attach_function sym, args[sym], retvals[sym]
217
- rescue FFI::NotFoundError => error
218
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
219
- end
220
- end
221
- end
222
-
223
- end
224
-
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
+ ALPHA_OPAQUE = 255
14
+ ALPHA_TRANSPARENT = 0
15
+
16
+ # Enum
17
+
18
+ PIXELTYPE_UNKNOWN = 0
19
+ PIXELTYPE_INDEX1 = 1
20
+ PIXELTYPE_INDEX4 = 2
21
+ PIXELTYPE_INDEX8 = 3
22
+ PIXELTYPE_PACKED8 = 4
23
+ PIXELTYPE_PACKED16 = 5
24
+ PIXELTYPE_PACKED32 = 6
25
+ PIXELTYPE_ARRAYU8 = 7
26
+ PIXELTYPE_ARRAYU16 = 8
27
+ PIXELTYPE_ARRAYU32 = 9
28
+ PIXELTYPE_ARRAYF16 = 10
29
+ PIXELTYPE_ARRAYF32 = 11
30
+ BITMAPORDER_NONE = 0
31
+ BITMAPORDER_4321 = 1
32
+ BITMAPORDER_1234 = 2
33
+ PACKEDORDER_NONE = 0
34
+ PACKEDORDER_XRGB = 1
35
+ PACKEDORDER_RGBX = 2
36
+ PACKEDORDER_ARGB = 3
37
+ PACKEDORDER_RGBA = 4
38
+ PACKEDORDER_XBGR = 5
39
+ PACKEDORDER_BGRX = 6
40
+ PACKEDORDER_ABGR = 7
41
+ PACKEDORDER_BGRA = 8
42
+ ARRAYORDER_NONE = 0
43
+ ARRAYORDER_RGB = 1
44
+ ARRAYORDER_RGBA = 2
45
+ ARRAYORDER_ARGB = 3
46
+ ARRAYORDER_BGR = 4
47
+ ARRAYORDER_BGRA = 5
48
+ ARRAYORDER_ABGR = 6
49
+ PACKEDLAYOUT_NONE = 0
50
+ PACKEDLAYOUT_332 = 1
51
+ PACKEDLAYOUT_4444 = 2
52
+ PACKEDLAYOUT_1555 = 3
53
+ PACKEDLAYOUT_5551 = 4
54
+ PACKEDLAYOUT_565 = 5
55
+ PACKEDLAYOUT_8888 = 6
56
+ PACKEDLAYOUT_2101010 = 7
57
+ PACKEDLAYOUT_1010102 = 8
58
+ PIXELFORMAT_UNKNOWN = 0
59
+ PIXELFORMAT_INDEX1LSB = 286261504
60
+ PIXELFORMAT_INDEX1MSB = 287310080
61
+ PIXELFORMAT_INDEX4LSB = 303039488
62
+ PIXELFORMAT_INDEX4MSB = 304088064
63
+ PIXELFORMAT_INDEX8 = 318769153
64
+ PIXELFORMAT_RGB332 = 336660481
65
+ PIXELFORMAT_XRGB4444 = 353504258
66
+ PIXELFORMAT_RGB444 = 353504258
67
+ PIXELFORMAT_XBGR4444 = 357698562
68
+ PIXELFORMAT_BGR444 = 357698562
69
+ PIXELFORMAT_XRGB1555 = 353570562
70
+ PIXELFORMAT_RGB555 = 353570562
71
+ PIXELFORMAT_XBGR1555 = 357764866
72
+ PIXELFORMAT_BGR555 = 357764866
73
+ PIXELFORMAT_ARGB4444 = 355602434
74
+ PIXELFORMAT_RGBA4444 = 356651010
75
+ PIXELFORMAT_ABGR4444 = 359796738
76
+ PIXELFORMAT_BGRA4444 = 360845314
77
+ PIXELFORMAT_ARGB1555 = 355667970
78
+ PIXELFORMAT_RGBA5551 = 356782082
79
+ PIXELFORMAT_ABGR1555 = 359862274
80
+ PIXELFORMAT_BGRA5551 = 360976386
81
+ PIXELFORMAT_RGB565 = 353701890
82
+ PIXELFORMAT_BGR565 = 357896194
83
+ PIXELFORMAT_RGB24 = 386930691
84
+ PIXELFORMAT_BGR24 = 390076419
85
+ PIXELFORMAT_XRGB8888 = 370546692
86
+ PIXELFORMAT_RGB888 = 370546692
87
+ PIXELFORMAT_RGBX8888 = 371595268
88
+ PIXELFORMAT_XBGR8888 = 374740996
89
+ PIXELFORMAT_BGR888 = 374740996
90
+ PIXELFORMAT_BGRX8888 = 375789572
91
+ PIXELFORMAT_ARGB8888 = 372645892
92
+ PIXELFORMAT_RGBA8888 = 373694468
93
+ PIXELFORMAT_ABGR8888 = 376840196
94
+ PIXELFORMAT_BGRA8888 = 377888772
95
+ PIXELFORMAT_ARGB2101010 = 372711428
96
+ PIXELFORMAT_RGBA32 = 376840196
97
+ PIXELFORMAT_ARGB32 = 377888772
98
+ PIXELFORMAT_BGRA32 = 372645892
99
+ PIXELFORMAT_ABGR32 = 373694468
100
+ PIXELFORMAT_YV12 = 842094169
101
+ PIXELFORMAT_IYUV = 1448433993
102
+ PIXELFORMAT_YUY2 = 844715353
103
+ PIXELFORMAT_UYVY = 1498831189
104
+ PIXELFORMAT_YVYU = 1431918169
105
+ PIXELFORMAT_NV12 = 842094158
106
+ PIXELFORMAT_NV21 = 825382478
107
+ PIXELFORMAT_EXTERNAL_OES = 542328143
108
+
109
+ # Typedef
110
+
111
+ typedef :int, :SDL_PixelType
112
+ typedef :int, :SDL_BitmapOrder
113
+ typedef :int, :SDL_PackedOrder
114
+ typedef :int, :SDL_ArrayOrder
115
+ typedef :int, :SDL_PackedLayout
116
+ typedef :int, :SDL_PixelFormatEnum
117
+
118
+ # Struct
119
+
120
+ class Color < FFI::Struct
121
+ layout(
122
+ :r, :uchar,
123
+ :g, :uchar,
124
+ :b, :uchar,
125
+ :a, :uchar,
126
+ )
127
+ end
128
+
129
+ class Palette < FFI::Struct
130
+ layout(
131
+ :ncolors, :int,
132
+ :colors, :pointer,
133
+ :version, :uint,
134
+ :refcount, :int,
135
+ )
136
+ end
137
+
138
+ class PixelFormat < FFI::Struct
139
+ layout(
140
+ :format, :uint,
141
+ :palette, :pointer,
142
+ :BitsPerPixel, :uchar,
143
+ :BytesPerPixel, :uchar,
144
+ :padding, [:uchar, 2],
145
+ :Rmask, :uint,
146
+ :Gmask, :uint,
147
+ :Bmask, :uint,
148
+ :Amask, :uint,
149
+ :Rloss, :uchar,
150
+ :Gloss, :uchar,
151
+ :Bloss, :uchar,
152
+ :Aloss, :uchar,
153
+ :Rshift, :uchar,
154
+ :Gshift, :uchar,
155
+ :Bshift, :uchar,
156
+ :Ashift, :uchar,
157
+ :refcount, :int,
158
+ :next, :pointer,
159
+ )
160
+ end
161
+
162
+
163
+ # Function
164
+
165
+ def self.setup_pixels_symbols(output_error = false)
166
+ symbols = [
167
+ :SDL_GetPixelFormatName,
168
+ :SDL_PixelFormatEnumToMasks,
169
+ :SDL_MasksToPixelFormatEnum,
170
+ :SDL_AllocFormat,
171
+ :SDL_FreeFormat,
172
+ :SDL_AllocPalette,
173
+ :SDL_SetPixelFormatPalette,
174
+ :SDL_SetPaletteColors,
175
+ :SDL_FreePalette,
176
+ :SDL_MapRGB,
177
+ :SDL_MapRGBA,
178
+ :SDL_GetRGB,
179
+ :SDL_GetRGBA,
180
+ :SDL_CalculateGammaRamp,
181
+ ]
182
+ apis = {
183
+ :SDL_GetPixelFormatName => :GetPixelFormatName,
184
+ :SDL_PixelFormatEnumToMasks => :PixelFormatEnumToMasks,
185
+ :SDL_MasksToPixelFormatEnum => :MasksToPixelFormatEnum,
186
+ :SDL_AllocFormat => :AllocFormat,
187
+ :SDL_FreeFormat => :FreeFormat,
188
+ :SDL_AllocPalette => :AllocPalette,
189
+ :SDL_SetPixelFormatPalette => :SetPixelFormatPalette,
190
+ :SDL_SetPaletteColors => :SetPaletteColors,
191
+ :SDL_FreePalette => :FreePalette,
192
+ :SDL_MapRGB => :MapRGB,
193
+ :SDL_MapRGBA => :MapRGBA,
194
+ :SDL_GetRGB => :GetRGB,
195
+ :SDL_GetRGBA => :GetRGBA,
196
+ :SDL_CalculateGammaRamp => :CalculateGammaRamp,
197
+ }
198
+ args = {
199
+ :SDL_GetPixelFormatName => [:uint],
200
+ :SDL_PixelFormatEnumToMasks => [:uint, :pointer, :pointer, :pointer, :pointer, :pointer],
201
+ :SDL_MasksToPixelFormatEnum => [:int, :uint, :uint, :uint, :uint],
202
+ :SDL_AllocFormat => [:uint],
203
+ :SDL_FreeFormat => [:pointer],
204
+ :SDL_AllocPalette => [:int],
205
+ :SDL_SetPixelFormatPalette => [:pointer, :pointer],
206
+ :SDL_SetPaletteColors => [:pointer, :pointer, :int, :int],
207
+ :SDL_FreePalette => [:pointer],
208
+ :SDL_MapRGB => [:pointer, :uchar, :uchar, :uchar],
209
+ :SDL_MapRGBA => [:pointer, :uchar, :uchar, :uchar, :uchar],
210
+ :SDL_GetRGB => [:uint, :pointer, :pointer, :pointer, :pointer],
211
+ :SDL_GetRGBA => [:uint, :pointer, :pointer, :pointer, :pointer, :pointer],
212
+ :SDL_CalculateGammaRamp => [:float, :pointer],
213
+ }
214
+ retvals = {
215
+ :SDL_GetPixelFormatName => :pointer,
216
+ :SDL_PixelFormatEnumToMasks => :int,
217
+ :SDL_MasksToPixelFormatEnum => :uint,
218
+ :SDL_AllocFormat => :pointer,
219
+ :SDL_FreeFormat => :void,
220
+ :SDL_AllocPalette => :pointer,
221
+ :SDL_SetPixelFormatPalette => :int,
222
+ :SDL_SetPaletteColors => :int,
223
+ :SDL_FreePalette => :void,
224
+ :SDL_MapRGB => :uint,
225
+ :SDL_MapRGBA => :uint,
226
+ :SDL_GetRGB => :void,
227
+ :SDL_GetRGBA => :void,
228
+ :SDL_CalculateGammaRamp => :void,
229
+ }
230
+ symbols.each do |sym|
231
+ begin
232
+ attach_function apis[sym], sym, args[sym], retvals[sym]
233
+ rescue FFI::NotFoundError => error
234
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
235
+ end
236
+ end
237
+ end
238
+
239
+ end
240
+
data/lib/sdl2_platform.rb CHANGED
@@ -1,45 +1,48 @@
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
-
14
- # Enum
15
-
16
-
17
- # Typedef
18
-
19
-
20
- # Struct
21
-
22
-
23
- # Function
24
-
25
- def self.setup_platform_symbols()
26
- symbols = [
27
- :SDL_GetPlatform,
28
- ]
29
- args = {
30
- :SDL_GetPlatform => [],
31
- }
32
- retvals = {
33
- :SDL_GetPlatform => :pointer,
34
- }
35
- symbols.each do |sym|
36
- begin
37
- attach_function sym, args[sym], retvals[sym]
38
- rescue FFI::NotFoundError => error
39
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
40
- end
41
- end
42
- end
43
-
44
- end
45
-
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
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+
23
+ # Function
24
+
25
+ def self.setup_platform_symbols(output_error = false)
26
+ symbols = [
27
+ :SDL_GetPlatform,
28
+ ]
29
+ apis = {
30
+ :SDL_GetPlatform => :GetPlatform,
31
+ }
32
+ args = {
33
+ :SDL_GetPlatform => [],
34
+ }
35
+ retvals = {
36
+ :SDL_GetPlatform => :pointer,
37
+ }
38
+ symbols.each do |sym|
39
+ begin
40
+ attach_function apis[sym], sym, args[sym], retvals[sym]
41
+ rescue FFI::NotFoundError => error
42
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
43
+ end
44
+ end
45
+ end
46
+
47
+ end
48
+
data/lib/sdl2_power.rb CHANGED
@@ -1,51 +1,54 @@
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
-
14
- # Enum
15
-
16
- SDL_POWERSTATE_UNKNOWN = 0
17
- SDL_POWERSTATE_ON_BATTERY = 1
18
- SDL_POWERSTATE_NO_BATTERY = 2
19
- SDL_POWERSTATE_CHARGING = 3
20
- SDL_POWERSTATE_CHARGED = 4
21
-
22
- # Typedef
23
-
24
- typedef :int, :SDL_PowerState
25
-
26
- # Struct
27
-
28
-
29
- # Function
30
-
31
- def self.setup_power_symbols()
32
- symbols = [
33
- :SDL_GetPowerInfo,
34
- ]
35
- args = {
36
- :SDL_GetPowerInfo => [:pointer, :pointer],
37
- }
38
- retvals = {
39
- :SDL_GetPowerInfo => :int,
40
- }
41
- symbols.each do |sym|
42
- begin
43
- attach_function sym, args[sym], retvals[sym]
44
- rescue FFI::NotFoundError => error
45
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
46
- end
47
- end
48
- end
49
-
50
- end
51
-
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
+
14
+ # Enum
15
+
16
+ POWERSTATE_UNKNOWN = 0
17
+ POWERSTATE_ON_BATTERY = 1
18
+ POWERSTATE_NO_BATTERY = 2
19
+ POWERSTATE_CHARGING = 3
20
+ POWERSTATE_CHARGED = 4
21
+
22
+ # Typedef
23
+
24
+ typedef :int, :SDL_PowerState
25
+
26
+ # Struct
27
+
28
+
29
+ # Function
30
+
31
+ def self.setup_power_symbols(output_error = false)
32
+ symbols = [
33
+ :SDL_GetPowerInfo,
34
+ ]
35
+ apis = {
36
+ :SDL_GetPowerInfo => :GetPowerInfo,
37
+ }
38
+ args = {
39
+ :SDL_GetPowerInfo => [:pointer, :pointer],
40
+ }
41
+ retvals = {
42
+ :SDL_GetPowerInfo => :int,
43
+ }
44
+ symbols.each do |sym|
45
+ begin
46
+ attach_function apis[sym], sym, args[sym], retvals[sym]
47
+ rescue FFI::NotFoundError => error
48
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
49
+ end
50
+ end
51
+ end
52
+
53
+ end
54
+