sdl3-bindings 1.0.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +159 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +132 -0
  5. data/lib/sdl3.rb +150 -0
  6. data/lib/sdl3_assert.rb +61 -0
  7. data/lib/sdl3_asyncio.rb +68 -0
  8. data/lib/sdl3_atomic.rb +64 -0
  9. data/lib/sdl3_audio.rb +120 -0
  10. data/lib/sdl3_bits.rb +38 -0
  11. data/lib/sdl3_blendmode.rb +63 -0
  12. data/lib/sdl3_camera.rb +67 -0
  13. data/lib/sdl3_clipboard.rb +49 -0
  14. data/lib/sdl3_cpuinfo.rb +55 -0
  15. data/lib/sdl3_dialog.rb +60 -0
  16. data/lib/sdl3_endian.rb +39 -0
  17. data/lib/sdl3_error.rb +41 -0
  18. data/lib/sdl3_events.rb +680 -0
  19. data/lib/sdl3_filesystem.rb +82 -0
  20. data/lib/sdl3_gamepad.rb +216 -0
  21. data/lib/sdl3_gpu.rb +836 -0
  22. data/lib/sdl3_guid.rb +44 -0
  23. data/lib/sdl3_haptic.rb +209 -0
  24. data/lib/sdl3_hidapi.rb +84 -0
  25. data/lib/sdl3_hints.rb +285 -0
  26. data/lib/sdl3_image.rb +108 -0
  27. data/lib/sdl3_init.rb +71 -0
  28. data/lib/sdl3_iostream.rb +115 -0
  29. data/lib/sdl3_joystick.rb +174 -0
  30. data/lib/sdl3_keyboard.rb +81 -0
  31. data/lib/sdl3_keycode.rb +310 -0
  32. data/lib/sdl3_loadso.rb +39 -0
  33. data/lib/sdl3_locale.rb +44 -0
  34. data/lib/sdl3_log.rb +85 -0
  35. data/lib/sdl3_messagebox.rb +88 -0
  36. data/lib/sdl3_misc.rb +37 -0
  37. data/lib/sdl3_mixer.rb +179 -0
  38. data/lib/sdl3_mouse.rb +90 -0
  39. data/lib/sdl3_mutex.rb +77 -0
  40. data/lib/sdl3_pen.rb +56 -0
  41. data/lib/sdl3_pixels.rb +296 -0
  42. data/lib/sdl3_platform.rb +37 -0
  43. data/lib/sdl3_power.rb +44 -0
  44. data/lib/sdl3_process.rb +65 -0
  45. data/lib/sdl3_properties.rb +67 -0
  46. data/lib/sdl3_rect.rb +98 -0
  47. data/lib/sdl3_render.rb +240 -0
  48. data/lib/sdl3_revision.rb +37 -0
  49. data/lib/sdl3_scancode.rb +286 -0
  50. data/lib/sdl3_sensor.rb +61 -0
  51. data/lib/sdl3_sound.rb +98 -0
  52. data/lib/sdl3_stdinc.rb +229 -0
  53. data/lib/sdl3_storage.rb +70 -0
  54. data/lib/sdl3_surface.rb +122 -0
  55. data/lib/sdl3_thread.rb +65 -0
  56. data/lib/sdl3_time.rb +66 -0
  57. data/lib/sdl3_timer.rb +54 -0
  58. data/lib/sdl3_touch.rb +56 -0
  59. data/lib/sdl3_tray.rb +66 -0
  60. data/lib/sdl3_ttf.rb +216 -0
  61. data/lib/sdl3_version.rb +41 -0
  62. data/lib/sdl3_video.rb +341 -0
  63. data/lib/sdl3_vulkan.rb +46 -0
  64. metadata +118 -0
data/lib/sdl3_audio.rb ADDED
@@ -0,0 +1,120 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ AUDIO_MASK_BITSIZE = 0xFF
14
+ AUDIO_MASK_SIGNED = 1 << 15
15
+
16
+ # Enum
17
+
18
+ AUDIO_UNKNOWN = 0
19
+ AUDIO_U8 = 8
20
+ AUDIO_S8 = 32776
21
+ AUDIO_S16LE = 32784
22
+ AUDIO_S16BE = 36880
23
+ AUDIO_S32LE = 32800
24
+ AUDIO_S32BE = 36896
25
+ AUDIO_F32LE = 33056
26
+ AUDIO_F32BE = 37152
27
+ AUDIO_S16 = 32784
28
+ AUDIO_S32 = 32800
29
+ AUDIO_F32 = 33056
30
+
31
+ # Typedef
32
+
33
+ typedef :int, :SDL_AudioFormat
34
+ typedef :uint, :SDL_AudioDeviceID
35
+ callback :SDL_AudioStreamCallback, [:pointer, :pointer, :int, :int], :void
36
+ callback :SDL_AudioPostmixCallback, [:pointer, :pointer, :pointer, :int], :void
37
+
38
+ # Struct
39
+
40
+ class AudioSpec < FFI::Struct
41
+ layout(
42
+ :format, :int,
43
+ :channels, :int,
44
+ :freq, :int,
45
+ )
46
+ end
47
+
48
+
49
+ # Function
50
+
51
+ def self.setup_audio_symbols(output_error = false)
52
+ entries = [
53
+ [:GetNumAudioDrivers, :SDL_GetNumAudioDrivers, [], :int],
54
+ [:GetAudioDriver, :SDL_GetAudioDriver, [:int], :pointer],
55
+ [:GetCurrentAudioDriver, :SDL_GetCurrentAudioDriver, [], :pointer],
56
+ [:GetAudioPlaybackDevices, :SDL_GetAudioPlaybackDevices, [:pointer], :pointer],
57
+ [:GetAudioRecordingDevices, :SDL_GetAudioRecordingDevices, [:pointer], :pointer],
58
+ [:GetAudioDeviceName, :SDL_GetAudioDeviceName, [:uint], :pointer],
59
+ [:GetAudioDeviceFormat, :SDL_GetAudioDeviceFormat, [:uint, :pointer, :pointer], :bool],
60
+ [:GetAudioDeviceChannelMap, :SDL_GetAudioDeviceChannelMap, [:uint, :pointer], :pointer],
61
+ [:OpenAudioDevice, :SDL_OpenAudioDevice, [:uint, :pointer], :uint],
62
+ [:IsAudioDevicePhysical, :SDL_IsAudioDevicePhysical, [:uint], :bool],
63
+ [:IsAudioDevicePlayback, :SDL_IsAudioDevicePlayback, [:uint], :bool],
64
+ [:PauseAudioDevice, :SDL_PauseAudioDevice, [:uint], :bool],
65
+ [:ResumeAudioDevice, :SDL_ResumeAudioDevice, [:uint], :bool],
66
+ [:AudioDevicePaused, :SDL_AudioDevicePaused, [:uint], :bool],
67
+ [:GetAudioDeviceGain, :SDL_GetAudioDeviceGain, [:uint], :float],
68
+ [:SetAudioDeviceGain, :SDL_SetAudioDeviceGain, [:uint, :float], :bool],
69
+ [:CloseAudioDevice, :SDL_CloseAudioDevice, [:uint], :void],
70
+ [:BindAudioStreams, :SDL_BindAudioStreams, [:uint, :pointer, :int], :bool],
71
+ [:BindAudioStream, :SDL_BindAudioStream, [:uint, :pointer], :bool],
72
+ [:UnbindAudioStreams, :SDL_UnbindAudioStreams, [:pointer, :int], :void],
73
+ [:UnbindAudioStream, :SDL_UnbindAudioStream, [:pointer], :void],
74
+ [:GetAudioStreamDevice, :SDL_GetAudioStreamDevice, [:pointer], :uint],
75
+ [:CreateAudioStream, :SDL_CreateAudioStream, [:pointer, :pointer], :pointer],
76
+ [:GetAudioStreamProperties, :SDL_GetAudioStreamProperties, [:pointer], :uint],
77
+ [:GetAudioStreamFormat, :SDL_GetAudioStreamFormat, [:pointer, :pointer, :pointer], :bool],
78
+ [:SetAudioStreamFormat, :SDL_SetAudioStreamFormat, [:pointer, :pointer, :pointer], :bool],
79
+ [:GetAudioStreamFrequencyRatio, :SDL_GetAudioStreamFrequencyRatio, [:pointer], :float],
80
+ [:SetAudioStreamFrequencyRatio, :SDL_SetAudioStreamFrequencyRatio, [:pointer, :float], :bool],
81
+ [:GetAudioStreamGain, :SDL_GetAudioStreamGain, [:pointer], :float],
82
+ [:SetAudioStreamGain, :SDL_SetAudioStreamGain, [:pointer, :float], :bool],
83
+ [:GetAudioStreamInputChannelMap, :SDL_GetAudioStreamInputChannelMap, [:pointer, :pointer], :pointer],
84
+ [:GetAudioStreamOutputChannelMap, :SDL_GetAudioStreamOutputChannelMap, [:pointer, :pointer], :pointer],
85
+ [:SetAudioStreamInputChannelMap, :SDL_SetAudioStreamInputChannelMap, [:pointer, :pointer, :int], :bool],
86
+ [:SetAudioStreamOutputChannelMap, :SDL_SetAudioStreamOutputChannelMap, [:pointer, :pointer, :int], :bool],
87
+ [:PutAudioStreamData, :SDL_PutAudioStreamData, [:pointer, :pointer, :int], :bool],
88
+ [:GetAudioStreamData, :SDL_GetAudioStreamData, [:pointer, :pointer, :int], :int],
89
+ [:GetAudioStreamAvailable, :SDL_GetAudioStreamAvailable, [:pointer], :int],
90
+ [:GetAudioStreamQueued, :SDL_GetAudioStreamQueued, [:pointer], :int],
91
+ [:FlushAudioStream, :SDL_FlushAudioStream, [:pointer], :bool],
92
+ [:ClearAudioStream, :SDL_ClearAudioStream, [:pointer], :bool],
93
+ [:PauseAudioStreamDevice, :SDL_PauseAudioStreamDevice, [:pointer], :bool],
94
+ [:ResumeAudioStreamDevice, :SDL_ResumeAudioStreamDevice, [:pointer], :bool],
95
+ [:AudioStreamDevicePaused, :SDL_AudioStreamDevicePaused, [:pointer], :bool],
96
+ [:LockAudioStream, :SDL_LockAudioStream, [:pointer], :bool],
97
+ [:UnlockAudioStream, :SDL_UnlockAudioStream, [:pointer], :bool],
98
+ [:SetAudioStreamGetCallback, :SDL_SetAudioStreamGetCallback, [:pointer, :SDL_AudioStreamCallback, :pointer], :bool],
99
+ [:SetAudioStreamPutCallback, :SDL_SetAudioStreamPutCallback, [:pointer, :SDL_AudioStreamCallback, :pointer], :bool],
100
+ [:DestroyAudioStream, :SDL_DestroyAudioStream, [:pointer], :void],
101
+ [:OpenAudioDeviceStream, :SDL_OpenAudioDeviceStream, [:uint, :pointer, :SDL_AudioStreamCallback, :pointer], :pointer],
102
+ [:SetAudioPostmixCallback, :SDL_SetAudioPostmixCallback, [:uint, :SDL_AudioPostmixCallback, :pointer], :bool],
103
+ [:LoadWAV_IO, :SDL_LoadWAV_IO, [:pointer, :bool, :pointer, :pointer, :pointer], :bool],
104
+ [:LoadWAV, :SDL_LoadWAV, [:pointer, :pointer, :pointer, :pointer], :bool],
105
+ [:MixAudio, :SDL_MixAudio, [:pointer, :pointer, :int, :uint, :float], :bool],
106
+ [:ConvertAudioSamples, :SDL_ConvertAudioSamples, [:pointer, :pointer, :int, :pointer, :pointer, :pointer], :bool],
107
+ [:GetAudioFormatName, :SDL_GetAudioFormatName, [:int], :pointer],
108
+ [:GetSilenceValueForFormat, :SDL_GetSilenceValueForFormat, [:int], :int],
109
+ ]
110
+ entries.each do |entry|
111
+ attach_function entry[0], entry[1], entry[2], entry[3]
112
+ rescue FFI::NotFoundError => e
113
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
114
+ end
115
+ end
116
+
117
+ end
118
+
119
+ # TODO : def SDL_LoadWAV
120
+
data/lib/sdl3_bits.rb ADDED
@@ -0,0 +1,38 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
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_bits_symbols(output_error = false)
26
+ entries = [
27
+ [:MostSignificantBitIndex32, :SDL_MostSignificantBitIndex32, [:uint], :int],
28
+ [:HasExactlyOneBitSet32, :SDL_HasExactlyOneBitSet32, [:uint], :bool],
29
+ ]
30
+ entries.each do |entry|
31
+ attach_function entry[0], entry[1], entry[2], entry[3]
32
+ rescue FFI::NotFoundError => e
33
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
34
+ end
35
+ end
36
+
37
+ end
38
+
@@ -0,0 +1,63 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ BLENDMODE_NONE = 0x00000000
14
+ BLENDMODE_BLEND = 0x00000001
15
+ BLENDMODE_BLEND_PREMULTIPLIED = 0x00000010
16
+ BLENDMODE_ADD = 0x00000002
17
+ BLENDMODE_ADD_PREMULTIPLIED = 0x00000020
18
+ BLENDMODE_MOD = 0x00000004
19
+ BLENDMODE_MUL = 0x00000008
20
+ BLENDMODE_INVALID = 0x7FFFFFFF
21
+
22
+ # Enum
23
+
24
+ BLENDOPERATION_ADD = 1
25
+ BLENDOPERATION_SUBTRACT = 2
26
+ BLENDOPERATION_REV_SUBTRACT = 3
27
+ BLENDOPERATION_MINIMUM = 4
28
+ BLENDOPERATION_MAXIMUM = 5
29
+ BLENDFACTOR_ZERO = 1
30
+ BLENDFACTOR_ONE = 2
31
+ BLENDFACTOR_SRC_COLOR = 3
32
+ BLENDFACTOR_ONE_MINUS_SRC_COLOR = 4
33
+ BLENDFACTOR_SRC_ALPHA = 5
34
+ BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 6
35
+ BLENDFACTOR_DST_COLOR = 7
36
+ BLENDFACTOR_ONE_MINUS_DST_COLOR = 8
37
+ BLENDFACTOR_DST_ALPHA = 9
38
+ BLENDFACTOR_ONE_MINUS_DST_ALPHA = 10
39
+
40
+ # Typedef
41
+
42
+ typedef :uint, :SDL_BlendMode
43
+ typedef :int, :SDL_BlendOperation
44
+ typedef :int, :SDL_BlendFactor
45
+
46
+ # Struct
47
+
48
+
49
+ # Function
50
+
51
+ def self.setup_blendmode_symbols(output_error = false)
52
+ entries = [
53
+ [:ComposeCustomBlendMode, :SDL_ComposeCustomBlendMode, [:int, :int, :int, :int, :int, :int], :uint],
54
+ ]
55
+ entries.each do |entry|
56
+ attach_function entry[0], entry[1], entry[2], entry[3]
57
+ rescue FFI::NotFoundError => e
58
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
59
+ end
60
+ end
61
+
62
+ end
63
+
@@ -0,0 +1,67 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ CAMERA_POSITION_UNKNOWN = 0
17
+ CAMERA_POSITION_FRONT_FACING = 1
18
+ CAMERA_POSITION_BACK_FACING = 2
19
+
20
+ # Typedef
21
+
22
+ typedef :uint, :SDL_CameraID
23
+ typedef :int, :SDL_CameraPosition
24
+
25
+ # Struct
26
+
27
+ class CameraSpec < FFI::Struct
28
+ layout(
29
+ :format, :int,
30
+ :colorspace, :int,
31
+ :width, :int,
32
+ :height, :int,
33
+ :framerate_numerator, :int,
34
+ :framerate_denominator, :int,
35
+ )
36
+ end
37
+
38
+
39
+ # Function
40
+
41
+ def self.setup_camera_symbols(output_error = false)
42
+ entries = [
43
+ [:GetNumCameraDrivers, :SDL_GetNumCameraDrivers, [], :int],
44
+ [:GetCameraDriver, :SDL_GetCameraDriver, [:int], :pointer],
45
+ [:GetCurrentCameraDriver, :SDL_GetCurrentCameraDriver, [], :pointer],
46
+ [:GetCameras, :SDL_GetCameras, [:pointer], :pointer],
47
+ [:GetCameraSupportedFormats, :SDL_GetCameraSupportedFormats, [:uint, :pointer], :pointer],
48
+ [:GetCameraName, :SDL_GetCameraName, [:uint], :pointer],
49
+ [:GetCameraPosition, :SDL_GetCameraPosition, [:uint], :int],
50
+ [:OpenCamera, :SDL_OpenCamera, [:uint, :pointer], :pointer],
51
+ [:GetCameraPermissionState, :SDL_GetCameraPermissionState, [:pointer], :int],
52
+ [:GetCameraID, :SDL_GetCameraID, [:pointer], :uint],
53
+ [:GetCameraProperties, :SDL_GetCameraProperties, [:pointer], :uint],
54
+ [:GetCameraFormat, :SDL_GetCameraFormat, [:pointer, :pointer], :bool],
55
+ [:AcquireCameraFrame, :SDL_AcquireCameraFrame, [:pointer, :pointer], :pointer],
56
+ [:ReleaseCameraFrame, :SDL_ReleaseCameraFrame, [:pointer, :pointer], :void],
57
+ [:CloseCamera, :SDL_CloseCamera, [:pointer], :void],
58
+ ]
59
+ entries.each do |entry|
60
+ attach_function entry[0], entry[1], entry[2], entry[3]
61
+ rescue FFI::NotFoundError => e
62
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
63
+ end
64
+ end
65
+
66
+ end
67
+
@@ -0,0 +1,49 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
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
+ callback :SDL_ClipboardDataCallback, [:pointer, :pointer, :pointer], :pointer
20
+ callback :SDL_ClipboardCleanupCallback, [:pointer], :void
21
+
22
+ # Struct
23
+
24
+
25
+ # Function
26
+
27
+ def self.setup_clipboard_symbols(output_error = false)
28
+ entries = [
29
+ [:SetClipboardText, :SDL_SetClipboardText, [:pointer], :bool],
30
+ [:GetClipboardText, :SDL_GetClipboardText, [], :pointer],
31
+ [:HasClipboardText, :SDL_HasClipboardText, [], :bool],
32
+ [:SetPrimarySelectionText, :SDL_SetPrimarySelectionText, [:pointer], :bool],
33
+ [:GetPrimarySelectionText, :SDL_GetPrimarySelectionText, [], :pointer],
34
+ [:HasPrimarySelectionText, :SDL_HasPrimarySelectionText, [], :bool],
35
+ [:SetClipboardData, :SDL_SetClipboardData, [:SDL_ClipboardDataCallback, :SDL_ClipboardCleanupCallback, :pointer, :pointer, :ulong_long], :bool],
36
+ [:ClearClipboardData, :SDL_ClearClipboardData, [], :bool],
37
+ [:GetClipboardData, :SDL_GetClipboardData, [:pointer, :pointer], :pointer],
38
+ [:HasClipboardData, :SDL_HasClipboardData, [:pointer], :bool],
39
+ [:GetClipboardMimeTypes, :SDL_GetClipboardMimeTypes, [:pointer], :pointer],
40
+ ]
41
+ entries.each do |entry|
42
+ attach_function entry[0], entry[1], entry[2], entry[3]
43
+ rescue FFI::NotFoundError => e
44
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
45
+ end
46
+ end
47
+
48
+ end
49
+
@@ -0,0 +1,55 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ CACHELINE_SIZE = 128
14
+
15
+ # Enum
16
+
17
+
18
+ # Typedef
19
+
20
+
21
+ # Struct
22
+
23
+
24
+ # Function
25
+
26
+ def self.setup_cpuinfo_symbols(output_error = false)
27
+ entries = [
28
+ [:GetNumLogicalCPUCores, :SDL_GetNumLogicalCPUCores, [], :int],
29
+ [:GetCPUCacheLineSize, :SDL_GetCPUCacheLineSize, [], :int],
30
+ [:HasAltiVec, :SDL_HasAltiVec, [], :bool],
31
+ [:HasMMX, :SDL_HasMMX, [], :bool],
32
+ [:HasSSE, :SDL_HasSSE, [], :bool],
33
+ [:HasSSE2, :SDL_HasSSE2, [], :bool],
34
+ [:HasSSE3, :SDL_HasSSE3, [], :bool],
35
+ [:HasSSE41, :SDL_HasSSE41, [], :bool],
36
+ [:HasSSE42, :SDL_HasSSE42, [], :bool],
37
+ [:HasAVX, :SDL_HasAVX, [], :bool],
38
+ [:HasAVX2, :SDL_HasAVX2, [], :bool],
39
+ [:HasAVX512F, :SDL_HasAVX512F, [], :bool],
40
+ [:HasARMSIMD, :SDL_HasARMSIMD, [], :bool],
41
+ [:HasNEON, :SDL_HasNEON, [], :bool],
42
+ [:HasLSX, :SDL_HasLSX, [], :bool],
43
+ [:HasLASX, :SDL_HasLASX, [], :bool],
44
+ [:GetSystemRAM, :SDL_GetSystemRAM, [], :int],
45
+ [:GetSIMDAlignment, :SDL_GetSIMDAlignment, [], :ulong_long],
46
+ ]
47
+ entries.each do |entry|
48
+ attach_function entry[0], entry[1], entry[2], entry[3]
49
+ rescue FFI::NotFoundError => e
50
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
51
+ end
52
+ end
53
+
54
+ end
55
+
@@ -0,0 +1,60 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ PROP_FILE_DIALOG_FILTERS_POINTER = "SDL.filedialog.filters"
14
+ PROP_FILE_DIALOG_NFILTERS_NUMBER = "SDL.filedialog.nfilters"
15
+ PROP_FILE_DIALOG_WINDOW_POINTER = "SDL.filedialog.window"
16
+ PROP_FILE_DIALOG_LOCATION_STRING = "SDL.filedialog.location"
17
+ PROP_FILE_DIALOG_MANY_BOOLEAN = "SDL.filedialog.many"
18
+ PROP_FILE_DIALOG_TITLE_STRING = "SDL.filedialog.title"
19
+ PROP_FILE_DIALOG_ACCEPT_STRING = "SDL.filedialog.accept"
20
+ PROP_FILE_DIALOG_CANCEL_STRING = "SDL.filedialog.cancel"
21
+
22
+ # Enum
23
+
24
+ FILEDIALOG_OPENFILE = 0
25
+ FILEDIALOG_SAVEFILE = 1
26
+ FILEDIALOG_OPENFOLDER = 2
27
+
28
+ # Typedef
29
+
30
+ callback :SDL_DialogFileCallback, [:pointer, :pointer, :int], :void
31
+ typedef :int, :SDL_FileDialogType
32
+
33
+ # Struct
34
+
35
+ class DialogFileFilter < FFI::Struct
36
+ layout(
37
+ :name, :pointer,
38
+ :pattern, :pointer,
39
+ )
40
+ end
41
+
42
+
43
+ # Function
44
+
45
+ def self.setup_dialog_symbols(output_error = false)
46
+ entries = [
47
+ [:ShowOpenFileDialog, :SDL_ShowOpenFileDialog, [:SDL_DialogFileCallback, :pointer, :pointer, :pointer, :int, :pointer, :bool], :void],
48
+ [:ShowSaveFileDialog, :SDL_ShowSaveFileDialog, [:SDL_DialogFileCallback, :pointer, :pointer, :pointer, :int, :pointer], :void],
49
+ [:ShowOpenFolderDialog, :SDL_ShowOpenFolderDialog, [:SDL_DialogFileCallback, :pointer, :pointer, :pointer, :bool], :void],
50
+ [:ShowFileDialogWithProperties, :SDL_ShowFileDialogWithProperties, [:int, :SDL_DialogFileCallback, :pointer, :uint], :void],
51
+ ]
52
+ entries.each do |entry|
53
+ attach_function entry[0], entry[1], entry[2], entry[3]
54
+ rescue FFI::NotFoundError => e
55
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
56
+ end
57
+ end
58
+
59
+ end
60
+
@@ -0,0 +1,39 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ LIL_ENDIAN = 1234
14
+ BIG_ENDIAN = 4321
15
+
16
+ # Enum
17
+
18
+
19
+ # Typedef
20
+
21
+
22
+ # Struct
23
+
24
+
25
+ # Function
26
+
27
+ def self.setup_endian_symbols(output_error = false)
28
+ entries = [
29
+ [:SwapFloat, :SDL_SwapFloat, [:float], :float],
30
+ ]
31
+ entries.each do |entry|
32
+ attach_function entry[0], entry[1], entry[2], entry[3]
33
+ rescue FFI::NotFoundError => e
34
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
35
+ end
36
+ end
37
+
38
+ end
39
+
data/lib/sdl3_error.rb ADDED
@@ -0,0 +1,41 @@
1
+ # Ruby-SDL3 : SDL3 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl3-bindings
4
+ #
5
+ # [NOTICE] Autogenerated. Do not edit.
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_error_symbols(output_error = false)
26
+ entries = [
27
+ [:SetError, :SDL_SetError, [:pointer], :bool],
28
+ [:SetErrorV, :SDL_SetErrorV, [:pointer, :pointer], :bool],
29
+ [:OutOfMemory, :SDL_OutOfMemory, [], :bool],
30
+ [:GetError, :SDL_GetError, [], :pointer],
31
+ [:ClearError, :SDL_ClearError, [], :bool],
32
+ ]
33
+ entries.each do |entry|
34
+ attach_function entry[0], entry[1], entry[2], entry[3]
35
+ rescue FFI::NotFoundError => e
36
+ warn "[Warning] Failed to import #{entry[0]} (#{e})." if output_error
37
+ end
38
+ end
39
+
40
+ end
41
+