sdl2-bindings 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +83 -79
- data/LICENSE.txt +1 -1
- data/README.md +49 -49
- data/lib/sdl2.rb +170 -170
- data/lib/sdl2_audio.rb +219 -201
- data/lib/sdl2_blendmode.rb +69 -69
- data/lib/sdl2_clipboard.rb +51 -51
- data/lib/sdl2_cpuinfo.rb +106 -106
- data/lib/sdl2_error.rb +64 -64
- data/lib/sdl2_events.rb +530 -530
- data/lib/sdl2_filesystem.rb +48 -48
- data/lib/sdl2_framerate.rb +67 -67
- data/lib/sdl2_gamecontroller.rb +254 -254
- data/lib/sdl2_gesture.rb +55 -55
- data/lib/sdl2_gfxPrimitives.rb +222 -222
- data/lib/sdl2_haptic.rb +269 -269
- data/lib/sdl2_hints.rb +174 -174
- data/lib/sdl2_image.rb +185 -185
- data/lib/sdl2_imageFilter.rb +132 -132
- data/lib/sdl2_joystick.rb +230 -230
- data/lib/sdl2_keyboard.rb +99 -99
- data/lib/sdl2_keycode.rb +304 -304
- data/lib/sdl2_log.rb +115 -115
- data/lib/sdl2_main.rb +67 -67
- data/lib/sdl2_messagebox.rb +98 -98
- data/lib/sdl2_mixer.rb +317 -307
- data/lib/sdl2_mouse.rb +117 -117
- data/lib/sdl2_pixels.rb +224 -224
- data/lib/sdl2_platform.rb +45 -45
- data/lib/sdl2_power.rb +51 -51
- data/lib/sdl2_rect.rb +102 -102
- data/lib/sdl2_render.rb +290 -290
- data/lib/sdl2_rotozoom.rb +66 -66
- data/lib/sdl2_rwops.rb +208 -208
- data/lib/sdl2_scancode.rb +287 -287
- data/lib/sdl2_shape.rb +77 -77
- data/lib/sdl2_stdinc.rb +393 -393
- data/lib/sdl2_surface.rb +182 -182
- data/lib/sdl2_syswm.rb +154 -154
- data/lib/sdl2_timer.rb +62 -62
- data/lib/sdl2_touch.rb +73 -73
- data/lib/sdl2_ttf.rb +202 -190
- data/lib/sdl2_version.rb +62 -62
- data/lib/sdl2_video.rb +411 -411
- data/lib/sdl2_vulkan.rb +64 -64
- metadata +6 -6
data/lib/sdl2_version.rb
CHANGED
@@ -1,62 +1,62 @@
|
|
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_MAJOR_VERSION = 2
|
14
|
-
SDL_MINOR_VERSION = 0
|
15
|
-
SDL_PATCHLEVEL = 14
|
16
|
-
|
17
|
-
# Enum
|
18
|
-
|
19
|
-
|
20
|
-
# Typedef
|
21
|
-
|
22
|
-
|
23
|
-
# Struct
|
24
|
-
|
25
|
-
class SDL_version < FFI::Struct
|
26
|
-
layout(
|
27
|
-
:major, :uchar,
|
28
|
-
:minor, :uchar,
|
29
|
-
:patch, :uchar,
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
# Function
|
35
|
-
|
36
|
-
def self.setup_version_symbols()
|
37
|
-
symbols = [
|
38
|
-
:SDL_GetVersion,
|
39
|
-
:SDL_GetRevision,
|
40
|
-
:SDL_GetRevisionNumber,
|
41
|
-
]
|
42
|
-
args = {
|
43
|
-
:SDL_GetVersion => [:pointer],
|
44
|
-
:SDL_GetRevision => [],
|
45
|
-
:SDL_GetRevisionNumber => [],
|
46
|
-
}
|
47
|
-
retvals = {
|
48
|
-
:SDL_GetVersion => :void,
|
49
|
-
:SDL_GetRevision => :pointer,
|
50
|
-
:SDL_GetRevisionNumber => :int,
|
51
|
-
}
|
52
|
-
symbols.each do |sym|
|
53
|
-
begin
|
54
|
-
attach_function sym, args[sym], retvals[sym]
|
55
|
-
rescue FFI::NotFoundError => error
|
56
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
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_MAJOR_VERSION = 2
|
14
|
+
SDL_MINOR_VERSION = 0
|
15
|
+
SDL_PATCHLEVEL = 14
|
16
|
+
|
17
|
+
# Enum
|
18
|
+
|
19
|
+
|
20
|
+
# Typedef
|
21
|
+
|
22
|
+
|
23
|
+
# Struct
|
24
|
+
|
25
|
+
class SDL_version < FFI::Struct
|
26
|
+
layout(
|
27
|
+
:major, :uchar,
|
28
|
+
:minor, :uchar,
|
29
|
+
:patch, :uchar,
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
# Function
|
35
|
+
|
36
|
+
def self.setup_version_symbols()
|
37
|
+
symbols = [
|
38
|
+
:SDL_GetVersion,
|
39
|
+
:SDL_GetRevision,
|
40
|
+
:SDL_GetRevisionNumber,
|
41
|
+
]
|
42
|
+
args = {
|
43
|
+
:SDL_GetVersion => [:pointer],
|
44
|
+
:SDL_GetRevision => [],
|
45
|
+
:SDL_GetRevisionNumber => [],
|
46
|
+
}
|
47
|
+
retvals = {
|
48
|
+
:SDL_GetVersion => :void,
|
49
|
+
:SDL_GetRevision => :pointer,
|
50
|
+
:SDL_GetRevisionNumber => :int,
|
51
|
+
}
|
52
|
+
symbols.each do |sym|
|
53
|
+
begin
|
54
|
+
attach_function sym, args[sym], retvals[sym]
|
55
|
+
rescue FFI::NotFoundError => error
|
56
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
data/lib/sdl2_video.rb
CHANGED
@@ -1,411 +1,411 @@
|
|
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_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000
|
14
|
-
SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000
|
15
|
-
|
16
|
-
# Enum
|
17
|
-
|
18
|
-
SDL_WINDOW_FULLSCREEN = 1
|
19
|
-
SDL_WINDOW_OPENGL = 2
|
20
|
-
SDL_WINDOW_SHOWN = 4
|
21
|
-
SDL_WINDOW_HIDDEN = 8
|
22
|
-
SDL_WINDOW_BORDERLESS = 16
|
23
|
-
SDL_WINDOW_RESIZABLE = 32
|
24
|
-
SDL_WINDOW_MINIMIZED = 64
|
25
|
-
SDL_WINDOW_MAXIMIZED = 128
|
26
|
-
SDL_WINDOW_INPUT_GRABBED = 256
|
27
|
-
SDL_WINDOW_INPUT_FOCUS = 512
|
28
|
-
SDL_WINDOW_MOUSE_FOCUS = 1024
|
29
|
-
SDL_WINDOW_FULLSCREEN_DESKTOP = 4097
|
30
|
-
SDL_WINDOW_FOREIGN = 2048
|
31
|
-
SDL_WINDOW_ALLOW_HIGHDPI = 8192
|
32
|
-
SDL_WINDOW_MOUSE_CAPTURE = 16384
|
33
|
-
SDL_WINDOW_ALWAYS_ON_TOP = 32768
|
34
|
-
SDL_WINDOW_SKIP_TASKBAR = 65536
|
35
|
-
SDL_WINDOW_UTILITY = 131072
|
36
|
-
SDL_WINDOW_TOOLTIP = 262144
|
37
|
-
SDL_WINDOW_POPUP_MENU = 524288
|
38
|
-
SDL_WINDOW_VULKAN = 268435456
|
39
|
-
SDL_WINDOW_METAL = 536870912
|
40
|
-
SDL_WINDOWEVENT_NONE = 0
|
41
|
-
SDL_WINDOWEVENT_SHOWN = 1
|
42
|
-
SDL_WINDOWEVENT_HIDDEN = 2
|
43
|
-
SDL_WINDOWEVENT_EXPOSED = 3
|
44
|
-
SDL_WINDOWEVENT_MOVED = 4
|
45
|
-
SDL_WINDOWEVENT_RESIZED = 5
|
46
|
-
SDL_WINDOWEVENT_SIZE_CHANGED = 6
|
47
|
-
SDL_WINDOWEVENT_MINIMIZED = 7
|
48
|
-
SDL_WINDOWEVENT_MAXIMIZED = 8
|
49
|
-
SDL_WINDOWEVENT_RESTORED = 9
|
50
|
-
SDL_WINDOWEVENT_ENTER = 10
|
51
|
-
SDL_WINDOWEVENT_LEAVE = 11
|
52
|
-
SDL_WINDOWEVENT_FOCUS_GAINED = 12
|
53
|
-
SDL_WINDOWEVENT_FOCUS_LOST = 13
|
54
|
-
SDL_WINDOWEVENT_CLOSE = 14
|
55
|
-
SDL_WINDOWEVENT_TAKE_FOCUS = 15
|
56
|
-
SDL_WINDOWEVENT_HIT_TEST = 16
|
57
|
-
SDL_DISPLAYEVENT_NONE = 0
|
58
|
-
SDL_DISPLAYEVENT_ORIENTATION = 1
|
59
|
-
SDL_DISPLAYEVENT_CONNECTED = 2
|
60
|
-
SDL_DISPLAYEVENT_DISCONNECTED = 3
|
61
|
-
SDL_ORIENTATION_UNKNOWN = 0
|
62
|
-
SDL_ORIENTATION_LANDSCAPE = 1
|
63
|
-
SDL_ORIENTATION_LANDSCAPE_FLIPPED = 2
|
64
|
-
SDL_ORIENTATION_PORTRAIT = 3
|
65
|
-
SDL_ORIENTATION_PORTRAIT_FLIPPED = 4
|
66
|
-
SDL_GL_RED_SIZE = 0
|
67
|
-
SDL_GL_GREEN_SIZE = 1
|
68
|
-
SDL_GL_BLUE_SIZE = 2
|
69
|
-
SDL_GL_ALPHA_SIZE = 3
|
70
|
-
SDL_GL_BUFFER_SIZE = 4
|
71
|
-
SDL_GL_DOUBLEBUFFER = 5
|
72
|
-
SDL_GL_DEPTH_SIZE = 6
|
73
|
-
SDL_GL_STENCIL_SIZE = 7
|
74
|
-
SDL_GL_ACCUM_RED_SIZE = 8
|
75
|
-
SDL_GL_ACCUM_GREEN_SIZE = 9
|
76
|
-
SDL_GL_ACCUM_BLUE_SIZE = 10
|
77
|
-
SDL_GL_ACCUM_ALPHA_SIZE = 11
|
78
|
-
SDL_GL_STEREO = 12
|
79
|
-
SDL_GL_MULTISAMPLEBUFFERS = 13
|
80
|
-
SDL_GL_MULTISAMPLESAMPLES = 14
|
81
|
-
SDL_GL_ACCELERATED_VISUAL = 15
|
82
|
-
SDL_GL_RETAINED_BACKING = 16
|
83
|
-
SDL_GL_CONTEXT_MAJOR_VERSION = 17
|
84
|
-
SDL_GL_CONTEXT_MINOR_VERSION = 18
|
85
|
-
SDL_GL_CONTEXT_EGL = 19
|
86
|
-
SDL_GL_CONTEXT_FLAGS = 20
|
87
|
-
SDL_GL_CONTEXT_PROFILE_MASK = 21
|
88
|
-
SDL_GL_SHARE_WITH_CURRENT_CONTEXT = 22
|
89
|
-
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = 23
|
90
|
-
SDL_GL_CONTEXT_RELEASE_BEHAVIOR = 24
|
91
|
-
SDL_GL_CONTEXT_RESET_NOTIFICATION = 25
|
92
|
-
SDL_GL_CONTEXT_NO_ERROR = 26
|
93
|
-
SDL_GL_CONTEXT_PROFILE_CORE = 1
|
94
|
-
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 2
|
95
|
-
SDL_GL_CONTEXT_PROFILE_ES = 4
|
96
|
-
SDL_GL_CONTEXT_DEBUG_FLAG = 1
|
97
|
-
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 2
|
98
|
-
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 4
|
99
|
-
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 8
|
100
|
-
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0
|
101
|
-
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 1
|
102
|
-
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0
|
103
|
-
SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 1
|
104
|
-
SDL_HITTEST_NORMAL = 0
|
105
|
-
SDL_HITTEST_DRAGGABLE = 1
|
106
|
-
SDL_HITTEST_RESIZE_TOPLEFT = 2
|
107
|
-
SDL_HITTEST_RESIZE_TOP = 3
|
108
|
-
SDL_HITTEST_RESIZE_TOPRIGHT = 4
|
109
|
-
SDL_HITTEST_RESIZE_RIGHT = 5
|
110
|
-
SDL_HITTEST_RESIZE_BOTTOMRIGHT = 6
|
111
|
-
SDL_HITTEST_RESIZE_BOTTOM = 7
|
112
|
-
SDL_HITTEST_RESIZE_BOTTOMLEFT = 8
|
113
|
-
SDL_HITTEST_RESIZE_LEFT = 9
|
114
|
-
|
115
|
-
# Typedef
|
116
|
-
|
117
|
-
typedef :int, :SDL_WindowFlags
|
118
|
-
typedef :int, :SDL_WindowEventID
|
119
|
-
typedef :int, :SDL_DisplayEventID
|
120
|
-
typedef :int, :SDL_DisplayOrientation
|
121
|
-
typedef :pointer, :SDL_GLContext
|
122
|
-
typedef :int, :SDL_GLattr
|
123
|
-
typedef :int, :SDL_GLprofile
|
124
|
-
typedef :int, :SDL_GLcontextFlag
|
125
|
-
typedef :int, :SDL_GLcontextReleaseFlag
|
126
|
-
typedef :int, :SDL_GLContextResetNotification
|
127
|
-
typedef :int, :SDL_HitTestResult
|
128
|
-
callback :SDL_HitTest, [:pointer, :pointer, :pointer], :int
|
129
|
-
|
130
|
-
# Struct
|
131
|
-
|
132
|
-
class SDL_DisplayMode < FFI::Struct
|
133
|
-
layout(
|
134
|
-
:format, :uint,
|
135
|
-
:w, :int,
|
136
|
-
:h, :int,
|
137
|
-
:refresh_rate, :int,
|
138
|
-
:driverdata, :pointer,
|
139
|
-
)
|
140
|
-
end
|
141
|
-
|
142
|
-
|
143
|
-
# Function
|
144
|
-
|
145
|
-
def self.setup_video_symbols()
|
146
|
-
symbols = [
|
147
|
-
:SDL_GetNumVideoDrivers,
|
148
|
-
:SDL_GetVideoDriver,
|
149
|
-
:SDL_VideoInit,
|
150
|
-
:SDL_VideoQuit,
|
151
|
-
:SDL_GetCurrentVideoDriver,
|
152
|
-
:SDL_GetNumVideoDisplays,
|
153
|
-
:SDL_GetDisplayName,
|
154
|
-
:SDL_GetDisplayBounds,
|
155
|
-
:SDL_GetDisplayUsableBounds,
|
156
|
-
:SDL_GetDisplayDPI,
|
157
|
-
:SDL_GetDisplayOrientation,
|
158
|
-
:SDL_GetNumDisplayModes,
|
159
|
-
:SDL_GetDisplayMode,
|
160
|
-
:SDL_GetDesktopDisplayMode,
|
161
|
-
:SDL_GetCurrentDisplayMode,
|
162
|
-
:SDL_GetClosestDisplayMode,
|
163
|
-
:SDL_GetWindowDisplayIndex,
|
164
|
-
:SDL_SetWindowDisplayMode,
|
165
|
-
:SDL_GetWindowDisplayMode,
|
166
|
-
:SDL_GetWindowPixelFormat,
|
167
|
-
:SDL_CreateWindow,
|
168
|
-
:SDL_CreateWindowFrom,
|
169
|
-
:SDL_GetWindowID,
|
170
|
-
:SDL_GetWindowFromID,
|
171
|
-
:SDL_GetWindowFlags,
|
172
|
-
:SDL_SetWindowTitle,
|
173
|
-
:SDL_GetWindowTitle,
|
174
|
-
:SDL_SetWindowIcon,
|
175
|
-
:SDL_SetWindowData,
|
176
|
-
:SDL_GetWindowData,
|
177
|
-
:SDL_SetWindowPosition,
|
178
|
-
:SDL_GetWindowPosition,
|
179
|
-
:SDL_SetWindowSize,
|
180
|
-
:SDL_GetWindowSize,
|
181
|
-
:SDL_GetWindowBordersSize,
|
182
|
-
:SDL_SetWindowMinimumSize,
|
183
|
-
:SDL_GetWindowMinimumSize,
|
184
|
-
:SDL_SetWindowMaximumSize,
|
185
|
-
:SDL_GetWindowMaximumSize,
|
186
|
-
:SDL_SetWindowBordered,
|
187
|
-
:SDL_SetWindowResizable,
|
188
|
-
:SDL_ShowWindow,
|
189
|
-
:SDL_HideWindow,
|
190
|
-
:SDL_RaiseWindow,
|
191
|
-
:SDL_MaximizeWindow,
|
192
|
-
:SDL_MinimizeWindow,
|
193
|
-
:SDL_RestoreWindow,
|
194
|
-
:SDL_SetWindowFullscreen,
|
195
|
-
:SDL_GetWindowSurface,
|
196
|
-
:SDL_UpdateWindowSurface,
|
197
|
-
:SDL_UpdateWindowSurfaceRects,
|
198
|
-
:SDL_SetWindowGrab,
|
199
|
-
:SDL_GetWindowGrab,
|
200
|
-
:SDL_GetGrabbedWindow,
|
201
|
-
:SDL_SetWindowBrightness,
|
202
|
-
:SDL_GetWindowBrightness,
|
203
|
-
:SDL_SetWindowOpacity,
|
204
|
-
:SDL_GetWindowOpacity,
|
205
|
-
:SDL_SetWindowModalFor,
|
206
|
-
:SDL_SetWindowInputFocus,
|
207
|
-
:SDL_SetWindowGammaRamp,
|
208
|
-
:SDL_GetWindowGammaRamp,
|
209
|
-
:SDL_SetWindowHitTest,
|
210
|
-
:SDL_DestroyWindow,
|
211
|
-
:SDL_IsScreenSaverEnabled,
|
212
|
-
:SDL_EnableScreenSaver,
|
213
|
-
:SDL_DisableScreenSaver,
|
214
|
-
:SDL_GL_LoadLibrary,
|
215
|
-
:SDL_GL_GetProcAddress,
|
216
|
-
:SDL_GL_UnloadLibrary,
|
217
|
-
:SDL_GL_ExtensionSupported,
|
218
|
-
:SDL_GL_ResetAttributes,
|
219
|
-
:SDL_GL_SetAttribute,
|
220
|
-
:SDL_GL_GetAttribute,
|
221
|
-
:SDL_GL_CreateContext,
|
222
|
-
:SDL_GL_MakeCurrent,
|
223
|
-
:SDL_GL_GetCurrentWindow,
|
224
|
-
:SDL_GL_GetCurrentContext,
|
225
|
-
:SDL_GL_GetDrawableSize,
|
226
|
-
:SDL_GL_SetSwapInterval,
|
227
|
-
:SDL_GL_GetSwapInterval,
|
228
|
-
:SDL_GL_SwapWindow,
|
229
|
-
:SDL_GL_DeleteContext,
|
230
|
-
]
|
231
|
-
args = {
|
232
|
-
:SDL_GetNumVideoDrivers => [],
|
233
|
-
:SDL_GetVideoDriver => [:int],
|
234
|
-
:SDL_VideoInit => [:pointer],
|
235
|
-
:SDL_VideoQuit => [],
|
236
|
-
:SDL_GetCurrentVideoDriver => [],
|
237
|
-
:SDL_GetNumVideoDisplays => [],
|
238
|
-
:SDL_GetDisplayName => [:int],
|
239
|
-
:SDL_GetDisplayBounds => [:int, :pointer],
|
240
|
-
:SDL_GetDisplayUsableBounds => [:int, :pointer],
|
241
|
-
:SDL_GetDisplayDPI => [:int, :pointer, :pointer, :pointer],
|
242
|
-
:SDL_GetDisplayOrientation => [:int],
|
243
|
-
:SDL_GetNumDisplayModes => [:int],
|
244
|
-
:SDL_GetDisplayMode => [:int, :int, :pointer],
|
245
|
-
:SDL_GetDesktopDisplayMode => [:int, :pointer],
|
246
|
-
:SDL_GetCurrentDisplayMode => [:int, :pointer],
|
247
|
-
:SDL_GetClosestDisplayMode => [:int, :pointer, :pointer],
|
248
|
-
:SDL_GetWindowDisplayIndex => [:pointer],
|
249
|
-
:SDL_SetWindowDisplayMode => [:pointer, :pointer],
|
250
|
-
:SDL_GetWindowDisplayMode => [:pointer, :pointer],
|
251
|
-
:SDL_GetWindowPixelFormat => [:pointer],
|
252
|
-
:SDL_CreateWindow => [:pointer, :int, :int, :int, :int, :uint],
|
253
|
-
:SDL_CreateWindowFrom => [:pointer],
|
254
|
-
:SDL_GetWindowID => [:pointer],
|
255
|
-
:SDL_GetWindowFromID => [:uint],
|
256
|
-
:SDL_GetWindowFlags => [:pointer],
|
257
|
-
:SDL_SetWindowTitle => [:pointer, :pointer],
|
258
|
-
:SDL_GetWindowTitle => [:pointer],
|
259
|
-
:SDL_SetWindowIcon => [:pointer, :pointer],
|
260
|
-
:SDL_SetWindowData => [:pointer, :pointer, :pointer],
|
261
|
-
:SDL_GetWindowData => [:pointer, :pointer],
|
262
|
-
:SDL_SetWindowPosition => [:pointer, :int, :int],
|
263
|
-
:SDL_GetWindowPosition => [:pointer, :pointer, :pointer],
|
264
|
-
:SDL_SetWindowSize => [:pointer, :int, :int],
|
265
|
-
:SDL_GetWindowSize => [:pointer, :pointer, :pointer],
|
266
|
-
:SDL_GetWindowBordersSize => [:pointer, :pointer, :pointer, :pointer, :pointer],
|
267
|
-
:SDL_SetWindowMinimumSize => [:pointer, :int, :int],
|
268
|
-
:SDL_GetWindowMinimumSize => [:pointer, :pointer, :pointer],
|
269
|
-
:SDL_SetWindowMaximumSize => [:pointer, :int, :int],
|
270
|
-
:SDL_GetWindowMaximumSize => [:pointer, :pointer, :pointer],
|
271
|
-
:SDL_SetWindowBordered => [:pointer, :int],
|
272
|
-
:SDL_SetWindowResizable => [:pointer, :int],
|
273
|
-
:SDL_ShowWindow => [:pointer],
|
274
|
-
:SDL_HideWindow => [:pointer],
|
275
|
-
:SDL_RaiseWindow => [:pointer],
|
276
|
-
:SDL_MaximizeWindow => [:pointer],
|
277
|
-
:SDL_MinimizeWindow => [:pointer],
|
278
|
-
:SDL_RestoreWindow => [:pointer],
|
279
|
-
:SDL_SetWindowFullscreen => [:pointer, :uint],
|
280
|
-
:SDL_GetWindowSurface => [:pointer],
|
281
|
-
:SDL_UpdateWindowSurface => [:pointer],
|
282
|
-
:SDL_UpdateWindowSurfaceRects => [:pointer, :pointer, :int],
|
283
|
-
:SDL_SetWindowGrab => [:pointer, :int],
|
284
|
-
:SDL_GetWindowGrab => [:pointer],
|
285
|
-
:SDL_GetGrabbedWindow => [],
|
286
|
-
:SDL_SetWindowBrightness => [:pointer, :float],
|
287
|
-
:SDL_GetWindowBrightness => [:pointer],
|
288
|
-
:SDL_SetWindowOpacity => [:pointer, :float],
|
289
|
-
:SDL_GetWindowOpacity => [:pointer, :pointer],
|
290
|
-
:SDL_SetWindowModalFor => [:pointer, :pointer],
|
291
|
-
:SDL_SetWindowInputFocus => [:pointer],
|
292
|
-
:SDL_SetWindowGammaRamp => [:pointer, :pointer, :pointer, :pointer],
|
293
|
-
:SDL_GetWindowGammaRamp => [:pointer, :pointer, :pointer, :pointer],
|
294
|
-
:SDL_SetWindowHitTest => [:pointer, :SDL_HitTest, :pointer],
|
295
|
-
:SDL_DestroyWindow => [:pointer],
|
296
|
-
:SDL_IsScreenSaverEnabled => [],
|
297
|
-
:SDL_EnableScreenSaver => [],
|
298
|
-
:SDL_DisableScreenSaver => [],
|
299
|
-
:SDL_GL_LoadLibrary => [:pointer],
|
300
|
-
:SDL_GL_GetProcAddress => [:pointer],
|
301
|
-
:SDL_GL_UnloadLibrary => [],
|
302
|
-
:SDL_GL_ExtensionSupported => [:pointer],
|
303
|
-
:SDL_GL_ResetAttributes => [],
|
304
|
-
:SDL_GL_SetAttribute => [:int, :int],
|
305
|
-
:SDL_GL_GetAttribute => [:int, :pointer],
|
306
|
-
:SDL_GL_CreateContext => [:pointer],
|
307
|
-
:SDL_GL_MakeCurrent => [:pointer, :pointer],
|
308
|
-
:SDL_GL_GetCurrentWindow => [],
|
309
|
-
:SDL_GL_GetCurrentContext => [],
|
310
|
-
:SDL_GL_GetDrawableSize => [:pointer, :pointer, :pointer],
|
311
|
-
:SDL_GL_SetSwapInterval => [:int],
|
312
|
-
:SDL_GL_GetSwapInterval => [],
|
313
|
-
:SDL_GL_SwapWindow => [:pointer],
|
314
|
-
:SDL_GL_DeleteContext => [:pointer],
|
315
|
-
}
|
316
|
-
retvals = {
|
317
|
-
:SDL_GetNumVideoDrivers => :int,
|
318
|
-
:SDL_GetVideoDriver => :pointer,
|
319
|
-
:SDL_VideoInit => :int,
|
320
|
-
:SDL_VideoQuit => :void,
|
321
|
-
:SDL_GetCurrentVideoDriver => :pointer,
|
322
|
-
:SDL_GetNumVideoDisplays => :int,
|
323
|
-
:SDL_GetDisplayName => :pointer,
|
324
|
-
:SDL_GetDisplayBounds => :int,
|
325
|
-
:SDL_GetDisplayUsableBounds => :int,
|
326
|
-
:SDL_GetDisplayDPI => :int,
|
327
|
-
:SDL_GetDisplayOrientation => :int,
|
328
|
-
:SDL_GetNumDisplayModes => :int,
|
329
|
-
:SDL_GetDisplayMode => :int,
|
330
|
-
:SDL_GetDesktopDisplayMode => :int,
|
331
|
-
:SDL_GetCurrentDisplayMode => :int,
|
332
|
-
:SDL_GetClosestDisplayMode => :pointer,
|
333
|
-
:SDL_GetWindowDisplayIndex => :int,
|
334
|
-
:SDL_SetWindowDisplayMode => :int,
|
335
|
-
:SDL_GetWindowDisplayMode => :int,
|
336
|
-
:SDL_GetWindowPixelFormat => :uint,
|
337
|
-
:SDL_CreateWindow => :pointer,
|
338
|
-
:SDL_CreateWindowFrom => :pointer,
|
339
|
-
:SDL_GetWindowID => :uint,
|
340
|
-
:SDL_GetWindowFromID => :pointer,
|
341
|
-
:SDL_GetWindowFlags => :uint,
|
342
|
-
:SDL_SetWindowTitle => :void,
|
343
|
-
:SDL_GetWindowTitle => :pointer,
|
344
|
-
:SDL_SetWindowIcon => :void,
|
345
|
-
:SDL_SetWindowData => :pointer,
|
346
|
-
:SDL_GetWindowData => :pointer,
|
347
|
-
:SDL_SetWindowPosition => :void,
|
348
|
-
:SDL_GetWindowPosition => :void,
|
349
|
-
:SDL_SetWindowSize => :void,
|
350
|
-
:SDL_GetWindowSize => :void,
|
351
|
-
:SDL_GetWindowBordersSize => :int,
|
352
|
-
:SDL_SetWindowMinimumSize => :void,
|
353
|
-
:SDL_GetWindowMinimumSize => :void,
|
354
|
-
:SDL_SetWindowMaximumSize => :void,
|
355
|
-
:SDL_GetWindowMaximumSize => :void,
|
356
|
-
:SDL_SetWindowBordered => :void,
|
357
|
-
:SDL_SetWindowResizable => :void,
|
358
|
-
:SDL_ShowWindow => :void,
|
359
|
-
:SDL_HideWindow => :void,
|
360
|
-
:SDL_RaiseWindow => :void,
|
361
|
-
:SDL_MaximizeWindow => :void,
|
362
|
-
:SDL_MinimizeWindow => :void,
|
363
|
-
:SDL_RestoreWindow => :void,
|
364
|
-
:SDL_SetWindowFullscreen => :int,
|
365
|
-
:SDL_GetWindowSurface => :pointer,
|
366
|
-
:SDL_UpdateWindowSurface => :int,
|
367
|
-
:SDL_UpdateWindowSurfaceRects => :int,
|
368
|
-
:SDL_SetWindowGrab => :void,
|
369
|
-
:SDL_GetWindowGrab => :int,
|
370
|
-
:SDL_GetGrabbedWindow => :pointer,
|
371
|
-
:SDL_SetWindowBrightness => :int,
|
372
|
-
:SDL_GetWindowBrightness => :float,
|
373
|
-
:SDL_SetWindowOpacity => :int,
|
374
|
-
:SDL_GetWindowOpacity => :int,
|
375
|
-
:SDL_SetWindowModalFor => :int,
|
376
|
-
:SDL_SetWindowInputFocus => :int,
|
377
|
-
:SDL_SetWindowGammaRamp => :int,
|
378
|
-
:SDL_GetWindowGammaRamp => :int,
|
379
|
-
:SDL_SetWindowHitTest => :int,
|
380
|
-
:SDL_DestroyWindow => :void,
|
381
|
-
:SDL_IsScreenSaverEnabled => :int,
|
382
|
-
:SDL_EnableScreenSaver => :void,
|
383
|
-
:SDL_DisableScreenSaver => :void,
|
384
|
-
:SDL_GL_LoadLibrary => :int,
|
385
|
-
:SDL_GL_GetProcAddress => :pointer,
|
386
|
-
:SDL_GL_UnloadLibrary => :void,
|
387
|
-
:SDL_GL_ExtensionSupported => :int,
|
388
|
-
:SDL_GL_ResetAttributes => :void,
|
389
|
-
:SDL_GL_SetAttribute => :int,
|
390
|
-
:SDL_GL_GetAttribute => :int,
|
391
|
-
:SDL_GL_CreateContext => :pointer,
|
392
|
-
:SDL_GL_MakeCurrent => :int,
|
393
|
-
:SDL_GL_GetCurrentWindow => :pointer,
|
394
|
-
:SDL_GL_GetCurrentContext => :pointer,
|
395
|
-
:SDL_GL_GetDrawableSize => :void,
|
396
|
-
:SDL_GL_SetSwapInterval => :int,
|
397
|
-
:SDL_GL_GetSwapInterval => :int,
|
398
|
-
:SDL_GL_SwapWindow => :void,
|
399
|
-
:SDL_GL_DeleteContext => :void,
|
400
|
-
}
|
401
|
-
symbols.each do |sym|
|
402
|
-
begin
|
403
|
-
attach_function sym, args[sym], retvals[sym]
|
404
|
-
rescue FFI::NotFoundError => error
|
405
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
406
|
-
end
|
407
|
-
end
|
408
|
-
end
|
409
|
-
|
410
|
-
end
|
411
|
-
|
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_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000
|
14
|
+
SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000
|
15
|
+
|
16
|
+
# Enum
|
17
|
+
|
18
|
+
SDL_WINDOW_FULLSCREEN = 1
|
19
|
+
SDL_WINDOW_OPENGL = 2
|
20
|
+
SDL_WINDOW_SHOWN = 4
|
21
|
+
SDL_WINDOW_HIDDEN = 8
|
22
|
+
SDL_WINDOW_BORDERLESS = 16
|
23
|
+
SDL_WINDOW_RESIZABLE = 32
|
24
|
+
SDL_WINDOW_MINIMIZED = 64
|
25
|
+
SDL_WINDOW_MAXIMIZED = 128
|
26
|
+
SDL_WINDOW_INPUT_GRABBED = 256
|
27
|
+
SDL_WINDOW_INPUT_FOCUS = 512
|
28
|
+
SDL_WINDOW_MOUSE_FOCUS = 1024
|
29
|
+
SDL_WINDOW_FULLSCREEN_DESKTOP = 4097
|
30
|
+
SDL_WINDOW_FOREIGN = 2048
|
31
|
+
SDL_WINDOW_ALLOW_HIGHDPI = 8192
|
32
|
+
SDL_WINDOW_MOUSE_CAPTURE = 16384
|
33
|
+
SDL_WINDOW_ALWAYS_ON_TOP = 32768
|
34
|
+
SDL_WINDOW_SKIP_TASKBAR = 65536
|
35
|
+
SDL_WINDOW_UTILITY = 131072
|
36
|
+
SDL_WINDOW_TOOLTIP = 262144
|
37
|
+
SDL_WINDOW_POPUP_MENU = 524288
|
38
|
+
SDL_WINDOW_VULKAN = 268435456
|
39
|
+
SDL_WINDOW_METAL = 536870912
|
40
|
+
SDL_WINDOWEVENT_NONE = 0
|
41
|
+
SDL_WINDOWEVENT_SHOWN = 1
|
42
|
+
SDL_WINDOWEVENT_HIDDEN = 2
|
43
|
+
SDL_WINDOWEVENT_EXPOSED = 3
|
44
|
+
SDL_WINDOWEVENT_MOVED = 4
|
45
|
+
SDL_WINDOWEVENT_RESIZED = 5
|
46
|
+
SDL_WINDOWEVENT_SIZE_CHANGED = 6
|
47
|
+
SDL_WINDOWEVENT_MINIMIZED = 7
|
48
|
+
SDL_WINDOWEVENT_MAXIMIZED = 8
|
49
|
+
SDL_WINDOWEVENT_RESTORED = 9
|
50
|
+
SDL_WINDOWEVENT_ENTER = 10
|
51
|
+
SDL_WINDOWEVENT_LEAVE = 11
|
52
|
+
SDL_WINDOWEVENT_FOCUS_GAINED = 12
|
53
|
+
SDL_WINDOWEVENT_FOCUS_LOST = 13
|
54
|
+
SDL_WINDOWEVENT_CLOSE = 14
|
55
|
+
SDL_WINDOWEVENT_TAKE_FOCUS = 15
|
56
|
+
SDL_WINDOWEVENT_HIT_TEST = 16
|
57
|
+
SDL_DISPLAYEVENT_NONE = 0
|
58
|
+
SDL_DISPLAYEVENT_ORIENTATION = 1
|
59
|
+
SDL_DISPLAYEVENT_CONNECTED = 2
|
60
|
+
SDL_DISPLAYEVENT_DISCONNECTED = 3
|
61
|
+
SDL_ORIENTATION_UNKNOWN = 0
|
62
|
+
SDL_ORIENTATION_LANDSCAPE = 1
|
63
|
+
SDL_ORIENTATION_LANDSCAPE_FLIPPED = 2
|
64
|
+
SDL_ORIENTATION_PORTRAIT = 3
|
65
|
+
SDL_ORIENTATION_PORTRAIT_FLIPPED = 4
|
66
|
+
SDL_GL_RED_SIZE = 0
|
67
|
+
SDL_GL_GREEN_SIZE = 1
|
68
|
+
SDL_GL_BLUE_SIZE = 2
|
69
|
+
SDL_GL_ALPHA_SIZE = 3
|
70
|
+
SDL_GL_BUFFER_SIZE = 4
|
71
|
+
SDL_GL_DOUBLEBUFFER = 5
|
72
|
+
SDL_GL_DEPTH_SIZE = 6
|
73
|
+
SDL_GL_STENCIL_SIZE = 7
|
74
|
+
SDL_GL_ACCUM_RED_SIZE = 8
|
75
|
+
SDL_GL_ACCUM_GREEN_SIZE = 9
|
76
|
+
SDL_GL_ACCUM_BLUE_SIZE = 10
|
77
|
+
SDL_GL_ACCUM_ALPHA_SIZE = 11
|
78
|
+
SDL_GL_STEREO = 12
|
79
|
+
SDL_GL_MULTISAMPLEBUFFERS = 13
|
80
|
+
SDL_GL_MULTISAMPLESAMPLES = 14
|
81
|
+
SDL_GL_ACCELERATED_VISUAL = 15
|
82
|
+
SDL_GL_RETAINED_BACKING = 16
|
83
|
+
SDL_GL_CONTEXT_MAJOR_VERSION = 17
|
84
|
+
SDL_GL_CONTEXT_MINOR_VERSION = 18
|
85
|
+
SDL_GL_CONTEXT_EGL = 19
|
86
|
+
SDL_GL_CONTEXT_FLAGS = 20
|
87
|
+
SDL_GL_CONTEXT_PROFILE_MASK = 21
|
88
|
+
SDL_GL_SHARE_WITH_CURRENT_CONTEXT = 22
|
89
|
+
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = 23
|
90
|
+
SDL_GL_CONTEXT_RELEASE_BEHAVIOR = 24
|
91
|
+
SDL_GL_CONTEXT_RESET_NOTIFICATION = 25
|
92
|
+
SDL_GL_CONTEXT_NO_ERROR = 26
|
93
|
+
SDL_GL_CONTEXT_PROFILE_CORE = 1
|
94
|
+
SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 2
|
95
|
+
SDL_GL_CONTEXT_PROFILE_ES = 4
|
96
|
+
SDL_GL_CONTEXT_DEBUG_FLAG = 1
|
97
|
+
SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 2
|
98
|
+
SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 4
|
99
|
+
SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 8
|
100
|
+
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0
|
101
|
+
SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 1
|
102
|
+
SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0
|
103
|
+
SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 1
|
104
|
+
SDL_HITTEST_NORMAL = 0
|
105
|
+
SDL_HITTEST_DRAGGABLE = 1
|
106
|
+
SDL_HITTEST_RESIZE_TOPLEFT = 2
|
107
|
+
SDL_HITTEST_RESIZE_TOP = 3
|
108
|
+
SDL_HITTEST_RESIZE_TOPRIGHT = 4
|
109
|
+
SDL_HITTEST_RESIZE_RIGHT = 5
|
110
|
+
SDL_HITTEST_RESIZE_BOTTOMRIGHT = 6
|
111
|
+
SDL_HITTEST_RESIZE_BOTTOM = 7
|
112
|
+
SDL_HITTEST_RESIZE_BOTTOMLEFT = 8
|
113
|
+
SDL_HITTEST_RESIZE_LEFT = 9
|
114
|
+
|
115
|
+
# Typedef
|
116
|
+
|
117
|
+
typedef :int, :SDL_WindowFlags
|
118
|
+
typedef :int, :SDL_WindowEventID
|
119
|
+
typedef :int, :SDL_DisplayEventID
|
120
|
+
typedef :int, :SDL_DisplayOrientation
|
121
|
+
typedef :pointer, :SDL_GLContext
|
122
|
+
typedef :int, :SDL_GLattr
|
123
|
+
typedef :int, :SDL_GLprofile
|
124
|
+
typedef :int, :SDL_GLcontextFlag
|
125
|
+
typedef :int, :SDL_GLcontextReleaseFlag
|
126
|
+
typedef :int, :SDL_GLContextResetNotification
|
127
|
+
typedef :int, :SDL_HitTestResult
|
128
|
+
callback :SDL_HitTest, [:pointer, :pointer, :pointer], :int
|
129
|
+
|
130
|
+
# Struct
|
131
|
+
|
132
|
+
class SDL_DisplayMode < FFI::Struct
|
133
|
+
layout(
|
134
|
+
:format, :uint,
|
135
|
+
:w, :int,
|
136
|
+
:h, :int,
|
137
|
+
:refresh_rate, :int,
|
138
|
+
:driverdata, :pointer,
|
139
|
+
)
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
# Function
|
144
|
+
|
145
|
+
def self.setup_video_symbols()
|
146
|
+
symbols = [
|
147
|
+
:SDL_GetNumVideoDrivers,
|
148
|
+
:SDL_GetVideoDriver,
|
149
|
+
:SDL_VideoInit,
|
150
|
+
:SDL_VideoQuit,
|
151
|
+
:SDL_GetCurrentVideoDriver,
|
152
|
+
:SDL_GetNumVideoDisplays,
|
153
|
+
:SDL_GetDisplayName,
|
154
|
+
:SDL_GetDisplayBounds,
|
155
|
+
:SDL_GetDisplayUsableBounds,
|
156
|
+
:SDL_GetDisplayDPI,
|
157
|
+
:SDL_GetDisplayOrientation,
|
158
|
+
:SDL_GetNumDisplayModes,
|
159
|
+
:SDL_GetDisplayMode,
|
160
|
+
:SDL_GetDesktopDisplayMode,
|
161
|
+
:SDL_GetCurrentDisplayMode,
|
162
|
+
:SDL_GetClosestDisplayMode,
|
163
|
+
:SDL_GetWindowDisplayIndex,
|
164
|
+
:SDL_SetWindowDisplayMode,
|
165
|
+
:SDL_GetWindowDisplayMode,
|
166
|
+
:SDL_GetWindowPixelFormat,
|
167
|
+
:SDL_CreateWindow,
|
168
|
+
:SDL_CreateWindowFrom,
|
169
|
+
:SDL_GetWindowID,
|
170
|
+
:SDL_GetWindowFromID,
|
171
|
+
:SDL_GetWindowFlags,
|
172
|
+
:SDL_SetWindowTitle,
|
173
|
+
:SDL_GetWindowTitle,
|
174
|
+
:SDL_SetWindowIcon,
|
175
|
+
:SDL_SetWindowData,
|
176
|
+
:SDL_GetWindowData,
|
177
|
+
:SDL_SetWindowPosition,
|
178
|
+
:SDL_GetWindowPosition,
|
179
|
+
:SDL_SetWindowSize,
|
180
|
+
:SDL_GetWindowSize,
|
181
|
+
:SDL_GetWindowBordersSize,
|
182
|
+
:SDL_SetWindowMinimumSize,
|
183
|
+
:SDL_GetWindowMinimumSize,
|
184
|
+
:SDL_SetWindowMaximumSize,
|
185
|
+
:SDL_GetWindowMaximumSize,
|
186
|
+
:SDL_SetWindowBordered,
|
187
|
+
:SDL_SetWindowResizable,
|
188
|
+
:SDL_ShowWindow,
|
189
|
+
:SDL_HideWindow,
|
190
|
+
:SDL_RaiseWindow,
|
191
|
+
:SDL_MaximizeWindow,
|
192
|
+
:SDL_MinimizeWindow,
|
193
|
+
:SDL_RestoreWindow,
|
194
|
+
:SDL_SetWindowFullscreen,
|
195
|
+
:SDL_GetWindowSurface,
|
196
|
+
:SDL_UpdateWindowSurface,
|
197
|
+
:SDL_UpdateWindowSurfaceRects,
|
198
|
+
:SDL_SetWindowGrab,
|
199
|
+
:SDL_GetWindowGrab,
|
200
|
+
:SDL_GetGrabbedWindow,
|
201
|
+
:SDL_SetWindowBrightness,
|
202
|
+
:SDL_GetWindowBrightness,
|
203
|
+
:SDL_SetWindowOpacity,
|
204
|
+
:SDL_GetWindowOpacity,
|
205
|
+
:SDL_SetWindowModalFor,
|
206
|
+
:SDL_SetWindowInputFocus,
|
207
|
+
:SDL_SetWindowGammaRamp,
|
208
|
+
:SDL_GetWindowGammaRamp,
|
209
|
+
:SDL_SetWindowHitTest,
|
210
|
+
:SDL_DestroyWindow,
|
211
|
+
:SDL_IsScreenSaverEnabled,
|
212
|
+
:SDL_EnableScreenSaver,
|
213
|
+
:SDL_DisableScreenSaver,
|
214
|
+
:SDL_GL_LoadLibrary,
|
215
|
+
:SDL_GL_GetProcAddress,
|
216
|
+
:SDL_GL_UnloadLibrary,
|
217
|
+
:SDL_GL_ExtensionSupported,
|
218
|
+
:SDL_GL_ResetAttributes,
|
219
|
+
:SDL_GL_SetAttribute,
|
220
|
+
:SDL_GL_GetAttribute,
|
221
|
+
:SDL_GL_CreateContext,
|
222
|
+
:SDL_GL_MakeCurrent,
|
223
|
+
:SDL_GL_GetCurrentWindow,
|
224
|
+
:SDL_GL_GetCurrentContext,
|
225
|
+
:SDL_GL_GetDrawableSize,
|
226
|
+
:SDL_GL_SetSwapInterval,
|
227
|
+
:SDL_GL_GetSwapInterval,
|
228
|
+
:SDL_GL_SwapWindow,
|
229
|
+
:SDL_GL_DeleteContext,
|
230
|
+
]
|
231
|
+
args = {
|
232
|
+
:SDL_GetNumVideoDrivers => [],
|
233
|
+
:SDL_GetVideoDriver => [:int],
|
234
|
+
:SDL_VideoInit => [:pointer],
|
235
|
+
:SDL_VideoQuit => [],
|
236
|
+
:SDL_GetCurrentVideoDriver => [],
|
237
|
+
:SDL_GetNumVideoDisplays => [],
|
238
|
+
:SDL_GetDisplayName => [:int],
|
239
|
+
:SDL_GetDisplayBounds => [:int, :pointer],
|
240
|
+
:SDL_GetDisplayUsableBounds => [:int, :pointer],
|
241
|
+
:SDL_GetDisplayDPI => [:int, :pointer, :pointer, :pointer],
|
242
|
+
:SDL_GetDisplayOrientation => [:int],
|
243
|
+
:SDL_GetNumDisplayModes => [:int],
|
244
|
+
:SDL_GetDisplayMode => [:int, :int, :pointer],
|
245
|
+
:SDL_GetDesktopDisplayMode => [:int, :pointer],
|
246
|
+
:SDL_GetCurrentDisplayMode => [:int, :pointer],
|
247
|
+
:SDL_GetClosestDisplayMode => [:int, :pointer, :pointer],
|
248
|
+
:SDL_GetWindowDisplayIndex => [:pointer],
|
249
|
+
:SDL_SetWindowDisplayMode => [:pointer, :pointer],
|
250
|
+
:SDL_GetWindowDisplayMode => [:pointer, :pointer],
|
251
|
+
:SDL_GetWindowPixelFormat => [:pointer],
|
252
|
+
:SDL_CreateWindow => [:pointer, :int, :int, :int, :int, :uint],
|
253
|
+
:SDL_CreateWindowFrom => [:pointer],
|
254
|
+
:SDL_GetWindowID => [:pointer],
|
255
|
+
:SDL_GetWindowFromID => [:uint],
|
256
|
+
:SDL_GetWindowFlags => [:pointer],
|
257
|
+
:SDL_SetWindowTitle => [:pointer, :pointer],
|
258
|
+
:SDL_GetWindowTitle => [:pointer],
|
259
|
+
:SDL_SetWindowIcon => [:pointer, :pointer],
|
260
|
+
:SDL_SetWindowData => [:pointer, :pointer, :pointer],
|
261
|
+
:SDL_GetWindowData => [:pointer, :pointer],
|
262
|
+
:SDL_SetWindowPosition => [:pointer, :int, :int],
|
263
|
+
:SDL_GetWindowPosition => [:pointer, :pointer, :pointer],
|
264
|
+
:SDL_SetWindowSize => [:pointer, :int, :int],
|
265
|
+
:SDL_GetWindowSize => [:pointer, :pointer, :pointer],
|
266
|
+
:SDL_GetWindowBordersSize => [:pointer, :pointer, :pointer, :pointer, :pointer],
|
267
|
+
:SDL_SetWindowMinimumSize => [:pointer, :int, :int],
|
268
|
+
:SDL_GetWindowMinimumSize => [:pointer, :pointer, :pointer],
|
269
|
+
:SDL_SetWindowMaximumSize => [:pointer, :int, :int],
|
270
|
+
:SDL_GetWindowMaximumSize => [:pointer, :pointer, :pointer],
|
271
|
+
:SDL_SetWindowBordered => [:pointer, :int],
|
272
|
+
:SDL_SetWindowResizable => [:pointer, :int],
|
273
|
+
:SDL_ShowWindow => [:pointer],
|
274
|
+
:SDL_HideWindow => [:pointer],
|
275
|
+
:SDL_RaiseWindow => [:pointer],
|
276
|
+
:SDL_MaximizeWindow => [:pointer],
|
277
|
+
:SDL_MinimizeWindow => [:pointer],
|
278
|
+
:SDL_RestoreWindow => [:pointer],
|
279
|
+
:SDL_SetWindowFullscreen => [:pointer, :uint],
|
280
|
+
:SDL_GetWindowSurface => [:pointer],
|
281
|
+
:SDL_UpdateWindowSurface => [:pointer],
|
282
|
+
:SDL_UpdateWindowSurfaceRects => [:pointer, :pointer, :int],
|
283
|
+
:SDL_SetWindowGrab => [:pointer, :int],
|
284
|
+
:SDL_GetWindowGrab => [:pointer],
|
285
|
+
:SDL_GetGrabbedWindow => [],
|
286
|
+
:SDL_SetWindowBrightness => [:pointer, :float],
|
287
|
+
:SDL_GetWindowBrightness => [:pointer],
|
288
|
+
:SDL_SetWindowOpacity => [:pointer, :float],
|
289
|
+
:SDL_GetWindowOpacity => [:pointer, :pointer],
|
290
|
+
:SDL_SetWindowModalFor => [:pointer, :pointer],
|
291
|
+
:SDL_SetWindowInputFocus => [:pointer],
|
292
|
+
:SDL_SetWindowGammaRamp => [:pointer, :pointer, :pointer, :pointer],
|
293
|
+
:SDL_GetWindowGammaRamp => [:pointer, :pointer, :pointer, :pointer],
|
294
|
+
:SDL_SetWindowHitTest => [:pointer, :SDL_HitTest, :pointer],
|
295
|
+
:SDL_DestroyWindow => [:pointer],
|
296
|
+
:SDL_IsScreenSaverEnabled => [],
|
297
|
+
:SDL_EnableScreenSaver => [],
|
298
|
+
:SDL_DisableScreenSaver => [],
|
299
|
+
:SDL_GL_LoadLibrary => [:pointer],
|
300
|
+
:SDL_GL_GetProcAddress => [:pointer],
|
301
|
+
:SDL_GL_UnloadLibrary => [],
|
302
|
+
:SDL_GL_ExtensionSupported => [:pointer],
|
303
|
+
:SDL_GL_ResetAttributes => [],
|
304
|
+
:SDL_GL_SetAttribute => [:int, :int],
|
305
|
+
:SDL_GL_GetAttribute => [:int, :pointer],
|
306
|
+
:SDL_GL_CreateContext => [:pointer],
|
307
|
+
:SDL_GL_MakeCurrent => [:pointer, :pointer],
|
308
|
+
:SDL_GL_GetCurrentWindow => [],
|
309
|
+
:SDL_GL_GetCurrentContext => [],
|
310
|
+
:SDL_GL_GetDrawableSize => [:pointer, :pointer, :pointer],
|
311
|
+
:SDL_GL_SetSwapInterval => [:int],
|
312
|
+
:SDL_GL_GetSwapInterval => [],
|
313
|
+
:SDL_GL_SwapWindow => [:pointer],
|
314
|
+
:SDL_GL_DeleteContext => [:pointer],
|
315
|
+
}
|
316
|
+
retvals = {
|
317
|
+
:SDL_GetNumVideoDrivers => :int,
|
318
|
+
:SDL_GetVideoDriver => :pointer,
|
319
|
+
:SDL_VideoInit => :int,
|
320
|
+
:SDL_VideoQuit => :void,
|
321
|
+
:SDL_GetCurrentVideoDriver => :pointer,
|
322
|
+
:SDL_GetNumVideoDisplays => :int,
|
323
|
+
:SDL_GetDisplayName => :pointer,
|
324
|
+
:SDL_GetDisplayBounds => :int,
|
325
|
+
:SDL_GetDisplayUsableBounds => :int,
|
326
|
+
:SDL_GetDisplayDPI => :int,
|
327
|
+
:SDL_GetDisplayOrientation => :int,
|
328
|
+
:SDL_GetNumDisplayModes => :int,
|
329
|
+
:SDL_GetDisplayMode => :int,
|
330
|
+
:SDL_GetDesktopDisplayMode => :int,
|
331
|
+
:SDL_GetCurrentDisplayMode => :int,
|
332
|
+
:SDL_GetClosestDisplayMode => :pointer,
|
333
|
+
:SDL_GetWindowDisplayIndex => :int,
|
334
|
+
:SDL_SetWindowDisplayMode => :int,
|
335
|
+
:SDL_GetWindowDisplayMode => :int,
|
336
|
+
:SDL_GetWindowPixelFormat => :uint,
|
337
|
+
:SDL_CreateWindow => :pointer,
|
338
|
+
:SDL_CreateWindowFrom => :pointer,
|
339
|
+
:SDL_GetWindowID => :uint,
|
340
|
+
:SDL_GetWindowFromID => :pointer,
|
341
|
+
:SDL_GetWindowFlags => :uint,
|
342
|
+
:SDL_SetWindowTitle => :void,
|
343
|
+
:SDL_GetWindowTitle => :pointer,
|
344
|
+
:SDL_SetWindowIcon => :void,
|
345
|
+
:SDL_SetWindowData => :pointer,
|
346
|
+
:SDL_GetWindowData => :pointer,
|
347
|
+
:SDL_SetWindowPosition => :void,
|
348
|
+
:SDL_GetWindowPosition => :void,
|
349
|
+
:SDL_SetWindowSize => :void,
|
350
|
+
:SDL_GetWindowSize => :void,
|
351
|
+
:SDL_GetWindowBordersSize => :int,
|
352
|
+
:SDL_SetWindowMinimumSize => :void,
|
353
|
+
:SDL_GetWindowMinimumSize => :void,
|
354
|
+
:SDL_SetWindowMaximumSize => :void,
|
355
|
+
:SDL_GetWindowMaximumSize => :void,
|
356
|
+
:SDL_SetWindowBordered => :void,
|
357
|
+
:SDL_SetWindowResizable => :void,
|
358
|
+
:SDL_ShowWindow => :void,
|
359
|
+
:SDL_HideWindow => :void,
|
360
|
+
:SDL_RaiseWindow => :void,
|
361
|
+
:SDL_MaximizeWindow => :void,
|
362
|
+
:SDL_MinimizeWindow => :void,
|
363
|
+
:SDL_RestoreWindow => :void,
|
364
|
+
:SDL_SetWindowFullscreen => :int,
|
365
|
+
:SDL_GetWindowSurface => :pointer,
|
366
|
+
:SDL_UpdateWindowSurface => :int,
|
367
|
+
:SDL_UpdateWindowSurfaceRects => :int,
|
368
|
+
:SDL_SetWindowGrab => :void,
|
369
|
+
:SDL_GetWindowGrab => :int,
|
370
|
+
:SDL_GetGrabbedWindow => :pointer,
|
371
|
+
:SDL_SetWindowBrightness => :int,
|
372
|
+
:SDL_GetWindowBrightness => :float,
|
373
|
+
:SDL_SetWindowOpacity => :int,
|
374
|
+
:SDL_GetWindowOpacity => :int,
|
375
|
+
:SDL_SetWindowModalFor => :int,
|
376
|
+
:SDL_SetWindowInputFocus => :int,
|
377
|
+
:SDL_SetWindowGammaRamp => :int,
|
378
|
+
:SDL_GetWindowGammaRamp => :int,
|
379
|
+
:SDL_SetWindowHitTest => :int,
|
380
|
+
:SDL_DestroyWindow => :void,
|
381
|
+
:SDL_IsScreenSaverEnabled => :int,
|
382
|
+
:SDL_EnableScreenSaver => :void,
|
383
|
+
:SDL_DisableScreenSaver => :void,
|
384
|
+
:SDL_GL_LoadLibrary => :int,
|
385
|
+
:SDL_GL_GetProcAddress => :pointer,
|
386
|
+
:SDL_GL_UnloadLibrary => :void,
|
387
|
+
:SDL_GL_ExtensionSupported => :int,
|
388
|
+
:SDL_GL_ResetAttributes => :void,
|
389
|
+
:SDL_GL_SetAttribute => :int,
|
390
|
+
:SDL_GL_GetAttribute => :int,
|
391
|
+
:SDL_GL_CreateContext => :pointer,
|
392
|
+
:SDL_GL_MakeCurrent => :int,
|
393
|
+
:SDL_GL_GetCurrentWindow => :pointer,
|
394
|
+
:SDL_GL_GetCurrentContext => :pointer,
|
395
|
+
:SDL_GL_GetDrawableSize => :void,
|
396
|
+
:SDL_GL_SetSwapInterval => :int,
|
397
|
+
:SDL_GL_GetSwapInterval => :int,
|
398
|
+
:SDL_GL_SwapWindow => :void,
|
399
|
+
:SDL_GL_DeleteContext => :void,
|
400
|
+
}
|
401
|
+
symbols.each do |sym|
|
402
|
+
begin
|
403
|
+
attach_function sym, args[sym], retvals[sym]
|
404
|
+
rescue FFI::NotFoundError => error
|
405
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
406
|
+
end
|
407
|
+
end
|
408
|
+
end
|
409
|
+
|
410
|
+
end
|
411
|
+
|