sdl2-bindings 0.0.8 → 0.1.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +124 -92
  3. data/LICENSE.txt +1 -1
  4. data/README.md +77 -53
  5. data/lib/sdl2.rb +131 -172
  6. data/lib/sdl2_audio.rb +261 -222
  7. data/lib/sdl2_blendmode.rb +72 -69
  8. data/lib/sdl2_clipboard.rb +56 -51
  9. data/lib/sdl2_cpuinfo.rb +129 -106
  10. data/lib/sdl2_error.rb +71 -64
  11. data/lib/sdl2_events.rb +564 -533
  12. data/lib/sdl2_filesystem.rb +52 -48
  13. data/lib/sdl2_framerate.rb +74 -67
  14. data/lib/sdl2_gamecontroller.rb +329 -274
  15. data/lib/sdl2_gesture.rb +61 -55
  16. data/lib/sdl2_gfxPrimitives.rb +283 -222
  17. data/lib/sdl2_haptic.rb +301 -269
  18. data/lib/sdl2_hidapi.rb +139 -118
  19. data/lib/sdl2_hints.rb +221 -197
  20. data/lib/sdl2_image.rb +232 -185
  21. data/lib/sdl2_imageFilter.rb +164 -132
  22. data/lib/sdl2_joystick.rb +294 -239
  23. data/lib/sdl2_keyboard.rb +125 -99
  24. data/lib/sdl2_keycode.rb +307 -305
  25. data/lib/sdl2_log.rb +131 -115
  26. data/lib/sdl2_main.rb +74 -67
  27. data/lib/sdl2_messagebox.rb +102 -98
  28. data/lib/sdl2_misc.rb +48 -45
  29. data/lib/sdl2_mixer.rb +392 -317
  30. data/lib/sdl2_mouse.rb +136 -117
  31. data/lib/sdl2_pixels.rb +240 -224
  32. data/lib/sdl2_platform.rb +48 -45
  33. data/lib/sdl2_power.rb +54 -51
  34. data/lib/sdl2_rect.rb +145 -102
  35. data/lib/sdl2_render.rb +408 -322
  36. data/lib/sdl2_rotozoom.rb +76 -66
  37. data/lib/sdl2_rwops.rb +238 -208
  38. data/lib/sdl2_scancode.rb +289 -287
  39. data/lib/sdl2_sensor.rb +115 -97
  40. data/lib/sdl2_shape.rb +83 -77
  41. data/lib/sdl2_sound.rb +154 -0
  42. data/lib/sdl2_stdinc.rb +556 -439
  43. data/lib/sdl2_surface.rb +229 -188
  44. data/lib/sdl2_syswm.rb +160 -156
  45. data/lib/sdl2_timer.rb +74 -65
  46. data/lib/sdl2_touch.rb +86 -75
  47. data/lib/sdl2_ttf.rb +358 -202
  48. data/lib/sdl2_version.rb +67 -62
  49. data/lib/sdl2_video.rb +540 -446
  50. data/lib/sdl2_vulkan.rb +72 -64
  51. metadata +19 -4
data/lib/sdl2_log.rb CHANGED
@@ -1,115 +1,131 @@
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_MAX_LOG_MESSAGE = 4096
14
-
15
- # Enum
16
-
17
- SDL_LOG_CATEGORY_APPLICATION = 0
18
- SDL_LOG_CATEGORY_ERROR = 1
19
- SDL_LOG_CATEGORY_ASSERT = 2
20
- SDL_LOG_CATEGORY_SYSTEM = 3
21
- SDL_LOG_CATEGORY_AUDIO = 4
22
- SDL_LOG_CATEGORY_VIDEO = 5
23
- SDL_LOG_CATEGORY_RENDER = 6
24
- SDL_LOG_CATEGORY_INPUT = 7
25
- SDL_LOG_CATEGORY_TEST = 8
26
- SDL_LOG_CATEGORY_RESERVED1 = 9
27
- SDL_LOG_CATEGORY_RESERVED2 = 10
28
- SDL_LOG_CATEGORY_RESERVED3 = 11
29
- SDL_LOG_CATEGORY_RESERVED4 = 12
30
- SDL_LOG_CATEGORY_RESERVED5 = 13
31
- SDL_LOG_CATEGORY_RESERVED6 = 14
32
- SDL_LOG_CATEGORY_RESERVED7 = 15
33
- SDL_LOG_CATEGORY_RESERVED8 = 16
34
- SDL_LOG_CATEGORY_RESERVED9 = 17
35
- SDL_LOG_CATEGORY_RESERVED10 = 18
36
- SDL_LOG_CATEGORY_CUSTOM = 19
37
- SDL_LOG_PRIORITY_VERBOSE = 1
38
- SDL_LOG_PRIORITY_DEBUG = 2
39
- SDL_LOG_PRIORITY_INFO = 3
40
- SDL_LOG_PRIORITY_WARN = 4
41
- SDL_LOG_PRIORITY_ERROR = 5
42
- SDL_LOG_PRIORITY_CRITICAL = 6
43
- SDL_NUM_LOG_PRIORITIES = 7
44
-
45
- # Typedef
46
-
47
- typedef :int, :SDL_LogCategory
48
- typedef :int, :SDL_LogPriority
49
- callback :SDL_LogOutputFunction, [:pointer, :int, :int, :pointer], :void
50
-
51
- # Struct
52
-
53
-
54
- # Function
55
-
56
- def self.setup_log_symbols()
57
- symbols = [
58
- :SDL_LogSetAllPriority,
59
- :SDL_LogSetPriority,
60
- :SDL_LogGetPriority,
61
- :SDL_LogResetPriorities,
62
- :SDL_Log,
63
- :SDL_LogVerbose,
64
- :SDL_LogDebug,
65
- :SDL_LogInfo,
66
- :SDL_LogWarn,
67
- :SDL_LogError,
68
- :SDL_LogCritical,
69
- :SDL_LogMessage,
70
- :SDL_LogGetOutputFunction,
71
- :SDL_LogSetOutputFunction,
72
- ]
73
- args = {
74
- :SDL_LogSetAllPriority => [:int],
75
- :SDL_LogSetPriority => [:int, :int],
76
- :SDL_LogGetPriority => [:int],
77
- :SDL_LogResetPriorities => [],
78
- :SDL_Log => [:pointer],
79
- :SDL_LogVerbose => [:int, :pointer],
80
- :SDL_LogDebug => [:int, :pointer],
81
- :SDL_LogInfo => [:int, :pointer],
82
- :SDL_LogWarn => [:int, :pointer],
83
- :SDL_LogError => [:int, :pointer],
84
- :SDL_LogCritical => [:int, :pointer],
85
- :SDL_LogMessage => [:int, :int, :pointer],
86
- :SDL_LogGetOutputFunction => [:pointer, :pointer],
87
- :SDL_LogSetOutputFunction => [:SDL_LogOutputFunction, :pointer],
88
- }
89
- retvals = {
90
- :SDL_LogSetAllPriority => :void,
91
- :SDL_LogSetPriority => :void,
92
- :SDL_LogGetPriority => :int,
93
- :SDL_LogResetPriorities => :void,
94
- :SDL_Log => :void,
95
- :SDL_LogVerbose => :void,
96
- :SDL_LogDebug => :void,
97
- :SDL_LogInfo => :void,
98
- :SDL_LogWarn => :void,
99
- :SDL_LogError => :void,
100
- :SDL_LogCritical => :void,
101
- :SDL_LogMessage => :void,
102
- :SDL_LogGetOutputFunction => :void,
103
- :SDL_LogSetOutputFunction => :void,
104
- }
105
- symbols.each do |sym|
106
- begin
107
- attach_function sym, args[sym], retvals[sym]
108
- rescue FFI::NotFoundError => error
109
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
110
- end
111
- end
112
- end
113
-
114
- end
115
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ MAX_LOG_MESSAGE = 4096
14
+
15
+ # Enum
16
+
17
+ LOG_CATEGORY_APPLICATION = 0
18
+ LOG_CATEGORY_ERROR = 1
19
+ LOG_CATEGORY_ASSERT = 2
20
+ LOG_CATEGORY_SYSTEM = 3
21
+ LOG_CATEGORY_AUDIO = 4
22
+ LOG_CATEGORY_VIDEO = 5
23
+ LOG_CATEGORY_RENDER = 6
24
+ LOG_CATEGORY_INPUT = 7
25
+ LOG_CATEGORY_TEST = 8
26
+ LOG_CATEGORY_RESERVED1 = 9
27
+ LOG_CATEGORY_RESERVED2 = 10
28
+ LOG_CATEGORY_RESERVED3 = 11
29
+ LOG_CATEGORY_RESERVED4 = 12
30
+ LOG_CATEGORY_RESERVED5 = 13
31
+ LOG_CATEGORY_RESERVED6 = 14
32
+ LOG_CATEGORY_RESERVED7 = 15
33
+ LOG_CATEGORY_RESERVED8 = 16
34
+ LOG_CATEGORY_RESERVED9 = 17
35
+ LOG_CATEGORY_RESERVED10 = 18
36
+ LOG_CATEGORY_CUSTOM = 19
37
+ LOG_PRIORITY_VERBOSE = 1
38
+ LOG_PRIORITY_DEBUG = 2
39
+ LOG_PRIORITY_INFO = 3
40
+ LOG_PRIORITY_WARN = 4
41
+ LOG_PRIORITY_ERROR = 5
42
+ LOG_PRIORITY_CRITICAL = 6
43
+ NUM_LOG_PRIORITIES = 7
44
+
45
+ # Typedef
46
+
47
+ typedef :int, :SDL_LogCategory
48
+ typedef :int, :SDL_LogPriority
49
+ callback :SDL_LogOutputFunction, [:pointer, :int, :int, :pointer], :void
50
+
51
+ # Struct
52
+
53
+
54
+ # Function
55
+
56
+ def self.setup_log_symbols(output_error = false)
57
+ symbols = [
58
+ :SDL_LogSetAllPriority,
59
+ :SDL_LogSetPriority,
60
+ :SDL_LogGetPriority,
61
+ :SDL_LogResetPriorities,
62
+ :SDL_Log,
63
+ :SDL_LogVerbose,
64
+ :SDL_LogDebug,
65
+ :SDL_LogInfo,
66
+ :SDL_LogWarn,
67
+ :SDL_LogError,
68
+ :SDL_LogCritical,
69
+ :SDL_LogMessage,
70
+ :SDL_LogGetOutputFunction,
71
+ :SDL_LogSetOutputFunction,
72
+ ]
73
+ apis = {
74
+ :SDL_LogSetAllPriority => :LogSetAllPriority,
75
+ :SDL_LogSetPriority => :LogSetPriority,
76
+ :SDL_LogGetPriority => :LogGetPriority,
77
+ :SDL_LogResetPriorities => :LogResetPriorities,
78
+ :SDL_Log => :Log,
79
+ :SDL_LogVerbose => :LogVerbose,
80
+ :SDL_LogDebug => :LogDebug,
81
+ :SDL_LogInfo => :LogInfo,
82
+ :SDL_LogWarn => :LogWarn,
83
+ :SDL_LogError => :LogError,
84
+ :SDL_LogCritical => :LogCritical,
85
+ :SDL_LogMessage => :LogMessage,
86
+ :SDL_LogGetOutputFunction => :LogGetOutputFunction,
87
+ :SDL_LogSetOutputFunction => :LogSetOutputFunction,
88
+ }
89
+ args = {
90
+ :SDL_LogSetAllPriority => [:int],
91
+ :SDL_LogSetPriority => [:int, :int],
92
+ :SDL_LogGetPriority => [:int],
93
+ :SDL_LogResetPriorities => [],
94
+ :SDL_Log => [:pointer],
95
+ :SDL_LogVerbose => [:int, :pointer],
96
+ :SDL_LogDebug => [:int, :pointer],
97
+ :SDL_LogInfo => [:int, :pointer],
98
+ :SDL_LogWarn => [:int, :pointer],
99
+ :SDL_LogError => [:int, :pointer],
100
+ :SDL_LogCritical => [:int, :pointer],
101
+ :SDL_LogMessage => [:int, :int, :pointer],
102
+ :SDL_LogGetOutputFunction => [:pointer, :pointer],
103
+ :SDL_LogSetOutputFunction => [:SDL_LogOutputFunction, :pointer],
104
+ }
105
+ retvals = {
106
+ :SDL_LogSetAllPriority => :void,
107
+ :SDL_LogSetPriority => :void,
108
+ :SDL_LogGetPriority => :int,
109
+ :SDL_LogResetPriorities => :void,
110
+ :SDL_Log => :void,
111
+ :SDL_LogVerbose => :void,
112
+ :SDL_LogDebug => :void,
113
+ :SDL_LogInfo => :void,
114
+ :SDL_LogWarn => :void,
115
+ :SDL_LogError => :void,
116
+ :SDL_LogCritical => :void,
117
+ :SDL_LogMessage => :void,
118
+ :SDL_LogGetOutputFunction => :void,
119
+ :SDL_LogSetOutputFunction => :void,
120
+ }
121
+ symbols.each do |sym|
122
+ begin
123
+ attach_function apis[sym], sym, args[sym], retvals[sym]
124
+ rescue FFI::NotFoundError => error
125
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
126
+ end
127
+ end
128
+ end
129
+
130
+ end
131
+
data/lib/sdl2_main.rb CHANGED
@@ -1,67 +1,74 @@
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_INIT_TIMER = 0x00000001
14
- SDL_INIT_AUDIO = 0x00000010
15
- SDL_INIT_VIDEO = 0x00000020
16
- SDL_INIT_JOYSTICK = 0x00000200
17
- SDL_INIT_HAPTIC = 0x00001000
18
- SDL_INIT_GAMECONTROLLER = 0x00002000
19
- SDL_INIT_EVENTS = 0x00004000
20
- SDL_INIT_SENSOR = 0x00008000
21
- SDL_INIT_NOPARACHUTE = 0x00100000
22
- SDL_INIT_EVERYTHING = ( SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR )
23
-
24
- # Enum
25
-
26
-
27
- # Typedef
28
-
29
-
30
- # Struct
31
-
32
-
33
- # Function
34
-
35
- def self.setup_main_symbols()
36
- symbols = [
37
- :SDL_Init,
38
- :SDL_InitSubSystem,
39
- :SDL_QuitSubSystem,
40
- :SDL_WasInit,
41
- :SDL_Quit,
42
- ]
43
- args = {
44
- :SDL_Init => [:uint],
45
- :SDL_InitSubSystem => [:uint],
46
- :SDL_QuitSubSystem => [:uint],
47
- :SDL_WasInit => [:uint],
48
- :SDL_Quit => [],
49
- }
50
- retvals = {
51
- :SDL_Init => :int,
52
- :SDL_InitSubSystem => :int,
53
- :SDL_QuitSubSystem => :void,
54
- :SDL_WasInit => :uint,
55
- :SDL_Quit => :void,
56
- }
57
- symbols.each do |sym|
58
- begin
59
- attach_function sym, args[sym], retvals[sym]
60
- rescue FFI::NotFoundError => error
61
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
62
- end
63
- end
64
- end
65
-
66
- end
67
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ INIT_TIMER = 0x00000001
14
+ INIT_AUDIO = 0x00000010
15
+ INIT_VIDEO = 0x00000020
16
+ INIT_JOYSTICK = 0x00000200
17
+ INIT_HAPTIC = 0x00001000
18
+ INIT_GAMECONTROLLER = 0x00002000
19
+ INIT_EVENTS = 0x00004000
20
+ INIT_SENSOR = 0x00008000
21
+ INIT_NOPARACHUTE = 0x00100000
22
+ INIT_EVERYTHING = ( INIT_TIMER | INIT_AUDIO | INIT_VIDEO | INIT_EVENTS | INIT_JOYSTICK | INIT_HAPTIC | INIT_GAMECONTROLLER | INIT_SENSOR )
23
+
24
+ # Enum
25
+
26
+
27
+ # Typedef
28
+
29
+
30
+ # Struct
31
+
32
+
33
+ # Function
34
+
35
+ def self.setup_main_symbols(output_error = false)
36
+ symbols = [
37
+ :SDL_Init,
38
+ :SDL_InitSubSystem,
39
+ :SDL_QuitSubSystem,
40
+ :SDL_WasInit,
41
+ :SDL_Quit,
42
+ ]
43
+ apis = {
44
+ :SDL_Init => :Init,
45
+ :SDL_InitSubSystem => :InitSubSystem,
46
+ :SDL_QuitSubSystem => :QuitSubSystem,
47
+ :SDL_WasInit => :WasInit,
48
+ :SDL_Quit => :Quit,
49
+ }
50
+ args = {
51
+ :SDL_Init => [:uint],
52
+ :SDL_InitSubSystem => [:uint],
53
+ :SDL_QuitSubSystem => [:uint],
54
+ :SDL_WasInit => [:uint],
55
+ :SDL_Quit => [],
56
+ }
57
+ retvals = {
58
+ :SDL_Init => :int,
59
+ :SDL_InitSubSystem => :int,
60
+ :SDL_QuitSubSystem => :void,
61
+ :SDL_WasInit => :uint,
62
+ :SDL_Quit => :void,
63
+ }
64
+ symbols.each do |sym|
65
+ begin
66
+ attach_function apis[sym], sym, args[sym], retvals[sym]
67
+ rescue FFI::NotFoundError => error
68
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
69
+ end
70
+ end
71
+ end
72
+
73
+ end
74
+
@@ -1,98 +1,102 @@
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
-
14
- # Enum
15
-
16
- SDL_MESSAGEBOX_ERROR = 16
17
- SDL_MESSAGEBOX_WARNING = 32
18
- SDL_MESSAGEBOX_INFORMATION = 64
19
- SDL_MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 128
20
- SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 256
21
- SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 1
22
- SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 2
23
- SDL_MESSAGEBOX_COLOR_BACKGROUND = 0
24
- SDL_MESSAGEBOX_COLOR_TEXT = 1
25
- SDL_MESSAGEBOX_COLOR_BUTTON_BORDER = 2
26
- SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
27
- SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
28
- SDL_MESSAGEBOX_COLOR_MAX = 5
29
-
30
- # Typedef
31
-
32
- typedef :int, :SDL_MessageBoxFlags
33
- typedef :int, :SDL_MessageBoxButtonFlags
34
- typedef :int, :SDL_MessageBoxColorType
35
-
36
- # Struct
37
-
38
- class SDL_MessageBoxButtonData < FFI::Struct
39
- layout(
40
- :flags, :uint,
41
- :buttonid, :int,
42
- :text, :pointer,
43
- )
44
- end
45
-
46
- class SDL_MessageBoxColor < FFI::Struct
47
- layout(
48
- :r, :uchar,
49
- :g, :uchar,
50
- :b, :uchar,
51
- )
52
- end
53
-
54
- class SDL_MessageBoxColorScheme < FFI::Struct
55
- layout(
56
- :colors, [SDL_MessageBoxColor, 5],
57
- )
58
- end
59
-
60
- class SDL_MessageBoxData < FFI::Struct
61
- layout(
62
- :flags, :uint,
63
- :window, :pointer,
64
- :title, :pointer,
65
- :message, :pointer,
66
- :numbuttons, :int,
67
- :buttons, :pointer,
68
- :colorScheme, :pointer,
69
- )
70
- end
71
-
72
-
73
- # Function
74
-
75
- def self.setup_messagebox_symbols()
76
- symbols = [
77
- :SDL_ShowMessageBox,
78
- :SDL_ShowSimpleMessageBox,
79
- ]
80
- args = {
81
- :SDL_ShowMessageBox => [:pointer, :pointer],
82
- :SDL_ShowSimpleMessageBox => [:uint, :pointer, :pointer, :pointer],
83
- }
84
- retvals = {
85
- :SDL_ShowMessageBox => :int,
86
- :SDL_ShowSimpleMessageBox => :int,
87
- }
88
- symbols.each do |sym|
89
- begin
90
- attach_function sym, args[sym], retvals[sym]
91
- rescue FFI::NotFoundError => error
92
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
93
- end
94
- end
95
- end
96
-
97
- end
98
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ MESSAGEBOX_ERROR = 16
17
+ MESSAGEBOX_WARNING = 32
18
+ MESSAGEBOX_INFORMATION = 64
19
+ MESSAGEBOX_BUTTONS_LEFT_TO_RIGHT = 128
20
+ MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT = 256
21
+ MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 1
22
+ MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 2
23
+ MESSAGEBOX_COLOR_BACKGROUND = 0
24
+ MESSAGEBOX_COLOR_TEXT = 1
25
+ MESSAGEBOX_COLOR_BUTTON_BORDER = 2
26
+ MESSAGEBOX_COLOR_BUTTON_BACKGROUND = 3
27
+ MESSAGEBOX_COLOR_BUTTON_SELECTED = 4
28
+ MESSAGEBOX_COLOR_MAX = 5
29
+
30
+ # Typedef
31
+
32
+ typedef :int, :SDL_MessageBoxFlags
33
+ typedef :int, :SDL_MessageBoxButtonFlags
34
+ typedef :int, :SDL_MessageBoxColorType
35
+
36
+ # Struct
37
+
38
+ class MessageBoxButtonData < FFI::Struct
39
+ layout(
40
+ :flags, :uint,
41
+ :buttonid, :int,
42
+ :text, :pointer,
43
+ )
44
+ end
45
+
46
+ class MessageBoxColor < FFI::Struct
47
+ layout(
48
+ :r, :uchar,
49
+ :g, :uchar,
50
+ :b, :uchar,
51
+ )
52
+ end
53
+
54
+ class MessageBoxColorScheme < FFI::Struct
55
+ layout(
56
+ :colors, [MessageBoxColor, 5],
57
+ )
58
+ end
59
+
60
+ class MessageBoxData < FFI::Struct
61
+ layout(
62
+ :flags, :uint,
63
+ :window, :pointer,
64
+ :title, :pointer,
65
+ :message, :pointer,
66
+ :numbuttons, :int,
67
+ :buttons, :pointer,
68
+ :colorScheme, :pointer,
69
+ )
70
+ end
71
+
72
+
73
+ # Function
74
+
75
+ def self.setup_messagebox_symbols(output_error = false)
76
+ symbols = [
77
+ :SDL_ShowMessageBox,
78
+ :SDL_ShowSimpleMessageBox,
79
+ ]
80
+ apis = {
81
+ :SDL_ShowMessageBox => :ShowMessageBox,
82
+ :SDL_ShowSimpleMessageBox => :ShowSimpleMessageBox,
83
+ }
84
+ args = {
85
+ :SDL_ShowMessageBox => [:pointer, :pointer],
86
+ :SDL_ShowSimpleMessageBox => [:uint, :pointer, :pointer, :pointer],
87
+ }
88
+ retvals = {
89
+ :SDL_ShowMessageBox => :int,
90
+ :SDL_ShowSimpleMessageBox => :int,
91
+ }
92
+ symbols.each do |sym|
93
+ begin
94
+ attach_function apis[sym], sym, args[sym], retvals[sym]
95
+ rescue FFI::NotFoundError => error
96
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
97
+ end
98
+ end
99
+ end
100
+
101
+ end
102
+
data/lib/sdl2_misc.rb CHANGED
@@ -1,45 +1,48 @@
1
- # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/sdl2-bindings
4
- #
5
- # [NOTICE] This is an automatically generated file.
6
-
7
- require 'ffi'
8
-
9
- module SDL2
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_misc_symbols()
26
- symbols = [
27
- :SDL_OpenURL,
28
- ]
29
- args = {
30
- :SDL_OpenURL => [:pointer],
31
- }
32
- retvals = {
33
- :SDL_OpenURL => :int,
34
- }
35
- symbols.each do |sym|
36
- begin
37
- attach_function sym, args[sym], retvals[sym]
38
- rescue FFI::NotFoundError => error
39
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
40
- end
41
- end
42
- end
43
-
44
- end
45
-
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module SDL
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+
23
+ # Function
24
+
25
+ def self.setup_misc_symbols(output_error = false)
26
+ symbols = [
27
+ :SDL_OpenURL,
28
+ ]
29
+ apis = {
30
+ :SDL_OpenURL => :OpenURL,
31
+ }
32
+ args = {
33
+ :SDL_OpenURL => [:pointer],
34
+ }
35
+ retvals = {
36
+ :SDL_OpenURL => :int,
37
+ }
38
+ symbols.each do |sym|
39
+ begin
40
+ attach_function apis[sym], sym, args[sym], retvals[sym]
41
+ rescue FFI::NotFoundError => error
42
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
43
+ end
44
+ end
45
+ end
46
+
47
+ end
48
+