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.
- checksums.yaml +4 -4
- data/ChangeLog +134 -108
- data/LICENSE.txt +0 -0
- data/README.md +86 -68
- data/lib/sdl2.rb +131 -127
- data/lib/sdl2_audio.rb +261 -261
- data/lib/sdl2_blendmode.rb +72 -72
- data/lib/sdl2_clipboard.rb +56 -56
- data/lib/sdl2_cpuinfo.rb +129 -129
- data/lib/sdl2_error.rb +71 -71
- data/lib/sdl2_events.rb +564 -552
- data/lib/sdl2_filesystem.rb +52 -52
- data/lib/sdl2_framerate.rb +74 -74
- data/lib/sdl2_gamecontroller.rb +329 -329
- data/lib/sdl2_gesture.rb +61 -61
- data/lib/sdl2_gfxPrimitives.rb +283 -283
- data/lib/sdl2_haptic.rb +301 -301
- data/lib/sdl2_hidapi.rb +139 -139
- data/lib/sdl2_hints.rb +221 -207
- data/lib/sdl2_image.rb +296 -232
- data/lib/sdl2_imageFilter.rb +164 -164
- data/lib/sdl2_joystick.rb +294 -294
- data/lib/sdl2_keyboard.rb +125 -117
- data/lib/sdl2_keycode.rb +307 -307
- data/lib/sdl2_log.rb +131 -131
- data/lib/sdl2_main.rb +74 -74
- data/lib/sdl2_messagebox.rb +102 -102
- data/lib/sdl2_misc.rb +48 -48
- data/lib/sdl2_mixer.rb +464 -392
- data/lib/sdl2_mouse.rb +136 -136
- data/lib/sdl2_pixels.rb +240 -240
- data/lib/sdl2_platform.rb +48 -48
- data/lib/sdl2_power.rb +54 -54
- data/lib/sdl2_rect.rb +145 -109
- data/lib/sdl2_render.rb +408 -404
- data/lib/sdl2_rotozoom.rb +76 -76
- data/lib/sdl2_rwops.rb +242 -238
- data/lib/sdl2_scancode.rb +289 -289
- data/lib/sdl2_sensor.rb +115 -115
- data/lib/sdl2_shape.rb +83 -83
- data/lib/sdl2_sound.rb +154 -0
- data/lib/sdl2_stdinc.rb +548 -564
- data/lib/sdl2_surface.rb +229 -229
- data/lib/sdl2_syswm.rb +160 -160
- data/lib/sdl2_timer.rb +74 -74
- data/lib/sdl2_touch.rb +86 -82
- data/lib/sdl2_ttf.rb +414 -357
- data/lib/sdl2_version.rb +67 -67
- data/lib/sdl2_video.rb +540 -540
- data/lib/sdl2_vulkan.rb +72 -72
- metadata +3 -2
data/lib/sdl2_pixels.rb
CHANGED
@@ -1,240 +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 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
|
-
|
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,48 +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 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
|
-
|
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,54 +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 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
|
-
|
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
|
+
|