sdl2-bindings 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +145 -134
- data/LICENSE.txt +0 -0
- data/README.md +108 -86
- data/lib/sdl2.rb +131 -131
- data/lib/sdl2_audio.rb +265 -261
- data/lib/sdl2_blendmode.rb +72 -72
- data/lib/sdl2_clipboard.rb +56 -56
- data/lib/sdl2_cpuinfo.rb +137 -129
- data/lib/sdl2_error.rb +71 -71
- data/lib/sdl2_events.rb +575 -564
- data/lib/sdl2_filesystem.rb +52 -52
- data/lib/sdl2_framerate.rb +74 -74
- data/lib/sdl2_gamecontroller.rb +345 -329
- data/lib/sdl2_gesture.rb +61 -61
- data/lib/sdl2_gfxPrimitives.rb +283 -283
- data/lib/sdl2_guid.rb +58 -0
- data/lib/sdl2_haptic.rb +301 -301
- data/lib/sdl2_hidapi.rb +139 -139
- data/lib/sdl2_hints.rb +240 -221
- data/lib/sdl2_image.rb +296 -296
- data/lib/sdl2_imageFilter.rb +164 -164
- data/lib/sdl2_joystick.rb +332 -294
- data/lib/sdl2_keyboard.rb +129 -125
- data/lib/sdl2_keycode.rb +311 -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 -464
- 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 -145
- data/lib/sdl2_render.rb +408 -408
- data/lib/sdl2_rotozoom.rb +76 -76
- data/lib/sdl2_rwops.rb +242 -242
- data/lib/sdl2_scancode.rb +293 -289
- data/lib/sdl2_sensor.rb +115 -115
- data/lib/sdl2_shape.rb +83 -83
- data/lib/sdl2_sound.rb +154 -154
- data/lib/sdl2_stdinc.rb +572 -548
- 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 -86
- data/lib/sdl2_ttf.rb +414 -414
- data/lib/sdl2_version.rb +67 -67
- data/lib/sdl2_video.rb +549 -540
- data/lib/sdl2_vulkan.rb +72 -72
- metadata +4 -3
data/lib/sdl2_surface.rb
CHANGED
@@ -1,229 +1,229 @@
|
|
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
|
-
require_relative 'sdl2_rect'
|
9
|
-
|
10
|
-
module SDL
|
11
|
-
extend FFI::Library
|
12
|
-
# Define/Macro
|
13
|
-
|
14
|
-
SWSURFACE = 0
|
15
|
-
PREALLOC = 0x00000001
|
16
|
-
RLEACCEL = 0x00000002
|
17
|
-
DONTFREE = 0x00000004
|
18
|
-
SIMD_ALIGNED = 0x00000008
|
19
|
-
|
20
|
-
# Enum
|
21
|
-
|
22
|
-
YUV_CONVERSION_JPEG = 0
|
23
|
-
YUV_CONVERSION_BT601 = 1
|
24
|
-
YUV_CONVERSION_BT709 = 2
|
25
|
-
YUV_CONVERSION_AUTOMATIC = 3
|
26
|
-
|
27
|
-
# Typedef
|
28
|
-
|
29
|
-
callback :SDL_blit, [:pointer, :pointer, :pointer, :pointer], :int
|
30
|
-
typedef :int, :SDL_YUV_CONVERSION_MODE
|
31
|
-
|
32
|
-
# Struct
|
33
|
-
|
34
|
-
class Surface < FFI::Struct
|
35
|
-
layout(
|
36
|
-
:flags, :uint,
|
37
|
-
:format, :pointer,
|
38
|
-
:w, :int,
|
39
|
-
:h, :int,
|
40
|
-
:pitch, :int,
|
41
|
-
:pixels, :pointer,
|
42
|
-
:userdata, :pointer,
|
43
|
-
:locked, :int,
|
44
|
-
:list_blitmap, :pointer,
|
45
|
-
:clip_rect, Rect,
|
46
|
-
:map, :pointer,
|
47
|
-
:refcount, :int,
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
# Function
|
53
|
-
|
54
|
-
def self.setup_surface_symbols(output_error = false)
|
55
|
-
symbols = [
|
56
|
-
:SDL_CreateRGBSurface,
|
57
|
-
:SDL_CreateRGBSurfaceWithFormat,
|
58
|
-
:SDL_CreateRGBSurfaceFrom,
|
59
|
-
:SDL_CreateRGBSurfaceWithFormatFrom,
|
60
|
-
:SDL_FreeSurface,
|
61
|
-
:SDL_SetSurfacePalette,
|
62
|
-
:SDL_LockSurface,
|
63
|
-
:SDL_UnlockSurface,
|
64
|
-
:SDL_LoadBMP_RW,
|
65
|
-
:SDL_SaveBMP_RW,
|
66
|
-
:SDL_SetSurfaceRLE,
|
67
|
-
:SDL_HasSurfaceRLE,
|
68
|
-
:SDL_SetColorKey,
|
69
|
-
:SDL_HasColorKey,
|
70
|
-
:SDL_GetColorKey,
|
71
|
-
:SDL_SetSurfaceColorMod,
|
72
|
-
:SDL_GetSurfaceColorMod,
|
73
|
-
:SDL_SetSurfaceAlphaMod,
|
74
|
-
:SDL_GetSurfaceAlphaMod,
|
75
|
-
:SDL_SetSurfaceBlendMode,
|
76
|
-
:SDL_GetSurfaceBlendMode,
|
77
|
-
:SDL_SetClipRect,
|
78
|
-
:SDL_GetClipRect,
|
79
|
-
:SDL_DuplicateSurface,
|
80
|
-
:SDL_ConvertSurface,
|
81
|
-
:SDL_ConvertSurfaceFormat,
|
82
|
-
:SDL_ConvertPixels,
|
83
|
-
:SDL_PremultiplyAlpha,
|
84
|
-
:SDL_FillRect,
|
85
|
-
:SDL_FillRects,
|
86
|
-
:SDL_UpperBlit,
|
87
|
-
:SDL_LowerBlit,
|
88
|
-
:SDL_SoftStretch,
|
89
|
-
:SDL_SoftStretchLinear,
|
90
|
-
:SDL_UpperBlitScaled,
|
91
|
-
:SDL_LowerBlitScaled,
|
92
|
-
:SDL_SetYUVConversionMode,
|
93
|
-
:SDL_GetYUVConversionMode,
|
94
|
-
:SDL_GetYUVConversionModeForResolution,
|
95
|
-
]
|
96
|
-
apis = {
|
97
|
-
:SDL_CreateRGBSurface => :CreateRGBSurface,
|
98
|
-
:SDL_CreateRGBSurfaceWithFormat => :CreateRGBSurfaceWithFormat,
|
99
|
-
:SDL_CreateRGBSurfaceFrom => :CreateRGBSurfaceFrom,
|
100
|
-
:SDL_CreateRGBSurfaceWithFormatFrom => :CreateRGBSurfaceWithFormatFrom,
|
101
|
-
:SDL_FreeSurface => :FreeSurface,
|
102
|
-
:SDL_SetSurfacePalette => :SetSurfacePalette,
|
103
|
-
:SDL_LockSurface => :LockSurface,
|
104
|
-
:SDL_UnlockSurface => :UnlockSurface,
|
105
|
-
:SDL_LoadBMP_RW => :LoadBMP_RW,
|
106
|
-
:SDL_SaveBMP_RW => :SaveBMP_RW,
|
107
|
-
:SDL_SetSurfaceRLE => :SetSurfaceRLE,
|
108
|
-
:SDL_HasSurfaceRLE => :HasSurfaceRLE,
|
109
|
-
:SDL_SetColorKey => :SetColorKey,
|
110
|
-
:SDL_HasColorKey => :HasColorKey,
|
111
|
-
:SDL_GetColorKey => :GetColorKey,
|
112
|
-
:SDL_SetSurfaceColorMod => :SetSurfaceColorMod,
|
113
|
-
:SDL_GetSurfaceColorMod => :GetSurfaceColorMod,
|
114
|
-
:SDL_SetSurfaceAlphaMod => :SetSurfaceAlphaMod,
|
115
|
-
:SDL_GetSurfaceAlphaMod => :GetSurfaceAlphaMod,
|
116
|
-
:SDL_SetSurfaceBlendMode => :SetSurfaceBlendMode,
|
117
|
-
:SDL_GetSurfaceBlendMode => :GetSurfaceBlendMode,
|
118
|
-
:SDL_SetClipRect => :SetClipRect,
|
119
|
-
:SDL_GetClipRect => :GetClipRect,
|
120
|
-
:SDL_DuplicateSurface => :DuplicateSurface,
|
121
|
-
:SDL_ConvertSurface => :ConvertSurface,
|
122
|
-
:SDL_ConvertSurfaceFormat => :ConvertSurfaceFormat,
|
123
|
-
:SDL_ConvertPixels => :ConvertPixels,
|
124
|
-
:SDL_PremultiplyAlpha => :PremultiplyAlpha,
|
125
|
-
:SDL_FillRect => :FillRect,
|
126
|
-
:SDL_FillRects => :FillRects,
|
127
|
-
:SDL_UpperBlit => :UpperBlit,
|
128
|
-
:SDL_LowerBlit => :LowerBlit,
|
129
|
-
:SDL_SoftStretch => :SoftStretch,
|
130
|
-
:SDL_SoftStretchLinear => :SoftStretchLinear,
|
131
|
-
:SDL_UpperBlitScaled => :UpperBlitScaled,
|
132
|
-
:SDL_LowerBlitScaled => :LowerBlitScaled,
|
133
|
-
:SDL_SetYUVConversionMode => :SetYUVConversionMode,
|
134
|
-
:SDL_GetYUVConversionMode => :GetYUVConversionMode,
|
135
|
-
:SDL_GetYUVConversionModeForResolution => :GetYUVConversionModeForResolution,
|
136
|
-
}
|
137
|
-
args = {
|
138
|
-
:SDL_CreateRGBSurface => [:uint, :int, :int, :int, :uint, :uint, :uint, :uint],
|
139
|
-
:SDL_CreateRGBSurfaceWithFormat => [:uint, :int, :int, :int, :uint],
|
140
|
-
:SDL_CreateRGBSurfaceFrom => [:pointer, :int, :int, :int, :int, :uint, :uint, :uint, :uint],
|
141
|
-
:SDL_CreateRGBSurfaceWithFormatFrom => [:pointer, :int, :int, :int, :int, :uint],
|
142
|
-
:SDL_FreeSurface => [:pointer],
|
143
|
-
:SDL_SetSurfacePalette => [:pointer, :pointer],
|
144
|
-
:SDL_LockSurface => [:pointer],
|
145
|
-
:SDL_UnlockSurface => [:pointer],
|
146
|
-
:SDL_LoadBMP_RW => [:pointer, :int],
|
147
|
-
:SDL_SaveBMP_RW => [:pointer, :pointer, :int],
|
148
|
-
:SDL_SetSurfaceRLE => [:pointer, :int],
|
149
|
-
:SDL_HasSurfaceRLE => [:pointer],
|
150
|
-
:SDL_SetColorKey => [:pointer, :int, :uint],
|
151
|
-
:SDL_HasColorKey => [:pointer],
|
152
|
-
:SDL_GetColorKey => [:pointer, :pointer],
|
153
|
-
:SDL_SetSurfaceColorMod => [:pointer, :uchar, :uchar, :uchar],
|
154
|
-
:SDL_GetSurfaceColorMod => [:pointer, :pointer, :pointer, :pointer],
|
155
|
-
:SDL_SetSurfaceAlphaMod => [:pointer, :uchar],
|
156
|
-
:SDL_GetSurfaceAlphaMod => [:pointer, :pointer],
|
157
|
-
:SDL_SetSurfaceBlendMode => [:pointer, :int],
|
158
|
-
:SDL_GetSurfaceBlendMode => [:pointer, :pointer],
|
159
|
-
:SDL_SetClipRect => [:pointer, :pointer],
|
160
|
-
:SDL_GetClipRect => [:pointer, :pointer],
|
161
|
-
:SDL_DuplicateSurface => [:pointer],
|
162
|
-
:SDL_ConvertSurface => [:pointer, :pointer, :uint],
|
163
|
-
:SDL_ConvertSurfaceFormat => [:pointer, :uint, :uint],
|
164
|
-
:SDL_ConvertPixels => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
|
165
|
-
:SDL_PremultiplyAlpha => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
|
166
|
-
:SDL_FillRect => [:pointer, :pointer, :uint],
|
167
|
-
:SDL_FillRects => [:pointer, :pointer, :int, :uint],
|
168
|
-
:SDL_UpperBlit => [:pointer, :pointer, :pointer, :pointer],
|
169
|
-
:SDL_LowerBlit => [:pointer, :pointer, :pointer, :pointer],
|
170
|
-
:SDL_SoftStretch => [:pointer, :pointer, :pointer, :pointer],
|
171
|
-
:SDL_SoftStretchLinear => [:pointer, :pointer, :pointer, :pointer],
|
172
|
-
:SDL_UpperBlitScaled => [:pointer, :pointer, :pointer, :pointer],
|
173
|
-
:SDL_LowerBlitScaled => [:pointer, :pointer, :pointer, :pointer],
|
174
|
-
:SDL_SetYUVConversionMode => [:int],
|
175
|
-
:SDL_GetYUVConversionMode => [],
|
176
|
-
:SDL_GetYUVConversionModeForResolution => [:int, :int],
|
177
|
-
}
|
178
|
-
retvals = {
|
179
|
-
:SDL_CreateRGBSurface => :pointer,
|
180
|
-
:SDL_CreateRGBSurfaceWithFormat => :pointer,
|
181
|
-
:SDL_CreateRGBSurfaceFrom => :pointer,
|
182
|
-
:SDL_CreateRGBSurfaceWithFormatFrom => :pointer,
|
183
|
-
:SDL_FreeSurface => :void,
|
184
|
-
:SDL_SetSurfacePalette => :int,
|
185
|
-
:SDL_LockSurface => :int,
|
186
|
-
:SDL_UnlockSurface => :void,
|
187
|
-
:SDL_LoadBMP_RW => :pointer,
|
188
|
-
:SDL_SaveBMP_RW => :int,
|
189
|
-
:SDL_SetSurfaceRLE => :int,
|
190
|
-
:SDL_HasSurfaceRLE => :int,
|
191
|
-
:SDL_SetColorKey => :int,
|
192
|
-
:SDL_HasColorKey => :int,
|
193
|
-
:SDL_GetColorKey => :int,
|
194
|
-
:SDL_SetSurfaceColorMod => :int,
|
195
|
-
:SDL_GetSurfaceColorMod => :int,
|
196
|
-
:SDL_SetSurfaceAlphaMod => :int,
|
197
|
-
:SDL_GetSurfaceAlphaMod => :int,
|
198
|
-
:SDL_SetSurfaceBlendMode => :int,
|
199
|
-
:SDL_GetSurfaceBlendMode => :int,
|
200
|
-
:SDL_SetClipRect => :int,
|
201
|
-
:SDL_GetClipRect => :void,
|
202
|
-
:SDL_DuplicateSurface => :pointer,
|
203
|
-
:SDL_ConvertSurface => :pointer,
|
204
|
-
:SDL_ConvertSurfaceFormat => :pointer,
|
205
|
-
:SDL_ConvertPixels => :int,
|
206
|
-
:SDL_PremultiplyAlpha => :int,
|
207
|
-
:SDL_FillRect => :int,
|
208
|
-
:SDL_FillRects => :int,
|
209
|
-
:SDL_UpperBlit => :int,
|
210
|
-
:SDL_LowerBlit => :int,
|
211
|
-
:SDL_SoftStretch => :int,
|
212
|
-
:SDL_SoftStretchLinear => :int,
|
213
|
-
:SDL_UpperBlitScaled => :int,
|
214
|
-
:SDL_LowerBlitScaled => :int,
|
215
|
-
:SDL_SetYUVConversionMode => :void,
|
216
|
-
:SDL_GetYUVConversionMode => :int,
|
217
|
-
:SDL_GetYUVConversionModeForResolution => :int,
|
218
|
-
}
|
219
|
-
symbols.each do |sym|
|
220
|
-
begin
|
221
|
-
attach_function apis[sym], sym, args[sym], retvals[sym]
|
222
|
-
rescue FFI::NotFoundError => error
|
223
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
end
|
229
|
-
|
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
|
+
require_relative 'sdl2_rect'
|
9
|
+
|
10
|
+
module SDL
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
SWSURFACE = 0
|
15
|
+
PREALLOC = 0x00000001
|
16
|
+
RLEACCEL = 0x00000002
|
17
|
+
DONTFREE = 0x00000004
|
18
|
+
SIMD_ALIGNED = 0x00000008
|
19
|
+
|
20
|
+
# Enum
|
21
|
+
|
22
|
+
YUV_CONVERSION_JPEG = 0
|
23
|
+
YUV_CONVERSION_BT601 = 1
|
24
|
+
YUV_CONVERSION_BT709 = 2
|
25
|
+
YUV_CONVERSION_AUTOMATIC = 3
|
26
|
+
|
27
|
+
# Typedef
|
28
|
+
|
29
|
+
callback :SDL_blit, [:pointer, :pointer, :pointer, :pointer], :int
|
30
|
+
typedef :int, :SDL_YUV_CONVERSION_MODE
|
31
|
+
|
32
|
+
# Struct
|
33
|
+
|
34
|
+
class Surface < FFI::Struct
|
35
|
+
layout(
|
36
|
+
:flags, :uint,
|
37
|
+
:format, :pointer,
|
38
|
+
:w, :int,
|
39
|
+
:h, :int,
|
40
|
+
:pitch, :int,
|
41
|
+
:pixels, :pointer,
|
42
|
+
:userdata, :pointer,
|
43
|
+
:locked, :int,
|
44
|
+
:list_blitmap, :pointer,
|
45
|
+
:clip_rect, Rect,
|
46
|
+
:map, :pointer,
|
47
|
+
:refcount, :int,
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
# Function
|
53
|
+
|
54
|
+
def self.setup_surface_symbols(output_error = false)
|
55
|
+
symbols = [
|
56
|
+
:SDL_CreateRGBSurface,
|
57
|
+
:SDL_CreateRGBSurfaceWithFormat,
|
58
|
+
:SDL_CreateRGBSurfaceFrom,
|
59
|
+
:SDL_CreateRGBSurfaceWithFormatFrom,
|
60
|
+
:SDL_FreeSurface,
|
61
|
+
:SDL_SetSurfacePalette,
|
62
|
+
:SDL_LockSurface,
|
63
|
+
:SDL_UnlockSurface,
|
64
|
+
:SDL_LoadBMP_RW,
|
65
|
+
:SDL_SaveBMP_RW,
|
66
|
+
:SDL_SetSurfaceRLE,
|
67
|
+
:SDL_HasSurfaceRLE,
|
68
|
+
:SDL_SetColorKey,
|
69
|
+
:SDL_HasColorKey,
|
70
|
+
:SDL_GetColorKey,
|
71
|
+
:SDL_SetSurfaceColorMod,
|
72
|
+
:SDL_GetSurfaceColorMod,
|
73
|
+
:SDL_SetSurfaceAlphaMod,
|
74
|
+
:SDL_GetSurfaceAlphaMod,
|
75
|
+
:SDL_SetSurfaceBlendMode,
|
76
|
+
:SDL_GetSurfaceBlendMode,
|
77
|
+
:SDL_SetClipRect,
|
78
|
+
:SDL_GetClipRect,
|
79
|
+
:SDL_DuplicateSurface,
|
80
|
+
:SDL_ConvertSurface,
|
81
|
+
:SDL_ConvertSurfaceFormat,
|
82
|
+
:SDL_ConvertPixels,
|
83
|
+
:SDL_PremultiplyAlpha,
|
84
|
+
:SDL_FillRect,
|
85
|
+
:SDL_FillRects,
|
86
|
+
:SDL_UpperBlit,
|
87
|
+
:SDL_LowerBlit,
|
88
|
+
:SDL_SoftStretch,
|
89
|
+
:SDL_SoftStretchLinear,
|
90
|
+
:SDL_UpperBlitScaled,
|
91
|
+
:SDL_LowerBlitScaled,
|
92
|
+
:SDL_SetYUVConversionMode,
|
93
|
+
:SDL_GetYUVConversionMode,
|
94
|
+
:SDL_GetYUVConversionModeForResolution,
|
95
|
+
]
|
96
|
+
apis = {
|
97
|
+
:SDL_CreateRGBSurface => :CreateRGBSurface,
|
98
|
+
:SDL_CreateRGBSurfaceWithFormat => :CreateRGBSurfaceWithFormat,
|
99
|
+
:SDL_CreateRGBSurfaceFrom => :CreateRGBSurfaceFrom,
|
100
|
+
:SDL_CreateRGBSurfaceWithFormatFrom => :CreateRGBSurfaceWithFormatFrom,
|
101
|
+
:SDL_FreeSurface => :FreeSurface,
|
102
|
+
:SDL_SetSurfacePalette => :SetSurfacePalette,
|
103
|
+
:SDL_LockSurface => :LockSurface,
|
104
|
+
:SDL_UnlockSurface => :UnlockSurface,
|
105
|
+
:SDL_LoadBMP_RW => :LoadBMP_RW,
|
106
|
+
:SDL_SaveBMP_RW => :SaveBMP_RW,
|
107
|
+
:SDL_SetSurfaceRLE => :SetSurfaceRLE,
|
108
|
+
:SDL_HasSurfaceRLE => :HasSurfaceRLE,
|
109
|
+
:SDL_SetColorKey => :SetColorKey,
|
110
|
+
:SDL_HasColorKey => :HasColorKey,
|
111
|
+
:SDL_GetColorKey => :GetColorKey,
|
112
|
+
:SDL_SetSurfaceColorMod => :SetSurfaceColorMod,
|
113
|
+
:SDL_GetSurfaceColorMod => :GetSurfaceColorMod,
|
114
|
+
:SDL_SetSurfaceAlphaMod => :SetSurfaceAlphaMod,
|
115
|
+
:SDL_GetSurfaceAlphaMod => :GetSurfaceAlphaMod,
|
116
|
+
:SDL_SetSurfaceBlendMode => :SetSurfaceBlendMode,
|
117
|
+
:SDL_GetSurfaceBlendMode => :GetSurfaceBlendMode,
|
118
|
+
:SDL_SetClipRect => :SetClipRect,
|
119
|
+
:SDL_GetClipRect => :GetClipRect,
|
120
|
+
:SDL_DuplicateSurface => :DuplicateSurface,
|
121
|
+
:SDL_ConvertSurface => :ConvertSurface,
|
122
|
+
:SDL_ConvertSurfaceFormat => :ConvertSurfaceFormat,
|
123
|
+
:SDL_ConvertPixels => :ConvertPixels,
|
124
|
+
:SDL_PremultiplyAlpha => :PremultiplyAlpha,
|
125
|
+
:SDL_FillRect => :FillRect,
|
126
|
+
:SDL_FillRects => :FillRects,
|
127
|
+
:SDL_UpperBlit => :UpperBlit,
|
128
|
+
:SDL_LowerBlit => :LowerBlit,
|
129
|
+
:SDL_SoftStretch => :SoftStretch,
|
130
|
+
:SDL_SoftStretchLinear => :SoftStretchLinear,
|
131
|
+
:SDL_UpperBlitScaled => :UpperBlitScaled,
|
132
|
+
:SDL_LowerBlitScaled => :LowerBlitScaled,
|
133
|
+
:SDL_SetYUVConversionMode => :SetYUVConversionMode,
|
134
|
+
:SDL_GetYUVConversionMode => :GetYUVConversionMode,
|
135
|
+
:SDL_GetYUVConversionModeForResolution => :GetYUVConversionModeForResolution,
|
136
|
+
}
|
137
|
+
args = {
|
138
|
+
:SDL_CreateRGBSurface => [:uint, :int, :int, :int, :uint, :uint, :uint, :uint],
|
139
|
+
:SDL_CreateRGBSurfaceWithFormat => [:uint, :int, :int, :int, :uint],
|
140
|
+
:SDL_CreateRGBSurfaceFrom => [:pointer, :int, :int, :int, :int, :uint, :uint, :uint, :uint],
|
141
|
+
:SDL_CreateRGBSurfaceWithFormatFrom => [:pointer, :int, :int, :int, :int, :uint],
|
142
|
+
:SDL_FreeSurface => [:pointer],
|
143
|
+
:SDL_SetSurfacePalette => [:pointer, :pointer],
|
144
|
+
:SDL_LockSurface => [:pointer],
|
145
|
+
:SDL_UnlockSurface => [:pointer],
|
146
|
+
:SDL_LoadBMP_RW => [:pointer, :int],
|
147
|
+
:SDL_SaveBMP_RW => [:pointer, :pointer, :int],
|
148
|
+
:SDL_SetSurfaceRLE => [:pointer, :int],
|
149
|
+
:SDL_HasSurfaceRLE => [:pointer],
|
150
|
+
:SDL_SetColorKey => [:pointer, :int, :uint],
|
151
|
+
:SDL_HasColorKey => [:pointer],
|
152
|
+
:SDL_GetColorKey => [:pointer, :pointer],
|
153
|
+
:SDL_SetSurfaceColorMod => [:pointer, :uchar, :uchar, :uchar],
|
154
|
+
:SDL_GetSurfaceColorMod => [:pointer, :pointer, :pointer, :pointer],
|
155
|
+
:SDL_SetSurfaceAlphaMod => [:pointer, :uchar],
|
156
|
+
:SDL_GetSurfaceAlphaMod => [:pointer, :pointer],
|
157
|
+
:SDL_SetSurfaceBlendMode => [:pointer, :int],
|
158
|
+
:SDL_GetSurfaceBlendMode => [:pointer, :pointer],
|
159
|
+
:SDL_SetClipRect => [:pointer, :pointer],
|
160
|
+
:SDL_GetClipRect => [:pointer, :pointer],
|
161
|
+
:SDL_DuplicateSurface => [:pointer],
|
162
|
+
:SDL_ConvertSurface => [:pointer, :pointer, :uint],
|
163
|
+
:SDL_ConvertSurfaceFormat => [:pointer, :uint, :uint],
|
164
|
+
:SDL_ConvertPixels => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
|
165
|
+
:SDL_PremultiplyAlpha => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
|
166
|
+
:SDL_FillRect => [:pointer, :pointer, :uint],
|
167
|
+
:SDL_FillRects => [:pointer, :pointer, :int, :uint],
|
168
|
+
:SDL_UpperBlit => [:pointer, :pointer, :pointer, :pointer],
|
169
|
+
:SDL_LowerBlit => [:pointer, :pointer, :pointer, :pointer],
|
170
|
+
:SDL_SoftStretch => [:pointer, :pointer, :pointer, :pointer],
|
171
|
+
:SDL_SoftStretchLinear => [:pointer, :pointer, :pointer, :pointer],
|
172
|
+
:SDL_UpperBlitScaled => [:pointer, :pointer, :pointer, :pointer],
|
173
|
+
:SDL_LowerBlitScaled => [:pointer, :pointer, :pointer, :pointer],
|
174
|
+
:SDL_SetYUVConversionMode => [:int],
|
175
|
+
:SDL_GetYUVConversionMode => [],
|
176
|
+
:SDL_GetYUVConversionModeForResolution => [:int, :int],
|
177
|
+
}
|
178
|
+
retvals = {
|
179
|
+
:SDL_CreateRGBSurface => :pointer,
|
180
|
+
:SDL_CreateRGBSurfaceWithFormat => :pointer,
|
181
|
+
:SDL_CreateRGBSurfaceFrom => :pointer,
|
182
|
+
:SDL_CreateRGBSurfaceWithFormatFrom => :pointer,
|
183
|
+
:SDL_FreeSurface => :void,
|
184
|
+
:SDL_SetSurfacePalette => :int,
|
185
|
+
:SDL_LockSurface => :int,
|
186
|
+
:SDL_UnlockSurface => :void,
|
187
|
+
:SDL_LoadBMP_RW => :pointer,
|
188
|
+
:SDL_SaveBMP_RW => :int,
|
189
|
+
:SDL_SetSurfaceRLE => :int,
|
190
|
+
:SDL_HasSurfaceRLE => :int,
|
191
|
+
:SDL_SetColorKey => :int,
|
192
|
+
:SDL_HasColorKey => :int,
|
193
|
+
:SDL_GetColorKey => :int,
|
194
|
+
:SDL_SetSurfaceColorMod => :int,
|
195
|
+
:SDL_GetSurfaceColorMod => :int,
|
196
|
+
:SDL_SetSurfaceAlphaMod => :int,
|
197
|
+
:SDL_GetSurfaceAlphaMod => :int,
|
198
|
+
:SDL_SetSurfaceBlendMode => :int,
|
199
|
+
:SDL_GetSurfaceBlendMode => :int,
|
200
|
+
:SDL_SetClipRect => :int,
|
201
|
+
:SDL_GetClipRect => :void,
|
202
|
+
:SDL_DuplicateSurface => :pointer,
|
203
|
+
:SDL_ConvertSurface => :pointer,
|
204
|
+
:SDL_ConvertSurfaceFormat => :pointer,
|
205
|
+
:SDL_ConvertPixels => :int,
|
206
|
+
:SDL_PremultiplyAlpha => :int,
|
207
|
+
:SDL_FillRect => :int,
|
208
|
+
:SDL_FillRects => :int,
|
209
|
+
:SDL_UpperBlit => :int,
|
210
|
+
:SDL_LowerBlit => :int,
|
211
|
+
:SDL_SoftStretch => :int,
|
212
|
+
:SDL_SoftStretchLinear => :int,
|
213
|
+
:SDL_UpperBlitScaled => :int,
|
214
|
+
:SDL_LowerBlitScaled => :int,
|
215
|
+
:SDL_SetYUVConversionMode => :void,
|
216
|
+
:SDL_GetYUVConversionMode => :int,
|
217
|
+
:SDL_GetYUVConversionModeForResolution => :int,
|
218
|
+
}
|
219
|
+
symbols.each do |sym|
|
220
|
+
begin
|
221
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
222
|
+
rescue FFI::NotFoundError => error
|
223
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
|