sdl2-bindings 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +12 -0
  3. data/README.md +39 -26
  4. data/lib/sdl2.rb +54 -99
  5. data/lib/sdl2_audio.rb +59 -20
  6. data/lib/sdl2_blendmode.rb +28 -25
  7. data/lib/sdl2_clipboard.rb +9 -4
  8. data/lib/sdl2_cpuinfo.rb +28 -5
  9. data/lib/sdl2_error.rb +17 -10
  10. data/lib/sdl2_events.rb +150 -131
  11. data/lib/sdl2_filesystem.rb +8 -4
  12. data/lib/sdl2_framerate.rb +11 -4
  13. data/lib/sdl2_gamecontroller.rb +112 -57
  14. data/lib/sdl2_gesture.rb +10 -4
  15. data/lib/sdl2_gfxPrimitives.rb +65 -4
  16. data/lib/sdl2_haptic.rb +76 -44
  17. data/lib/sdl2_hidapi.rb +26 -5
  18. data/lib/sdl2_hints.rb +146 -137
  19. data/lib/sdl2_image.rb +54 -7
  20. data/lib/sdl2_imageFilter.rb +36 -4
  21. data/lib/sdl2_joystick.rb +93 -38
  22. data/lib/sdl2_keyboard.rb +23 -5
  23. data/lib/sdl2_keycode.rb +6 -4
  24. data/lib/sdl2_log.rb +48 -32
  25. data/lib/sdl2_main.rb +21 -14
  26. data/lib/sdl2_messagebox.rb +26 -22
  27. data/lib/sdl2_misc.rb +7 -4
  28. data/lib/sdl2_mixer.rb +86 -11
  29. data/lib/sdl2_mouse.rb +44 -25
  30. data/lib/sdl2_pixels.rb +115 -99
  31. data/lib/sdl2_platform.rb +7 -4
  32. data/lib/sdl2_power.rb +12 -9
  33. data/lib/sdl2_rect.rb +18 -11
  34. data/lib/sdl2_render.rb +107 -25
  35. data/lib/sdl2_rotozoom.rb +14 -4
  36. data/lib/sdl2_rwops.rb +58 -28
  37. data/lib/sdl2_scancode.rb +250 -248
  38. data/lib/sdl2_sensor.rb +27 -9
  39. data/lib/sdl2_shape.rb +17 -11
  40. data/lib/sdl2_stdinc.rb +135 -10
  41. data/lib/sdl2_surface.rb +56 -15
  42. data/lib/sdl2_syswm.rb +47 -44
  43. data/lib/sdl2_timer.rb +13 -4
  44. data/lib/sdl2_touch.rb +18 -11
  45. data/lib/sdl2_ttf.rb +180 -25
  46. data/lib/sdl2_version.rb +13 -8
  47. data/lib/sdl2_video.rb +204 -110
  48. data/lib/sdl2_vulkan.rb +12 -4
  49. metadata +17 -3
data/lib/sdl2_video.rb CHANGED
@@ -6,118 +6,118 @@
6
6
 
7
7
  require 'ffi'
8
8
 
9
- module SDL2
9
+ module SDL
10
10
  extend FFI::Library
11
11
  # Define/Macro
12
12
 
13
- SDL_WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000
14
- SDL_WINDOWPOS_CENTERED_MASK = 0x2FFF0000
13
+ WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000
14
+ WINDOWPOS_CENTERED_MASK = 0x2FFF0000
15
15
 
16
16
  # Enum
17
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_MOUSE_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_KEYBOARD_GRABBED = 1048576
39
- SDL_WINDOW_VULKAN = 268435456
40
- SDL_WINDOW_METAL = 536870912
41
- SDL_WINDOW_INPUT_GRABBED = 256
42
- SDL_WINDOWEVENT_NONE = 0
43
- SDL_WINDOWEVENT_SHOWN = 1
44
- SDL_WINDOWEVENT_HIDDEN = 2
45
- SDL_WINDOWEVENT_EXPOSED = 3
46
- SDL_WINDOWEVENT_MOVED = 4
47
- SDL_WINDOWEVENT_RESIZED = 5
48
- SDL_WINDOWEVENT_SIZE_CHANGED = 6
49
- SDL_WINDOWEVENT_MINIMIZED = 7
50
- SDL_WINDOWEVENT_MAXIMIZED = 8
51
- SDL_WINDOWEVENT_RESTORED = 9
52
- SDL_WINDOWEVENT_ENTER = 10
53
- SDL_WINDOWEVENT_LEAVE = 11
54
- SDL_WINDOWEVENT_FOCUS_GAINED = 12
55
- SDL_WINDOWEVENT_FOCUS_LOST = 13
56
- SDL_WINDOWEVENT_CLOSE = 14
57
- SDL_WINDOWEVENT_TAKE_FOCUS = 15
58
- SDL_WINDOWEVENT_HIT_TEST = 16
59
- SDL_WINDOWEVENT_ICCPROF_CHANGED = 17
60
- SDL_WINDOWEVENT_DISPLAY_CHANGED = 18
61
- SDL_DISPLAYEVENT_NONE = 0
62
- SDL_DISPLAYEVENT_ORIENTATION = 1
63
- SDL_DISPLAYEVENT_CONNECTED = 2
64
- SDL_DISPLAYEVENT_DISCONNECTED = 3
65
- SDL_ORIENTATION_UNKNOWN = 0
66
- SDL_ORIENTATION_LANDSCAPE = 1
67
- SDL_ORIENTATION_LANDSCAPE_FLIPPED = 2
68
- SDL_ORIENTATION_PORTRAIT = 3
69
- SDL_ORIENTATION_PORTRAIT_FLIPPED = 4
70
- SDL_FLASH_CANCEL = 0
71
- SDL_FLASH_BRIEFLY = 1
72
- SDL_FLASH_UNTIL_FOCUSED = 2
73
- SDL_GL_RED_SIZE = 0
74
- SDL_GL_GREEN_SIZE = 1
75
- SDL_GL_BLUE_SIZE = 2
76
- SDL_GL_ALPHA_SIZE = 3
77
- SDL_GL_BUFFER_SIZE = 4
78
- SDL_GL_DOUBLEBUFFER = 5
79
- SDL_GL_DEPTH_SIZE = 6
80
- SDL_GL_STENCIL_SIZE = 7
81
- SDL_GL_ACCUM_RED_SIZE = 8
82
- SDL_GL_ACCUM_GREEN_SIZE = 9
83
- SDL_GL_ACCUM_BLUE_SIZE = 10
84
- SDL_GL_ACCUM_ALPHA_SIZE = 11
85
- SDL_GL_STEREO = 12
86
- SDL_GL_MULTISAMPLEBUFFERS = 13
87
- SDL_GL_MULTISAMPLESAMPLES = 14
88
- SDL_GL_ACCELERATED_VISUAL = 15
89
- SDL_GL_RETAINED_BACKING = 16
90
- SDL_GL_CONTEXT_MAJOR_VERSION = 17
91
- SDL_GL_CONTEXT_MINOR_VERSION = 18
92
- SDL_GL_CONTEXT_EGL = 19
93
- SDL_GL_CONTEXT_FLAGS = 20
94
- SDL_GL_CONTEXT_PROFILE_MASK = 21
95
- SDL_GL_SHARE_WITH_CURRENT_CONTEXT = 22
96
- SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = 23
97
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR = 24
98
- SDL_GL_CONTEXT_RESET_NOTIFICATION = 25
99
- SDL_GL_CONTEXT_NO_ERROR = 26
100
- SDL_GL_CONTEXT_PROFILE_CORE = 1
101
- SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 2
102
- SDL_GL_CONTEXT_PROFILE_ES = 4
103
- SDL_GL_CONTEXT_DEBUG_FLAG = 1
104
- SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 2
105
- SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 4
106
- SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 8
107
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0
108
- SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 1
109
- SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0
110
- SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 1
111
- SDL_HITTEST_NORMAL = 0
112
- SDL_HITTEST_DRAGGABLE = 1
113
- SDL_HITTEST_RESIZE_TOPLEFT = 2
114
- SDL_HITTEST_RESIZE_TOP = 3
115
- SDL_HITTEST_RESIZE_TOPRIGHT = 4
116
- SDL_HITTEST_RESIZE_RIGHT = 5
117
- SDL_HITTEST_RESIZE_BOTTOMRIGHT = 6
118
- SDL_HITTEST_RESIZE_BOTTOM = 7
119
- SDL_HITTEST_RESIZE_BOTTOMLEFT = 8
120
- SDL_HITTEST_RESIZE_LEFT = 9
18
+ WINDOW_FULLSCREEN = 1
19
+ WINDOW_OPENGL = 2
20
+ WINDOW_SHOWN = 4
21
+ WINDOW_HIDDEN = 8
22
+ WINDOW_BORDERLESS = 16
23
+ WINDOW_RESIZABLE = 32
24
+ WINDOW_MINIMIZED = 64
25
+ WINDOW_MAXIMIZED = 128
26
+ WINDOW_MOUSE_GRABBED = 256
27
+ WINDOW_INPUT_FOCUS = 512
28
+ WINDOW_MOUSE_FOCUS = 1024
29
+ WINDOW_FULLSCREEN_DESKTOP = 4097
30
+ WINDOW_FOREIGN = 2048
31
+ WINDOW_ALLOW_HIGHDPI = 8192
32
+ WINDOW_MOUSE_CAPTURE = 16384
33
+ WINDOW_ALWAYS_ON_TOP = 32768
34
+ WINDOW_SKIP_TASKBAR = 65536
35
+ WINDOW_UTILITY = 131072
36
+ WINDOW_TOOLTIP = 262144
37
+ WINDOW_POPUP_MENU = 524288
38
+ WINDOW_KEYBOARD_GRABBED = 1048576
39
+ WINDOW_VULKAN = 268435456
40
+ WINDOW_METAL = 536870912
41
+ WINDOW_INPUT_GRABBED = 256
42
+ WINDOWEVENT_NONE = 0
43
+ WINDOWEVENT_SHOWN = 1
44
+ WINDOWEVENT_HIDDEN = 2
45
+ WINDOWEVENT_EXPOSED = 3
46
+ WINDOWEVENT_MOVED = 4
47
+ WINDOWEVENT_RESIZED = 5
48
+ WINDOWEVENT_SIZE_CHANGED = 6
49
+ WINDOWEVENT_MINIMIZED = 7
50
+ WINDOWEVENT_MAXIMIZED = 8
51
+ WINDOWEVENT_RESTORED = 9
52
+ WINDOWEVENT_ENTER = 10
53
+ WINDOWEVENT_LEAVE = 11
54
+ WINDOWEVENT_FOCUS_GAINED = 12
55
+ WINDOWEVENT_FOCUS_LOST = 13
56
+ WINDOWEVENT_CLOSE = 14
57
+ WINDOWEVENT_TAKE_FOCUS = 15
58
+ WINDOWEVENT_HIT_TEST = 16
59
+ WINDOWEVENT_ICCPROF_CHANGED = 17
60
+ WINDOWEVENT_DISPLAY_CHANGED = 18
61
+ DISPLAYEVENT_NONE = 0
62
+ DISPLAYEVENT_ORIENTATION = 1
63
+ DISPLAYEVENT_CONNECTED = 2
64
+ DISPLAYEVENT_DISCONNECTED = 3
65
+ ORIENTATION_UNKNOWN = 0
66
+ ORIENTATION_LANDSCAPE = 1
67
+ ORIENTATION_LANDSCAPE_FLIPPED = 2
68
+ ORIENTATION_PORTRAIT = 3
69
+ ORIENTATION_PORTRAIT_FLIPPED = 4
70
+ FLASH_CANCEL = 0
71
+ FLASH_BRIEFLY = 1
72
+ FLASH_UNTIL_FOCUSED = 2
73
+ GL_RED_SIZE = 0
74
+ GL_GREEN_SIZE = 1
75
+ GL_BLUE_SIZE = 2
76
+ GL_ALPHA_SIZE = 3
77
+ GL_BUFFER_SIZE = 4
78
+ GL_DOUBLEBUFFER = 5
79
+ GL_DEPTH_SIZE = 6
80
+ GL_STENCIL_SIZE = 7
81
+ GL_ACCUM_RED_SIZE = 8
82
+ GL_ACCUM_GREEN_SIZE = 9
83
+ GL_ACCUM_BLUE_SIZE = 10
84
+ GL_ACCUM_ALPHA_SIZE = 11
85
+ GL_STEREO = 12
86
+ GL_MULTISAMPLEBUFFERS = 13
87
+ GL_MULTISAMPLESAMPLES = 14
88
+ GL_ACCELERATED_VISUAL = 15
89
+ GL_RETAINED_BACKING = 16
90
+ GL_CONTEXT_MAJOR_VERSION = 17
91
+ GL_CONTEXT_MINOR_VERSION = 18
92
+ GL_CONTEXT_EGL = 19
93
+ GL_CONTEXT_FLAGS = 20
94
+ GL_CONTEXT_PROFILE_MASK = 21
95
+ GL_SHARE_WITH_CURRENT_CONTEXT = 22
96
+ GL_FRAMEBUFFER_SRGB_CAPABLE = 23
97
+ GL_CONTEXT_RELEASE_BEHAVIOR = 24
98
+ GL_CONTEXT_RESET_NOTIFICATION = 25
99
+ GL_CONTEXT_NO_ERROR = 26
100
+ GL_CONTEXT_PROFILE_CORE = 1
101
+ GL_CONTEXT_PROFILE_COMPATIBILITY = 2
102
+ GL_CONTEXT_PROFILE_ES = 4
103
+ GL_CONTEXT_DEBUG_FLAG = 1
104
+ GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 2
105
+ GL_CONTEXT_ROBUST_ACCESS_FLAG = 4
106
+ GL_CONTEXT_RESET_ISOLATION_FLAG = 8
107
+ GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0
108
+ GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 1
109
+ GL_CONTEXT_RESET_NO_NOTIFICATION = 0
110
+ GL_CONTEXT_RESET_LOSE_CONTEXT = 1
111
+ HITTEST_NORMAL = 0
112
+ HITTEST_DRAGGABLE = 1
113
+ HITTEST_RESIZE_TOPLEFT = 2
114
+ HITTEST_RESIZE_TOP = 3
115
+ HITTEST_RESIZE_TOPRIGHT = 4
116
+ HITTEST_RESIZE_RIGHT = 5
117
+ HITTEST_RESIZE_BOTTOMRIGHT = 6
118
+ HITTEST_RESIZE_BOTTOM = 7
119
+ HITTEST_RESIZE_BOTTOMLEFT = 8
120
+ HITTEST_RESIZE_LEFT = 9
121
121
 
122
122
  # Typedef
123
123
 
@@ -137,7 +137,7 @@ module SDL2
137
137
 
138
138
  # Struct
139
139
 
140
- class SDL_DisplayMode < FFI::Struct
140
+ class DisplayMode < FFI::Struct
141
141
  layout(
142
142
  :format, :uint,
143
143
  :w, :int,
@@ -150,7 +150,7 @@ module SDL2
150
150
 
151
151
  # Function
152
152
 
153
- def self.setup_video_symbols()
153
+ def self.setup_video_symbols(output_error = false)
154
154
  symbols = [
155
155
  :SDL_GetNumVideoDrivers,
156
156
  :SDL_GetVideoDriver,
@@ -245,6 +245,100 @@ module SDL2
245
245
  :SDL_GL_SwapWindow,
246
246
  :SDL_GL_DeleteContext,
247
247
  ]
248
+ apis = {
249
+ :SDL_GetNumVideoDrivers => :GetNumVideoDrivers,
250
+ :SDL_GetVideoDriver => :GetVideoDriver,
251
+ :SDL_VideoInit => :VideoInit,
252
+ :SDL_VideoQuit => :VideoQuit,
253
+ :SDL_GetCurrentVideoDriver => :GetCurrentVideoDriver,
254
+ :SDL_GetNumVideoDisplays => :GetNumVideoDisplays,
255
+ :SDL_GetDisplayName => :GetDisplayName,
256
+ :SDL_GetDisplayBounds => :GetDisplayBounds,
257
+ :SDL_GetDisplayUsableBounds => :GetDisplayUsableBounds,
258
+ :SDL_GetDisplayDPI => :GetDisplayDPI,
259
+ :SDL_GetDisplayOrientation => :GetDisplayOrientation,
260
+ :SDL_GetNumDisplayModes => :GetNumDisplayModes,
261
+ :SDL_GetDisplayMode => :GetDisplayMode,
262
+ :SDL_GetDesktopDisplayMode => :GetDesktopDisplayMode,
263
+ :SDL_GetCurrentDisplayMode => :GetCurrentDisplayMode,
264
+ :SDL_GetClosestDisplayMode => :GetClosestDisplayMode,
265
+ :SDL_GetWindowDisplayIndex => :GetWindowDisplayIndex,
266
+ :SDL_SetWindowDisplayMode => :SetWindowDisplayMode,
267
+ :SDL_GetWindowDisplayMode => :GetWindowDisplayMode,
268
+ :SDL_GetWindowICCProfile => :GetWindowICCProfile,
269
+ :SDL_GetWindowPixelFormat => :GetWindowPixelFormat,
270
+ :SDL_CreateWindow => :CreateWindow,
271
+ :SDL_CreateWindowFrom => :CreateWindowFrom,
272
+ :SDL_GetWindowID => :GetWindowID,
273
+ :SDL_GetWindowFromID => :GetWindowFromID,
274
+ :SDL_GetWindowFlags => :GetWindowFlags,
275
+ :SDL_SetWindowTitle => :SetWindowTitle,
276
+ :SDL_GetWindowTitle => :GetWindowTitle,
277
+ :SDL_SetWindowIcon => :SetWindowIcon,
278
+ :SDL_SetWindowData => :SetWindowData,
279
+ :SDL_GetWindowData => :GetWindowData,
280
+ :SDL_SetWindowPosition => :SetWindowPosition,
281
+ :SDL_GetWindowPosition => :GetWindowPosition,
282
+ :SDL_SetWindowSize => :SetWindowSize,
283
+ :SDL_GetWindowSize => :GetWindowSize,
284
+ :SDL_GetWindowBordersSize => :GetWindowBordersSize,
285
+ :SDL_SetWindowMinimumSize => :SetWindowMinimumSize,
286
+ :SDL_GetWindowMinimumSize => :GetWindowMinimumSize,
287
+ :SDL_SetWindowMaximumSize => :SetWindowMaximumSize,
288
+ :SDL_GetWindowMaximumSize => :GetWindowMaximumSize,
289
+ :SDL_SetWindowBordered => :SetWindowBordered,
290
+ :SDL_SetWindowResizable => :SetWindowResizable,
291
+ :SDL_SetWindowAlwaysOnTop => :SetWindowAlwaysOnTop,
292
+ :SDL_ShowWindow => :ShowWindow,
293
+ :SDL_HideWindow => :HideWindow,
294
+ :SDL_RaiseWindow => :RaiseWindow,
295
+ :SDL_MaximizeWindow => :MaximizeWindow,
296
+ :SDL_MinimizeWindow => :MinimizeWindow,
297
+ :SDL_RestoreWindow => :RestoreWindow,
298
+ :SDL_SetWindowFullscreen => :SetWindowFullscreen,
299
+ :SDL_GetWindowSurface => :GetWindowSurface,
300
+ :SDL_UpdateWindowSurface => :UpdateWindowSurface,
301
+ :SDL_UpdateWindowSurfaceRects => :UpdateWindowSurfaceRects,
302
+ :SDL_SetWindowGrab => :SetWindowGrab,
303
+ :SDL_SetWindowKeyboardGrab => :SetWindowKeyboardGrab,
304
+ :SDL_SetWindowMouseGrab => :SetWindowMouseGrab,
305
+ :SDL_GetWindowGrab => :GetWindowGrab,
306
+ :SDL_GetWindowKeyboardGrab => :GetWindowKeyboardGrab,
307
+ :SDL_GetWindowMouseGrab => :GetWindowMouseGrab,
308
+ :SDL_GetGrabbedWindow => :GetGrabbedWindow,
309
+ :SDL_SetWindowMouseRect => :SetWindowMouseRect,
310
+ :SDL_GetWindowMouseRect => :GetWindowMouseRect,
311
+ :SDL_SetWindowBrightness => :SetWindowBrightness,
312
+ :SDL_GetWindowBrightness => :GetWindowBrightness,
313
+ :SDL_SetWindowOpacity => :SetWindowOpacity,
314
+ :SDL_GetWindowOpacity => :GetWindowOpacity,
315
+ :SDL_SetWindowModalFor => :SetWindowModalFor,
316
+ :SDL_SetWindowInputFocus => :SetWindowInputFocus,
317
+ :SDL_SetWindowGammaRamp => :SetWindowGammaRamp,
318
+ :SDL_GetWindowGammaRamp => :GetWindowGammaRamp,
319
+ :SDL_SetWindowHitTest => :SetWindowHitTest,
320
+ :SDL_FlashWindow => :FlashWindow,
321
+ :SDL_DestroyWindow => :DestroyWindow,
322
+ :SDL_IsScreenSaverEnabled => :IsScreenSaverEnabled,
323
+ :SDL_EnableScreenSaver => :EnableScreenSaver,
324
+ :SDL_DisableScreenSaver => :DisableScreenSaver,
325
+ :SDL_GL_LoadLibrary => :GL_LoadLibrary,
326
+ :SDL_GL_GetProcAddress => :GL_GetProcAddress,
327
+ :SDL_GL_UnloadLibrary => :GL_UnloadLibrary,
328
+ :SDL_GL_ExtensionSupported => :GL_ExtensionSupported,
329
+ :SDL_GL_ResetAttributes => :GL_ResetAttributes,
330
+ :SDL_GL_SetAttribute => :GL_SetAttribute,
331
+ :SDL_GL_GetAttribute => :GL_GetAttribute,
332
+ :SDL_GL_CreateContext => :GL_CreateContext,
333
+ :SDL_GL_MakeCurrent => :GL_MakeCurrent,
334
+ :SDL_GL_GetCurrentWindow => :GL_GetCurrentWindow,
335
+ :SDL_GL_GetCurrentContext => :GL_GetCurrentContext,
336
+ :SDL_GL_GetDrawableSize => :GL_GetDrawableSize,
337
+ :SDL_GL_SetSwapInterval => :GL_SetSwapInterval,
338
+ :SDL_GL_GetSwapInterval => :GL_GetSwapInterval,
339
+ :SDL_GL_SwapWindow => :GL_SwapWindow,
340
+ :SDL_GL_DeleteContext => :GL_DeleteContext,
341
+ }
248
342
  args = {
249
343
  :SDL_GetNumVideoDrivers => [],
250
344
  :SDL_GetVideoDriver => [:int],
@@ -435,9 +529,9 @@ module SDL2
435
529
  }
436
530
  symbols.each do |sym|
437
531
  begin
438
- attach_function sym, args[sym], retvals[sym]
532
+ attach_function apis[sym], sym, args[sym], retvals[sym]
439
533
  rescue FFI::NotFoundError => error
440
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
534
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
441
535
  end
442
536
  end
443
537
  end
data/lib/sdl2_vulkan.rb CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  require 'ffi'
8
8
 
9
- module SDL2
9
+ module SDL
10
10
  extend FFI::Library
11
11
  # Define/Macro
12
12
 
@@ -26,7 +26,7 @@ module SDL2
26
26
 
27
27
  # Function
28
28
 
29
- def self.setup_vulkan_symbols()
29
+ def self.setup_vulkan_symbols(output_error = false)
30
30
  symbols = [
31
31
  :SDL_Vulkan_LoadLibrary,
32
32
  :SDL_Vulkan_GetVkGetInstanceProcAddr,
@@ -35,6 +35,14 @@ module SDL2
35
35
  :SDL_Vulkan_CreateSurface,
36
36
  :SDL_Vulkan_GetDrawableSize,
37
37
  ]
38
+ apis = {
39
+ :SDL_Vulkan_LoadLibrary => :Vulkan_LoadLibrary,
40
+ :SDL_Vulkan_GetVkGetInstanceProcAddr => :Vulkan_GetVkGetInstanceProcAddr,
41
+ :SDL_Vulkan_UnloadLibrary => :Vulkan_UnloadLibrary,
42
+ :SDL_Vulkan_GetInstanceExtensions => :Vulkan_GetInstanceExtensions,
43
+ :SDL_Vulkan_CreateSurface => :Vulkan_CreateSurface,
44
+ :SDL_Vulkan_GetDrawableSize => :Vulkan_GetDrawableSize,
45
+ }
38
46
  args = {
39
47
  :SDL_Vulkan_LoadLibrary => [:pointer],
40
48
  :SDL_Vulkan_GetVkGetInstanceProcAddr => [],
@@ -53,9 +61,9 @@ module SDL2
53
61
  }
54
62
  symbols.each do |sym|
55
63
  begin
56
- attach_function sym, args[sym], retvals[sym]
64
+ attach_function apis[sym], sym, args[sym], retvals[sym]
57
65
  rescue FFI::NotFoundError => error
58
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
66
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
59
67
  end
60
68
  end
61
69
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdl2-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaiorabbit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-11 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-02-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
13
27
  description: 'Ruby bindings for SDL2.
14
28
 
15
29
  '