sdl2-bindings 0.0.9 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +129 -96
  3. data/LICENSE.txt +0 -0
  4. data/README.md +78 -55
  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 -198
  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 +242 -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 -157
  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 +18 -3
@@ -1,51 +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 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_clipboard_symbols()
26
- symbols = [
27
- :SDL_SetClipboardText,
28
- :SDL_GetClipboardText,
29
- :SDL_HasClipboardText,
30
- ]
31
- args = {
32
- :SDL_SetClipboardText => [:pointer],
33
- :SDL_GetClipboardText => [],
34
- :SDL_HasClipboardText => [],
35
- }
36
- retvals = {
37
- :SDL_SetClipboardText => :int,
38
- :SDL_GetClipboardText => :pointer,
39
- :SDL_HasClipboardText => :int,
40
- }
41
- symbols.each do |sym|
42
- begin
43
- attach_function sym, args[sym], retvals[sym]
44
- rescue FFI::NotFoundError => error
45
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
46
- end
47
- end
48
- end
49
-
50
- end
51
-
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,106 +1,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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
- SDL_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()
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
- args = {
51
- :SDL_GetCPUCount => [],
52
- :SDL_GetCPUCacheLineSize => [],
53
- :SDL_HasRDTSC => [],
54
- :SDL_HasAltiVec => [],
55
- :SDL_HasMMX => [],
56
- :SDL_Has3DNow => [],
57
- :SDL_HasSSE => [],
58
- :SDL_HasSSE2 => [],
59
- :SDL_HasSSE3 => [],
60
- :SDL_HasSSE41 => [],
61
- :SDL_HasSSE42 => [],
62
- :SDL_HasAVX => [],
63
- :SDL_HasAVX2 => [],
64
- :SDL_HasAVX512F => [],
65
- :SDL_HasARMSIMD => [],
66
- :SDL_HasNEON => [],
67
- :SDL_GetSystemRAM => [],
68
- :SDL_SIMDGetAlignment => [],
69
- :SDL_SIMDAlloc => [:int],
70
- :SDL_SIMDRealloc => [:pointer, :int],
71
- :SDL_SIMDFree => [:pointer],
72
- }
73
- retvals = {
74
- :SDL_GetCPUCount => :int,
75
- :SDL_GetCPUCacheLineSize => :int,
76
- :SDL_HasRDTSC => :int,
77
- :SDL_HasAltiVec => :int,
78
- :SDL_HasMMX => :int,
79
- :SDL_Has3DNow => :int,
80
- :SDL_HasSSE => :int,
81
- :SDL_HasSSE2 => :int,
82
- :SDL_HasSSE3 => :int,
83
- :SDL_HasSSE41 => :int,
84
- :SDL_HasSSE42 => :int,
85
- :SDL_HasAVX => :int,
86
- :SDL_HasAVX2 => :int,
87
- :SDL_HasAVX512F => :int,
88
- :SDL_HasARMSIMD => :int,
89
- :SDL_HasNEON => :int,
90
- :SDL_GetSystemRAM => :int,
91
- :SDL_SIMDGetAlignment => :int,
92
- :SDL_SIMDAlloc => :pointer,
93
- :SDL_SIMDRealloc => :pointer,
94
- :SDL_SIMDFree => :void,
95
- }
96
- symbols.each do |sym|
97
- begin
98
- attach_function sym, args[sym], retvals[sym]
99
- rescue FFI::NotFoundError => error
100
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
101
- end
102
- end
103
- end
104
-
105
- end
106
-
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 => [:int],
93
+ :SDL_SIMDRealloc => [:pointer, :int],
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 => :int,
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
+
data/lib/sdl2_error.rb CHANGED
@@ -1,64 +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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
- SDL_ENOMEM = 0
17
- SDL_EFREAD = 1
18
- SDL_EFWRITE = 2
19
- SDL_EFSEEK = 3
20
- SDL_UNSUPPORTED = 4
21
- SDL_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()
33
- symbols = [
34
- :SDL_SetError,
35
- :SDL_GetError,
36
- :SDL_GetErrorMsg,
37
- :SDL_ClearError,
38
- :SDL_Error,
39
- ]
40
- args = {
41
- :SDL_SetError => [:pointer],
42
- :SDL_GetError => [],
43
- :SDL_GetErrorMsg => [:pointer, :int],
44
- :SDL_ClearError => [],
45
- :SDL_Error => [:int],
46
- }
47
- retvals = {
48
- :SDL_SetError => :int,
49
- :SDL_GetError => :pointer,
50
- :SDL_GetErrorMsg => :pointer,
51
- :SDL_ClearError => :void,
52
- :SDL_Error => :int,
53
- }
54
- symbols.each do |sym|
55
- begin
56
- attach_function sym, args[sym], retvals[sym]
57
- rescue FFI::NotFoundError => error
58
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
59
- end
60
- end
61
- end
62
-
63
- end
64
-
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
+