sdl2-bindings 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +140 -134
  3. data/LICENSE.txt +0 -0
  4. data/README.md +93 -86
  5. data/lib/sdl2.rb +131 -131
  6. data/lib/sdl2_audio.rb +265 -261
  7. data/lib/sdl2_blendmode.rb +72 -72
  8. data/lib/sdl2_clipboard.rb +56 -56
  9. data/lib/sdl2_cpuinfo.rb +137 -129
  10. data/lib/sdl2_error.rb +71 -71
  11. data/lib/sdl2_events.rb +575 -564
  12. data/lib/sdl2_filesystem.rb +52 -52
  13. data/lib/sdl2_framerate.rb +74 -74
  14. data/lib/sdl2_gamecontroller.rb +345 -329
  15. data/lib/sdl2_gesture.rb +61 -61
  16. data/lib/sdl2_gfxPrimitives.rb +283 -283
  17. data/lib/sdl2_guid.rb +58 -0
  18. data/lib/sdl2_haptic.rb +301 -301
  19. data/lib/sdl2_hidapi.rb +139 -139
  20. data/lib/sdl2_hints.rb +240 -221
  21. data/lib/sdl2_image.rb +296 -296
  22. data/lib/sdl2_imageFilter.rb +164 -164
  23. data/lib/sdl2_joystick.rb +332 -294
  24. data/lib/sdl2_keyboard.rb +129 -125
  25. data/lib/sdl2_keycode.rb +311 -307
  26. data/lib/sdl2_log.rb +131 -131
  27. data/lib/sdl2_main.rb +74 -74
  28. data/lib/sdl2_messagebox.rb +102 -102
  29. data/lib/sdl2_misc.rb +48 -48
  30. data/lib/sdl2_mixer.rb +464 -464
  31. data/lib/sdl2_mouse.rb +136 -136
  32. data/lib/sdl2_pixels.rb +240 -240
  33. data/lib/sdl2_platform.rb +48 -48
  34. data/lib/sdl2_power.rb +54 -54
  35. data/lib/sdl2_rect.rb +145 -145
  36. data/lib/sdl2_render.rb +408 -408
  37. data/lib/sdl2_rotozoom.rb +76 -76
  38. data/lib/sdl2_rwops.rb +242 -242
  39. data/lib/sdl2_scancode.rb +293 -289
  40. data/lib/sdl2_sensor.rb +115 -115
  41. data/lib/sdl2_shape.rb +83 -83
  42. data/lib/sdl2_sound.rb +154 -154
  43. data/lib/sdl2_stdinc.rb +564 -548
  44. data/lib/sdl2_surface.rb +229 -229
  45. data/lib/sdl2_syswm.rb +160 -160
  46. data/lib/sdl2_timer.rb +74 -74
  47. data/lib/sdl2_touch.rb +86 -86
  48. data/lib/sdl2_ttf.rb +414 -414
  49. data/lib/sdl2_version.rb +67 -67
  50. data/lib/sdl2_video.rb +549 -540
  51. data/lib/sdl2_vulkan.rb +72 -72
  52. metadata +4 -3
@@ -1,72 +1,72 @@
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
- BLENDMODE_NONE = 0
17
- BLENDMODE_BLEND = 1
18
- BLENDMODE_ADD = 2
19
- BLENDMODE_MOD = 4
20
- BLENDMODE_MUL = 8
21
- BLENDMODE_INVALID = 2147483647
22
- BLENDOPERATION_ADD = 1
23
- BLENDOPERATION_SUBTRACT = 2
24
- BLENDOPERATION_REV_SUBTRACT = 3
25
- BLENDOPERATION_MINIMUM = 4
26
- BLENDOPERATION_MAXIMUM = 5
27
- BLENDFACTOR_ZERO = 1
28
- BLENDFACTOR_ONE = 2
29
- BLENDFACTOR_SRC_COLOR = 3
30
- BLENDFACTOR_ONE_MINUS_SRC_COLOR = 4
31
- BLENDFACTOR_SRC_ALPHA = 5
32
- BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 6
33
- BLENDFACTOR_DST_COLOR = 7
34
- BLENDFACTOR_ONE_MINUS_DST_COLOR = 8
35
- BLENDFACTOR_DST_ALPHA = 9
36
- BLENDFACTOR_ONE_MINUS_DST_ALPHA = 10
37
-
38
- # Typedef
39
-
40
- typedef :int, :SDL_BlendMode
41
- typedef :int, :SDL_BlendOperation
42
- typedef :int, :SDL_BlendFactor
43
-
44
- # Struct
45
-
46
-
47
- # Function
48
-
49
- def self.setup_blendmode_symbols(output_error = false)
50
- symbols = [
51
- :SDL_ComposeCustomBlendMode,
52
- ]
53
- apis = {
54
- :SDL_ComposeCustomBlendMode => :ComposeCustomBlendMode,
55
- }
56
- args = {
57
- :SDL_ComposeCustomBlendMode => [:int, :int, :int, :int, :int, :int],
58
- }
59
- retvals = {
60
- :SDL_ComposeCustomBlendMode => :int,
61
- }
62
- symbols.each do |sym|
63
- begin
64
- attach_function apis[sym], sym, args[sym], retvals[sym]
65
- rescue FFI::NotFoundError => error
66
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
67
- end
68
- end
69
- end
70
-
71
- end
72
-
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
+ BLENDMODE_NONE = 0
17
+ BLENDMODE_BLEND = 1
18
+ BLENDMODE_ADD = 2
19
+ BLENDMODE_MOD = 4
20
+ BLENDMODE_MUL = 8
21
+ BLENDMODE_INVALID = 2147483647
22
+ BLENDOPERATION_ADD = 1
23
+ BLENDOPERATION_SUBTRACT = 2
24
+ BLENDOPERATION_REV_SUBTRACT = 3
25
+ BLENDOPERATION_MINIMUM = 4
26
+ BLENDOPERATION_MAXIMUM = 5
27
+ BLENDFACTOR_ZERO = 1
28
+ BLENDFACTOR_ONE = 2
29
+ BLENDFACTOR_SRC_COLOR = 3
30
+ BLENDFACTOR_ONE_MINUS_SRC_COLOR = 4
31
+ BLENDFACTOR_SRC_ALPHA = 5
32
+ BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 6
33
+ BLENDFACTOR_DST_COLOR = 7
34
+ BLENDFACTOR_ONE_MINUS_DST_COLOR = 8
35
+ BLENDFACTOR_DST_ALPHA = 9
36
+ BLENDFACTOR_ONE_MINUS_DST_ALPHA = 10
37
+
38
+ # Typedef
39
+
40
+ typedef :int, :SDL_BlendMode
41
+ typedef :int, :SDL_BlendOperation
42
+ typedef :int, :SDL_BlendFactor
43
+
44
+ # Struct
45
+
46
+
47
+ # Function
48
+
49
+ def self.setup_blendmode_symbols(output_error = false)
50
+ symbols = [
51
+ :SDL_ComposeCustomBlendMode,
52
+ ]
53
+ apis = {
54
+ :SDL_ComposeCustomBlendMode => :ComposeCustomBlendMode,
55
+ }
56
+ args = {
57
+ :SDL_ComposeCustomBlendMode => [:int, :int, :int, :int, :int, :int],
58
+ }
59
+ retvals = {
60
+ :SDL_ComposeCustomBlendMode => :int,
61
+ }
62
+ symbols.each do |sym|
63
+ begin
64
+ attach_function apis[sym], sym, args[sym], retvals[sym]
65
+ rescue FFI::NotFoundError => error
66
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
67
+ end
68
+ end
69
+ end
70
+
71
+ end
72
+
@@ -1,56 +1,56 @@
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_clipboard_symbols(output_error = false)
26
- symbols = [
27
- :SDL_SetClipboardText,
28
- :SDL_GetClipboardText,
29
- :SDL_HasClipboardText,
30
- ]
31
- apis = {
32
- :SDL_SetClipboardText => :SetClipboardText,
33
- :SDL_GetClipboardText => :GetClipboardText,
34
- :SDL_HasClipboardText => :HasClipboardText,
35
- }
36
- args = {
37
- :SDL_SetClipboardText => [:pointer],
38
- :SDL_GetClipboardText => [],
39
- :SDL_HasClipboardText => [],
40
- }
41
- retvals = {
42
- :SDL_SetClipboardText => :int,
43
- :SDL_GetClipboardText => :pointer,
44
- :SDL_HasClipboardText => :int,
45
- }
46
- symbols.each do |sym|
47
- begin
48
- attach_function apis[sym], sym, args[sym], retvals[sym]
49
- rescue FFI::NotFoundError => error
50
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
51
- end
52
- end
53
- end
54
-
55
- end
56
-
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_clipboard_symbols(output_error = false)
26
+ symbols = [
27
+ :SDL_SetClipboardText,
28
+ :SDL_GetClipboardText,
29
+ :SDL_HasClipboardText,
30
+ ]
31
+ apis = {
32
+ :SDL_SetClipboardText => :SetClipboardText,
33
+ :SDL_GetClipboardText => :GetClipboardText,
34
+ :SDL_HasClipboardText => :HasClipboardText,
35
+ }
36
+ args = {
37
+ :SDL_SetClipboardText => [:pointer],
38
+ :SDL_GetClipboardText => [],
39
+ :SDL_HasClipboardText => [],
40
+ }
41
+ retvals = {
42
+ :SDL_SetClipboardText => :int,
43
+ :SDL_GetClipboardText => :pointer,
44
+ :SDL_HasClipboardText => :int,
45
+ }
46
+ symbols.each do |sym|
47
+ begin
48
+ attach_function apis[sym], sym, args[sym], retvals[sym]
49
+ rescue FFI::NotFoundError => error
50
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
51
+ end
52
+ end
53
+ end
54
+
55
+ end
56
+
data/lib/sdl2_cpuinfo.rb CHANGED
@@ -1,129 +1,137 @@
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
- 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
- symbols = [
28
- :SDL_GetCPUCount,
29
- :SDL_GetCPUCacheLineSize,
30
- :SDL_HasRDTSC,
31
- :SDL_HasAltiVec,
32
- :SDL_HasMMX,
33
- :SDL_Has3DNow,
34
- :SDL_HasSSE,
35
- :SDL_HasSSE2,
36
- :SDL_HasSSE3,
37
- :SDL_HasSSE41,
38
- :SDL_HasSSE42,
39
- :SDL_HasAVX,
40
- :SDL_HasAVX2,
41
- :SDL_HasAVX512F,
42
- :SDL_HasARMSIMD,
43
- :SDL_HasNEON,
44
- :SDL_GetSystemRAM,
45
- :SDL_SIMDGetAlignment,
46
- :SDL_SIMDAlloc,
47
- :SDL_SIMDRealloc,
48
- :SDL_SIMDFree,
49
- ]
50
- apis = {
51
- :SDL_GetCPUCount => :GetCPUCount,
52
- :SDL_GetCPUCacheLineSize => :GetCPUCacheLineSize,
53
- :SDL_HasRDTSC => :HasRDTSC,
54
- :SDL_HasAltiVec => :HasAltiVec,
55
- :SDL_HasMMX => :HasMMX,
56
- :SDL_Has3DNow => :Has3DNow,
57
- :SDL_HasSSE => :HasSSE,
58
- :SDL_HasSSE2 => :HasSSE2,
59
- :SDL_HasSSE3 => :HasSSE3,
60
- :SDL_HasSSE41 => :HasSSE41,
61
- :SDL_HasSSE42 => :HasSSE42,
62
- :SDL_HasAVX => :HasAVX,
63
- :SDL_HasAVX2 => :HasAVX2,
64
- :SDL_HasAVX512F => :HasAVX512F,
65
- :SDL_HasARMSIMD => :HasARMSIMD,
66
- :SDL_HasNEON => :HasNEON,
67
- :SDL_GetSystemRAM => :GetSystemRAM,
68
- :SDL_SIMDGetAlignment => :SIMDGetAlignment,
69
- :SDL_SIMDAlloc => :SIMDAlloc,
70
- :SDL_SIMDRealloc => :SIMDRealloc,
71
- :SDL_SIMDFree => :SIMDFree,
72
- }
73
- args = {
74
- :SDL_GetCPUCount => [],
75
- :SDL_GetCPUCacheLineSize => [],
76
- :SDL_HasRDTSC => [],
77
- :SDL_HasAltiVec => [],
78
- :SDL_HasMMX => [],
79
- :SDL_Has3DNow => [],
80
- :SDL_HasSSE => [],
81
- :SDL_HasSSE2 => [],
82
- :SDL_HasSSE3 => [],
83
- :SDL_HasSSE41 => [],
84
- :SDL_HasSSE42 => [],
85
- :SDL_HasAVX => [],
86
- :SDL_HasAVX2 => [],
87
- :SDL_HasAVX512F => [],
88
- :SDL_HasARMSIMD => [],
89
- :SDL_HasNEON => [],
90
- :SDL_GetSystemRAM => [],
91
- :SDL_SIMDGetAlignment => [],
92
- :SDL_SIMDAlloc => [:ulong],
93
- :SDL_SIMDRealloc => [:pointer, :ulong],
94
- :SDL_SIMDFree => [:pointer],
95
- }
96
- retvals = {
97
- :SDL_GetCPUCount => :int,
98
- :SDL_GetCPUCacheLineSize => :int,
99
- :SDL_HasRDTSC => :int,
100
- :SDL_HasAltiVec => :int,
101
- :SDL_HasMMX => :int,
102
- :SDL_Has3DNow => :int,
103
- :SDL_HasSSE => :int,
104
- :SDL_HasSSE2 => :int,
105
- :SDL_HasSSE3 => :int,
106
- :SDL_HasSSE41 => :int,
107
- :SDL_HasSSE42 => :int,
108
- :SDL_HasAVX => :int,
109
- :SDL_HasAVX2 => :int,
110
- :SDL_HasAVX512F => :int,
111
- :SDL_HasARMSIMD => :int,
112
- :SDL_HasNEON => :int,
113
- :SDL_GetSystemRAM => :int,
114
- :SDL_SIMDGetAlignment => :size_t,
115
- :SDL_SIMDAlloc => :pointer,
116
- :SDL_SIMDRealloc => :pointer,
117
- :SDL_SIMDFree => :void,
118
- }
119
- symbols.each do |sym|
120
- begin
121
- attach_function apis[sym], sym, args[sym], retvals[sym]
122
- rescue FFI::NotFoundError => error
123
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
124
- end
125
- end
126
- end
127
-
128
- end
129
-
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
+ 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
+ symbols = [
28
+ :SDL_GetCPUCount,
29
+ :SDL_GetCPUCacheLineSize,
30
+ :SDL_HasRDTSC,
31
+ :SDL_HasAltiVec,
32
+ :SDL_HasMMX,
33
+ :SDL_Has3DNow,
34
+ :SDL_HasSSE,
35
+ :SDL_HasSSE2,
36
+ :SDL_HasSSE3,
37
+ :SDL_HasSSE41,
38
+ :SDL_HasSSE42,
39
+ :SDL_HasAVX,
40
+ :SDL_HasAVX2,
41
+ :SDL_HasAVX512F,
42
+ :SDL_HasARMSIMD,
43
+ :SDL_HasNEON,
44
+ :SDL_HasLSX,
45
+ :SDL_HasLASX,
46
+ :SDL_GetSystemRAM,
47
+ :SDL_SIMDGetAlignment,
48
+ :SDL_SIMDAlloc,
49
+ :SDL_SIMDRealloc,
50
+ :SDL_SIMDFree,
51
+ ]
52
+ apis = {
53
+ :SDL_GetCPUCount => :GetCPUCount,
54
+ :SDL_GetCPUCacheLineSize => :GetCPUCacheLineSize,
55
+ :SDL_HasRDTSC => :HasRDTSC,
56
+ :SDL_HasAltiVec => :HasAltiVec,
57
+ :SDL_HasMMX => :HasMMX,
58
+ :SDL_Has3DNow => :Has3DNow,
59
+ :SDL_HasSSE => :HasSSE,
60
+ :SDL_HasSSE2 => :HasSSE2,
61
+ :SDL_HasSSE3 => :HasSSE3,
62
+ :SDL_HasSSE41 => :HasSSE41,
63
+ :SDL_HasSSE42 => :HasSSE42,
64
+ :SDL_HasAVX => :HasAVX,
65
+ :SDL_HasAVX2 => :HasAVX2,
66
+ :SDL_HasAVX512F => :HasAVX512F,
67
+ :SDL_HasARMSIMD => :HasARMSIMD,
68
+ :SDL_HasNEON => :HasNEON,
69
+ :SDL_HasLSX => :HasLSX,
70
+ :SDL_HasLASX => :HasLASX,
71
+ :SDL_GetSystemRAM => :GetSystemRAM,
72
+ :SDL_SIMDGetAlignment => :SIMDGetAlignment,
73
+ :SDL_SIMDAlloc => :SIMDAlloc,
74
+ :SDL_SIMDRealloc => :SIMDRealloc,
75
+ :SDL_SIMDFree => :SIMDFree,
76
+ }
77
+ args = {
78
+ :SDL_GetCPUCount => [],
79
+ :SDL_GetCPUCacheLineSize => [],
80
+ :SDL_HasRDTSC => [],
81
+ :SDL_HasAltiVec => [],
82
+ :SDL_HasMMX => [],
83
+ :SDL_Has3DNow => [],
84
+ :SDL_HasSSE => [],
85
+ :SDL_HasSSE2 => [],
86
+ :SDL_HasSSE3 => [],
87
+ :SDL_HasSSE41 => [],
88
+ :SDL_HasSSE42 => [],
89
+ :SDL_HasAVX => [],
90
+ :SDL_HasAVX2 => [],
91
+ :SDL_HasAVX512F => [],
92
+ :SDL_HasARMSIMD => [],
93
+ :SDL_HasNEON => [],
94
+ :SDL_HasLSX => [],
95
+ :SDL_HasLASX => [],
96
+ :SDL_GetSystemRAM => [],
97
+ :SDL_SIMDGetAlignment => [],
98
+ :SDL_SIMDAlloc => [:ulong],
99
+ :SDL_SIMDRealloc => [:pointer, :ulong],
100
+ :SDL_SIMDFree => [:pointer],
101
+ }
102
+ retvals = {
103
+ :SDL_GetCPUCount => :int,
104
+ :SDL_GetCPUCacheLineSize => :int,
105
+ :SDL_HasRDTSC => :int,
106
+ :SDL_HasAltiVec => :int,
107
+ :SDL_HasMMX => :int,
108
+ :SDL_Has3DNow => :int,
109
+ :SDL_HasSSE => :int,
110
+ :SDL_HasSSE2 => :int,
111
+ :SDL_HasSSE3 => :int,
112
+ :SDL_HasSSE41 => :int,
113
+ :SDL_HasSSE42 => :int,
114
+ :SDL_HasAVX => :int,
115
+ :SDL_HasAVX2 => :int,
116
+ :SDL_HasAVX512F => :int,
117
+ :SDL_HasARMSIMD => :int,
118
+ :SDL_HasNEON => :int,
119
+ :SDL_HasLSX => :int,
120
+ :SDL_HasLASX => :int,
121
+ :SDL_GetSystemRAM => :int,
122
+ :SDL_SIMDGetAlignment => :size_t,
123
+ :SDL_SIMDAlloc => :pointer,
124
+ :SDL_SIMDRealloc => :pointer,
125
+ :SDL_SIMDFree => :void,
126
+ }
127
+ symbols.each do |sym|
128
+ begin
129
+ attach_function apis[sym], sym, args[sym], retvals[sym]
130
+ rescue FFI::NotFoundError => error
131
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
132
+ end
133
+ end
134
+ end
135
+
136
+ end
137
+
data/lib/sdl2_error.rb CHANGED
@@ -1,71 +1,71 @@
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
- ENOMEM = 0
17
- EFREAD = 1
18
- EFWRITE = 2
19
- EFSEEK = 3
20
- UNSUPPORTED = 4
21
- LASTERROR = 5
22
-
23
- # Typedef
24
-
25
- typedef :int, :SDL_errorcode
26
-
27
- # Struct
28
-
29
-
30
- # Function
31
-
32
- def self.setup_error_symbols(output_error = false)
33
- symbols = [
34
- :SDL_SetError,
35
- :SDL_GetError,
36
- :SDL_GetErrorMsg,
37
- :SDL_ClearError,
38
- :SDL_Error,
39
- ]
40
- apis = {
41
- :SDL_SetError => :SetError,
42
- :SDL_GetError => :GetError,
43
- :SDL_GetErrorMsg => :GetErrorMsg,
44
- :SDL_ClearError => :ClearError,
45
- :SDL_Error => :Error,
46
- }
47
- args = {
48
- :SDL_SetError => [:pointer],
49
- :SDL_GetError => [],
50
- :SDL_GetErrorMsg => [:pointer, :int],
51
- :SDL_ClearError => [],
52
- :SDL_Error => [:int],
53
- }
54
- retvals = {
55
- :SDL_SetError => :int,
56
- :SDL_GetError => :pointer,
57
- :SDL_GetErrorMsg => :pointer,
58
- :SDL_ClearError => :void,
59
- :SDL_Error => :int,
60
- }
61
- symbols.each do |sym|
62
- begin
63
- attach_function apis[sym], sym, args[sym], retvals[sym]
64
- rescue FFI::NotFoundError => error
65
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
66
- end
67
- end
68
- end
69
-
70
- end
71
-
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
+ ENOMEM = 0
17
+ EFREAD = 1
18
+ EFWRITE = 2
19
+ EFSEEK = 3
20
+ UNSUPPORTED = 4
21
+ LASTERROR = 5
22
+
23
+ # Typedef
24
+
25
+ typedef :int, :SDL_errorcode
26
+
27
+ # Struct
28
+
29
+
30
+ # Function
31
+
32
+ def self.setup_error_symbols(output_error = false)
33
+ symbols = [
34
+ :SDL_SetError,
35
+ :SDL_GetError,
36
+ :SDL_GetErrorMsg,
37
+ :SDL_ClearError,
38
+ :SDL_Error,
39
+ ]
40
+ apis = {
41
+ :SDL_SetError => :SetError,
42
+ :SDL_GetError => :GetError,
43
+ :SDL_GetErrorMsg => :GetErrorMsg,
44
+ :SDL_ClearError => :ClearError,
45
+ :SDL_Error => :Error,
46
+ }
47
+ args = {
48
+ :SDL_SetError => [:pointer],
49
+ :SDL_GetError => [],
50
+ :SDL_GetErrorMsg => [:pointer, :int],
51
+ :SDL_ClearError => [],
52
+ :SDL_Error => [:int],
53
+ }
54
+ retvals = {
55
+ :SDL_SetError => :int,
56
+ :SDL_GetError => :pointer,
57
+ :SDL_GetErrorMsg => :pointer,
58
+ :SDL_ClearError => :void,
59
+ :SDL_Error => :int,
60
+ }
61
+ symbols.each do |sym|
62
+ begin
63
+ attach_function apis[sym], sym, args[sym], retvals[sym]
64
+ rescue FFI::NotFoundError => error
65
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
66
+ end
67
+ end
68
+ end
69
+
70
+ end
71
+