sdl2-bindings 0.0.5 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +96 -79
  3. data/LICENSE.txt +1 -1
  4. data/README.md +55 -49
  5. data/lib/sdl2.rb +172 -170
  6. data/lib/sdl2_audio.rb +222 -201
  7. data/lib/sdl2_blendmode.rb +69 -69
  8. data/lib/sdl2_clipboard.rb +51 -51
  9. data/lib/sdl2_cpuinfo.rb +106 -106
  10. data/lib/sdl2_error.rb +64 -64
  11. data/lib/sdl2_events.rb +533 -530
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +274 -254
  15. data/lib/sdl2_gesture.rb +55 -55
  16. data/lib/sdl2_gfxPrimitives.rb +222 -222
  17. data/lib/sdl2_haptic.rb +269 -269
  18. data/lib/sdl2_hidapi.rb +118 -0
  19. data/lib/sdl2_hints.rb +198 -174
  20. data/lib/sdl2_image.rb +185 -185
  21. data/lib/sdl2_imageFilter.rb +132 -132
  22. data/lib/sdl2_joystick.rb +239 -230
  23. data/lib/sdl2_keyboard.rb +99 -99
  24. data/lib/sdl2_keycode.rb +305 -304
  25. data/lib/sdl2_log.rb +115 -115
  26. data/lib/sdl2_main.rb +67 -67
  27. data/lib/sdl2_messagebox.rb +98 -98
  28. data/lib/sdl2_misc.rb +45 -0
  29. data/lib/sdl2_mixer.rb +317 -307
  30. data/lib/sdl2_mouse.rb +117 -117
  31. data/lib/sdl2_pixels.rb +224 -224
  32. data/lib/sdl2_platform.rb +45 -45
  33. data/lib/sdl2_power.rb +51 -51
  34. data/lib/sdl2_rect.rb +102 -102
  35. data/lib/sdl2_render.rb +322 -290
  36. data/lib/sdl2_rotozoom.rb +66 -66
  37. data/lib/sdl2_rwops.rb +208 -208
  38. data/lib/sdl2_scancode.rb +287 -287
  39. data/lib/sdl2_sensor.rb +97 -0
  40. data/lib/sdl2_shape.rb +77 -77
  41. data/lib/sdl2_stdinc.rb +439 -393
  42. data/lib/sdl2_surface.rb +188 -182
  43. data/lib/sdl2_syswm.rb +157 -154
  44. data/lib/sdl2_timer.rb +65 -62
  45. data/lib/sdl2_touch.rb +75 -73
  46. data/lib/sdl2_ttf.rb +202 -190
  47. data/lib/sdl2_version.rb +62 -62
  48. data/lib/sdl2_video.rb +446 -411
  49. data/lib/sdl2_vulkan.rb +64 -64
  50. metadata +9 -6
data/lib/sdl2_syswm.rb CHANGED
@@ -1,154 +1,157 @@
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
- require_relative 'sdl2_version'
9
-
10
- module SDL2
11
- extend FFI::Library
12
- # Define/Macro
13
-
14
-
15
- # Enum
16
-
17
- SDL_SYSWM_UNKNOWN = 0
18
- SDL_SYSWM_WINDOWS = 1
19
- SDL_SYSWM_X11 = 2
20
- SDL_SYSWM_DIRECTFB = 3
21
- SDL_SYSWM_COCOA = 4
22
- SDL_SYSWM_UIKIT = 5
23
- SDL_SYSWM_WAYLAND = 6
24
- SDL_SYSWM_MIR = 7
25
- SDL_SYSWM_WINRT = 8
26
- SDL_SYSWM_ANDROID = 9
27
- SDL_SYSWM_VIVANTE = 10
28
- SDL_SYSWM_OS2 = 11
29
- SDL_SYSWM_HAIKU = 12
30
-
31
- # Typedef
32
-
33
- typedef :int, :SDL_SYSWM_TYPE
34
-
35
- class SDL_SysWMmsg_def_win < FFI::Struct
36
- layout(
37
- :hwnd, :pointer,
38
- :msg, :uint32,
39
- :wParam, :uint64,
40
- :lParam, :int64
41
- )
42
- end
43
-
44
- class SDL_SysWMmsg_value_win < FFI::Union
45
- layout(
46
- :win, SDL_SysWMmsg_def_win.by_value,
47
- :dummy, :int
48
- )
49
- end
50
-
51
- class SDL_SysWMmsg_win < FFI::Struct
52
- layout(
53
- :version, SDL_version.by_value,
54
- :subsystem, :int,
55
- :msg, SDL_SysWMmsg_value_win.by_value
56
- )
57
- end
58
-
59
-
60
- class SDL_SysWMmsg_def_cocoa < FFI::Struct
61
- layout(
62
- :dummy, :int
63
- )
64
- end
65
-
66
- class SDL_SysWMmsg_value_cocoa < FFI::Union
67
- layout(
68
- :cocoa, SDL_SysWMmsg_def_cocoa.by_value,
69
- :dummy, :int
70
- )
71
- end
72
-
73
- class SDL_SysWMmsg_cocoa < FFI::Struct
74
- layout(
75
- :version, SDL_version.by_value,
76
- :subsystem, :int,
77
- :msg, SDL_SysWMmsg_value_cocoa.by_value
78
- )
79
- end
80
-
81
- ################################################################################
82
-
83
- class SDL_SysWMinfo_def_win < FFI::Struct
84
- layout(
85
- :window, :pointer,
86
- :hdc, :pointer,
87
- :hinstance, :pointer
88
- )
89
- end
90
-
91
- class SDL_SysWMinfo_value_win < FFI::Union
92
- layout(
93
- :win, SDL_SysWMinfo_def_win.by_value,
94
- :dummy, [:uint8, 64]
95
- )
96
- end
97
-
98
- class SDL_SysWMinfo_win < FFI::Struct
99
- layout(
100
- :version, SDL_version.by_value,
101
- :subsystem, :int,
102
- :info, SDL_SysWMinfo_value_win.by_value
103
- )
104
- end
105
-
106
-
107
- class SDL_SysWMinfo_def_cocoa < FFI::Struct
108
- layout(
109
- :window, :pointer
110
- )
111
- end
112
-
113
- class SDL_SysWMinfo_value_cocoa < FFI::Union
114
- layout(
115
- :cocoa, SDL_SysWMinfo_def_cocoa.by_value,
116
- :dummy, [:uint8, 64]
117
- )
118
- end
119
-
120
- class SDL_SysWMinfo_cocoa < FFI::Struct
121
- layout(
122
- :version, SDL_version.by_value,
123
- :subsystem, :int,
124
- :info, SDL_SysWMinfo_value_cocoa.by_value
125
- )
126
- end
127
-
128
-
129
- # Struct
130
-
131
-
132
- # Function
133
-
134
- def self.setup_syswm_symbols()
135
- symbols = [
136
- :SDL_GetWindowWMInfo,
137
- ]
138
- args = {
139
- :SDL_GetWindowWMInfo => [:pointer, :pointer],
140
- }
141
- retvals = {
142
- :SDL_GetWindowWMInfo => :int,
143
- }
144
- symbols.each do |sym|
145
- begin
146
- attach_function sym, args[sym], retvals[sym]
147
- rescue FFI::NotFoundError => error
148
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
149
- end
150
- end
151
- end
152
-
153
- end
154
-
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
+ require_relative 'sdl2_version'
9
+
10
+ module SDL2
11
+ extend FFI::Library
12
+ # Define/Macro
13
+
14
+ SDL_METALVIEW_TAG = 255
15
+
16
+ # Enum
17
+
18
+ SDL_SYSWM_UNKNOWN = 0
19
+ SDL_SYSWM_WINDOWS = 1
20
+ SDL_SYSWM_X11 = 2
21
+ SDL_SYSWM_DIRECTFB = 3
22
+ SDL_SYSWM_COCOA = 4
23
+ SDL_SYSWM_UIKIT = 5
24
+ SDL_SYSWM_WAYLAND = 6
25
+ SDL_SYSWM_MIR = 7
26
+ SDL_SYSWM_WINRT = 8
27
+ SDL_SYSWM_ANDROID = 9
28
+ SDL_SYSWM_VIVANTE = 10
29
+ SDL_SYSWM_OS2 = 11
30
+ SDL_SYSWM_HAIKU = 12
31
+ SDL_SYSWM_KMSDRM = 13
32
+ SDL_SYSWM_RISCOS = 14
33
+
34
+ # Typedef
35
+
36
+ typedef :int, :SDL_SYSWM_TYPE
37
+
38
+ class SDL_SysWMmsg_def_win < FFI::Struct
39
+ layout(
40
+ :hwnd, :pointer,
41
+ :msg, :uint32,
42
+ :wParam, :uint64,
43
+ :lParam, :int64
44
+ )
45
+ end
46
+
47
+ class SDL_SysWMmsg_value_win < FFI::Union
48
+ layout(
49
+ :win, SDL_SysWMmsg_def_win.by_value,
50
+ :dummy, :int
51
+ )
52
+ end
53
+
54
+ class SDL_SysWMmsg_win < FFI::Struct
55
+ layout(
56
+ :version, SDL_version.by_value,
57
+ :subsystem, :int,
58
+ :msg, SDL_SysWMmsg_value_win.by_value
59
+ )
60
+ end
61
+
62
+
63
+ class SDL_SysWMmsg_def_cocoa < FFI::Struct
64
+ layout(
65
+ :dummy, :int
66
+ )
67
+ end
68
+
69
+ class SDL_SysWMmsg_value_cocoa < FFI::Union
70
+ layout(
71
+ :cocoa, SDL_SysWMmsg_def_cocoa.by_value,
72
+ :dummy, :int
73
+ )
74
+ end
75
+
76
+ class SDL_SysWMmsg_cocoa < FFI::Struct
77
+ layout(
78
+ :version, SDL_version.by_value,
79
+ :subsystem, :int,
80
+ :msg, SDL_SysWMmsg_value_cocoa.by_value
81
+ )
82
+ end
83
+
84
+ ################################################################################
85
+
86
+ class SDL_SysWMinfo_def_win < FFI::Struct
87
+ layout(
88
+ :window, :pointer,
89
+ :hdc, :pointer,
90
+ :hinstance, :pointer
91
+ )
92
+ end
93
+
94
+ class SDL_SysWMinfo_value_win < FFI::Union
95
+ layout(
96
+ :win, SDL_SysWMinfo_def_win.by_value,
97
+ :dummy, [:uint8, 64]
98
+ )
99
+ end
100
+
101
+ class SDL_SysWMinfo_win < FFI::Struct
102
+ layout(
103
+ :version, SDL_version.by_value,
104
+ :subsystem, :int,
105
+ :info, SDL_SysWMinfo_value_win.by_value
106
+ )
107
+ end
108
+
109
+
110
+ class SDL_SysWMinfo_def_cocoa < FFI::Struct
111
+ layout(
112
+ :window, :pointer
113
+ )
114
+ end
115
+
116
+ class SDL_SysWMinfo_value_cocoa < FFI::Union
117
+ layout(
118
+ :cocoa, SDL_SysWMinfo_def_cocoa.by_value,
119
+ :dummy, [:uint8, 64]
120
+ )
121
+ end
122
+
123
+ class SDL_SysWMinfo_cocoa < FFI::Struct
124
+ layout(
125
+ :version, SDL_version.by_value,
126
+ :subsystem, :int,
127
+ :info, SDL_SysWMinfo_value_cocoa.by_value
128
+ )
129
+ end
130
+
131
+
132
+ # Struct
133
+
134
+
135
+ # Function
136
+
137
+ def self.setup_syswm_symbols()
138
+ symbols = [
139
+ :SDL_GetWindowWMInfo,
140
+ ]
141
+ args = {
142
+ :SDL_GetWindowWMInfo => [:pointer, :pointer],
143
+ }
144
+ retvals = {
145
+ :SDL_GetWindowWMInfo => :int,
146
+ }
147
+ symbols.each do |sym|
148
+ begin
149
+ attach_function sym, args[sym], retvals[sym]
150
+ rescue FFI::NotFoundError => error
151
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
152
+ end
153
+ end
154
+ end
155
+
156
+ end
157
+
data/lib/sdl2_timer.rb CHANGED
@@ -1,62 +1,65 @@
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
- callback :SDL_TimerCallback, [:uint, :pointer], :uint
20
- typedef :int, :SDL_TimerID
21
-
22
- # Struct
23
-
24
-
25
- # Function
26
-
27
- def self.setup_timer_symbols()
28
- symbols = [
29
- :SDL_GetTicks,
30
- :SDL_GetPerformanceCounter,
31
- :SDL_GetPerformanceFrequency,
32
- :SDL_Delay,
33
- :SDL_AddTimer,
34
- :SDL_RemoveTimer,
35
- ]
36
- args = {
37
- :SDL_GetTicks => [],
38
- :SDL_GetPerformanceCounter => [],
39
- :SDL_GetPerformanceFrequency => [],
40
- :SDL_Delay => [:uint],
41
- :SDL_AddTimer => [:uint, :SDL_TimerCallback, :pointer],
42
- :SDL_RemoveTimer => [:int],
43
- }
44
- retvals = {
45
- :SDL_GetTicks => :uint,
46
- :SDL_GetPerformanceCounter => :ulong_long,
47
- :SDL_GetPerformanceFrequency => :ulong_long,
48
- :SDL_Delay => :void,
49
- :SDL_AddTimer => :int,
50
- :SDL_RemoveTimer => :int,
51
- }
52
- symbols.each do |sym|
53
- begin
54
- attach_function sym, args[sym], retvals[sym]
55
- rescue FFI::NotFoundError => error
56
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
57
- end
58
- end
59
- end
60
-
61
- end
62
-
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
+ callback :SDL_TimerCallback, [:uint, :pointer], :uint
20
+ typedef :int, :SDL_TimerID
21
+
22
+ # Struct
23
+
24
+
25
+ # Function
26
+
27
+ def self.setup_timer_symbols()
28
+ symbols = [
29
+ :SDL_GetTicks,
30
+ :SDL_GetTicks64,
31
+ :SDL_GetPerformanceCounter,
32
+ :SDL_GetPerformanceFrequency,
33
+ :SDL_Delay,
34
+ :SDL_AddTimer,
35
+ :SDL_RemoveTimer,
36
+ ]
37
+ args = {
38
+ :SDL_GetTicks => [],
39
+ :SDL_GetTicks64 => [],
40
+ :SDL_GetPerformanceCounter => [],
41
+ :SDL_GetPerformanceFrequency => [],
42
+ :SDL_Delay => [:uint],
43
+ :SDL_AddTimer => [:uint, :SDL_TimerCallback, :pointer],
44
+ :SDL_RemoveTimer => [:int],
45
+ }
46
+ retvals = {
47
+ :SDL_GetTicks => :uint,
48
+ :SDL_GetTicks64 => :ulong_long,
49
+ :SDL_GetPerformanceCounter => :ulong_long,
50
+ :SDL_GetPerformanceFrequency => :ulong_long,
51
+ :SDL_Delay => :void,
52
+ :SDL_AddTimer => :int,
53
+ :SDL_RemoveTimer => :int,
54
+ }
55
+ symbols.each do |sym|
56
+ begin
57
+ attach_function sym, args[sym], retvals[sym]
58
+ rescue FFI::NotFoundError => error
59
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
60
+ end
61
+ end
62
+ end
63
+
64
+ end
65
+
data/lib/sdl2_touch.rb CHANGED
@@ -1,73 +1,75 @@
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_TOUCH_DEVICE_INVALID = -1
17
- SDL_TOUCH_DEVICE_DIRECT = 0
18
- SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE = 1
19
- SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = 2
20
-
21
- # Typedef
22
-
23
- typedef :long_long, :SDL_TouchID
24
- typedef :long_long, :SDL_FingerID
25
- typedef :int, :SDL_TouchDeviceType
26
-
27
- # Struct
28
-
29
- class SDL_Finger < FFI::Struct
30
- layout(
31
- :id, :long_long,
32
- :x, :float,
33
- :y, :float,
34
- :pressure, :float,
35
- )
36
- end
37
-
38
-
39
- # Function
40
-
41
- def self.setup_touch_symbols()
42
- symbols = [
43
- :SDL_GetNumTouchDevices,
44
- :SDL_GetTouchDevice,
45
- :SDL_GetTouchDeviceType,
46
- :SDL_GetNumTouchFingers,
47
- :SDL_GetTouchFinger,
48
- ]
49
- args = {
50
- :SDL_GetNumTouchDevices => [],
51
- :SDL_GetTouchDevice => [:int],
52
- :SDL_GetTouchDeviceType => [:long_long],
53
- :SDL_GetNumTouchFingers => [:long_long],
54
- :SDL_GetTouchFinger => [:long_long, :int],
55
- }
56
- retvals = {
57
- :SDL_GetNumTouchDevices => :int,
58
- :SDL_GetTouchDevice => :long_long,
59
- :SDL_GetTouchDeviceType => :int,
60
- :SDL_GetNumTouchFingers => :int,
61
- :SDL_GetTouchFinger => :pointer,
62
- }
63
- symbols.each do |sym|
64
- begin
65
- attach_function sym, args[sym], retvals[sym]
66
- rescue FFI::NotFoundError => error
67
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
68
- end
69
- end
70
- end
71
-
72
- end
73
-
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_TOUCH_MOUSEID = -1
14
+ SDL_MOUSE_TOUCHID = -1
15
+
16
+ # Enum
17
+
18
+ SDL_TOUCH_DEVICE_INVALID = -1
19
+ SDL_TOUCH_DEVICE_DIRECT = 0
20
+ SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE = 1
21
+ SDL_TOUCH_DEVICE_INDIRECT_RELATIVE = 2
22
+
23
+ # Typedef
24
+
25
+ typedef :long_long, :SDL_TouchID
26
+ typedef :long_long, :SDL_FingerID
27
+ typedef :int, :SDL_TouchDeviceType
28
+
29
+ # Struct
30
+
31
+ class SDL_Finger < FFI::Struct
32
+ layout(
33
+ :id, :long_long,
34
+ :x, :float,
35
+ :y, :float,
36
+ :pressure, :float,
37
+ )
38
+ end
39
+
40
+
41
+ # Function
42
+
43
+ def self.setup_touch_symbols()
44
+ symbols = [
45
+ :SDL_GetNumTouchDevices,
46
+ :SDL_GetTouchDevice,
47
+ :SDL_GetTouchDeviceType,
48
+ :SDL_GetNumTouchFingers,
49
+ :SDL_GetTouchFinger,
50
+ ]
51
+ args = {
52
+ :SDL_GetNumTouchDevices => [],
53
+ :SDL_GetTouchDevice => [:int],
54
+ :SDL_GetTouchDeviceType => [:long_long],
55
+ :SDL_GetNumTouchFingers => [:long_long],
56
+ :SDL_GetTouchFinger => [:long_long, :int],
57
+ }
58
+ retvals = {
59
+ :SDL_GetNumTouchDevices => :int,
60
+ :SDL_GetTouchDevice => :long_long,
61
+ :SDL_GetTouchDeviceType => :int,
62
+ :SDL_GetNumTouchFingers => :int,
63
+ :SDL_GetTouchFinger => :pointer,
64
+ }
65
+ symbols.each do |sym|
66
+ begin
67
+ attach_function sym, args[sym], retvals[sym]
68
+ rescue FFI::NotFoundError => error
69
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
70
+ end
71
+ end
72
+ end
73
+
74
+ end
75
+