sdl2-bindings 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +134 -108
- data/LICENSE.txt +0 -0
- data/README.md +86 -68
- data/lib/sdl2.rb +131 -127
- data/lib/sdl2_audio.rb +261 -261
- data/lib/sdl2_blendmode.rb +72 -72
- data/lib/sdl2_clipboard.rb +56 -56
- data/lib/sdl2_cpuinfo.rb +129 -129
- data/lib/sdl2_error.rb +71 -71
- data/lib/sdl2_events.rb +564 -552
- data/lib/sdl2_filesystem.rb +52 -52
- data/lib/sdl2_framerate.rb +74 -74
- data/lib/sdl2_gamecontroller.rb +329 -329
- data/lib/sdl2_gesture.rb +61 -61
- data/lib/sdl2_gfxPrimitives.rb +283 -283
- data/lib/sdl2_haptic.rb +301 -301
- data/lib/sdl2_hidapi.rb +139 -139
- data/lib/sdl2_hints.rb +221 -207
- data/lib/sdl2_image.rb +296 -232
- data/lib/sdl2_imageFilter.rb +164 -164
- data/lib/sdl2_joystick.rb +294 -294
- data/lib/sdl2_keyboard.rb +125 -117
- data/lib/sdl2_keycode.rb +307 -307
- data/lib/sdl2_log.rb +131 -131
- data/lib/sdl2_main.rb +74 -74
- data/lib/sdl2_messagebox.rb +102 -102
- data/lib/sdl2_misc.rb +48 -48
- data/lib/sdl2_mixer.rb +464 -392
- data/lib/sdl2_mouse.rb +136 -136
- data/lib/sdl2_pixels.rb +240 -240
- data/lib/sdl2_platform.rb +48 -48
- data/lib/sdl2_power.rb +54 -54
- data/lib/sdl2_rect.rb +145 -109
- data/lib/sdl2_render.rb +408 -404
- data/lib/sdl2_rotozoom.rb +76 -76
- data/lib/sdl2_rwops.rb +242 -238
- data/lib/sdl2_scancode.rb +289 -289
- data/lib/sdl2_sensor.rb +115 -115
- data/lib/sdl2_shape.rb +83 -83
- data/lib/sdl2_sound.rb +154 -0
- data/lib/sdl2_stdinc.rb +548 -564
- data/lib/sdl2_surface.rb +229 -229
- data/lib/sdl2_syswm.rb +160 -160
- data/lib/sdl2_timer.rb +74 -74
- data/lib/sdl2_touch.rb +86 -82
- data/lib/sdl2_ttf.rb +414 -357
- data/lib/sdl2_version.rb +67 -67
- data/lib/sdl2_video.rb +540 -540
- data/lib/sdl2_vulkan.rb +72 -72
- metadata +3 -2
data/lib/sdl2_hidapi.rb
CHANGED
@@ -1,139 +1,139 @@
|
|
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
|
-
class Hid_device_info < FFI::Struct
|
23
|
-
layout(
|
24
|
-
:path, :pointer,
|
25
|
-
:vendor_id, :ushort,
|
26
|
-
:product_id, :ushort,
|
27
|
-
:serial_number, :pointer,
|
28
|
-
:release_number, :ushort,
|
29
|
-
:manufacturer_string, :pointer,
|
30
|
-
:product_string, :pointer,
|
31
|
-
:usage_page, :ushort,
|
32
|
-
:usage, :ushort,
|
33
|
-
:interface_number, :int,
|
34
|
-
:interface_class, :int,
|
35
|
-
:interface_subclass, :int,
|
36
|
-
:interface_protocol, :int,
|
37
|
-
:next, :pointer,
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
# Function
|
43
|
-
|
44
|
-
def self.setup_hidapi_symbols(output_error = false)
|
45
|
-
symbols = [
|
46
|
-
:SDL_hid_init,
|
47
|
-
:SDL_hid_exit,
|
48
|
-
:SDL_hid_device_change_count,
|
49
|
-
:SDL_hid_enumerate,
|
50
|
-
:SDL_hid_free_enumeration,
|
51
|
-
:SDL_hid_open,
|
52
|
-
:SDL_hid_open_path,
|
53
|
-
:SDL_hid_write,
|
54
|
-
:SDL_hid_read_timeout,
|
55
|
-
:SDL_hid_read,
|
56
|
-
:SDL_hid_set_nonblocking,
|
57
|
-
:SDL_hid_send_feature_report,
|
58
|
-
:SDL_hid_get_feature_report,
|
59
|
-
:SDL_hid_close,
|
60
|
-
:SDL_hid_get_manufacturer_string,
|
61
|
-
:SDL_hid_get_product_string,
|
62
|
-
:SDL_hid_get_serial_number_string,
|
63
|
-
:SDL_hid_get_indexed_string,
|
64
|
-
:SDL_hid_ble_scan,
|
65
|
-
]
|
66
|
-
apis = {
|
67
|
-
:SDL_hid_init => :hid_init,
|
68
|
-
:SDL_hid_exit => :hid_exit,
|
69
|
-
:SDL_hid_device_change_count => :hid_device_change_count,
|
70
|
-
:SDL_hid_enumerate => :hid_enumerate,
|
71
|
-
:SDL_hid_free_enumeration => :hid_free_enumeration,
|
72
|
-
:SDL_hid_open => :hid_open,
|
73
|
-
:SDL_hid_open_path => :hid_open_path,
|
74
|
-
:SDL_hid_write => :hid_write,
|
75
|
-
:SDL_hid_read_timeout => :hid_read_timeout,
|
76
|
-
:SDL_hid_read => :hid_read,
|
77
|
-
:SDL_hid_set_nonblocking => :hid_set_nonblocking,
|
78
|
-
:SDL_hid_send_feature_report => :hid_send_feature_report,
|
79
|
-
:SDL_hid_get_feature_report => :hid_get_feature_report,
|
80
|
-
:SDL_hid_close => :hid_close,
|
81
|
-
:SDL_hid_get_manufacturer_string => :hid_get_manufacturer_string,
|
82
|
-
:SDL_hid_get_product_string => :hid_get_product_string,
|
83
|
-
:SDL_hid_get_serial_number_string => :hid_get_serial_number_string,
|
84
|
-
:SDL_hid_get_indexed_string => :hid_get_indexed_string,
|
85
|
-
:SDL_hid_ble_scan => :hid_ble_scan,
|
86
|
-
}
|
87
|
-
args = {
|
88
|
-
:SDL_hid_init => [],
|
89
|
-
:SDL_hid_exit => [],
|
90
|
-
:SDL_hid_device_change_count => [],
|
91
|
-
:SDL_hid_enumerate => [:ushort, :ushort],
|
92
|
-
:SDL_hid_free_enumeration => [:pointer],
|
93
|
-
:SDL_hid_open => [:ushort, :ushort, :pointer],
|
94
|
-
:SDL_hid_open_path => [:pointer, :int],
|
95
|
-
:SDL_hid_write => [:pointer, :pointer, :
|
96
|
-
:SDL_hid_read_timeout => [:pointer, :pointer, :
|
97
|
-
:SDL_hid_read => [:pointer, :pointer, :
|
98
|
-
:SDL_hid_set_nonblocking => [:pointer, :int],
|
99
|
-
:SDL_hid_send_feature_report => [:pointer, :pointer, :
|
100
|
-
:SDL_hid_get_feature_report => [:pointer, :pointer, :
|
101
|
-
:SDL_hid_close => [:pointer],
|
102
|
-
:SDL_hid_get_manufacturer_string => [:pointer, :pointer, :
|
103
|
-
:SDL_hid_get_product_string => [:pointer, :pointer, :
|
104
|
-
:SDL_hid_get_serial_number_string => [:pointer, :pointer, :
|
105
|
-
:SDL_hid_get_indexed_string => [:pointer, :int, :pointer, :
|
106
|
-
:SDL_hid_ble_scan => [:int],
|
107
|
-
}
|
108
|
-
retvals = {
|
109
|
-
:SDL_hid_init => :int,
|
110
|
-
:SDL_hid_exit => :int,
|
111
|
-
:SDL_hid_device_change_count => :uint,
|
112
|
-
:SDL_hid_enumerate => :pointer,
|
113
|
-
:SDL_hid_free_enumeration => :void,
|
114
|
-
:SDL_hid_open => :pointer,
|
115
|
-
:SDL_hid_open_path => :pointer,
|
116
|
-
:SDL_hid_write => :int,
|
117
|
-
:SDL_hid_read_timeout => :int,
|
118
|
-
:SDL_hid_read => :int,
|
119
|
-
:SDL_hid_set_nonblocking => :int,
|
120
|
-
:SDL_hid_send_feature_report => :int,
|
121
|
-
:SDL_hid_get_feature_report => :int,
|
122
|
-
:SDL_hid_close => :void,
|
123
|
-
:SDL_hid_get_manufacturer_string => :int,
|
124
|
-
:SDL_hid_get_product_string => :int,
|
125
|
-
:SDL_hid_get_serial_number_string => :int,
|
126
|
-
:SDL_hid_get_indexed_string => :int,
|
127
|
-
:SDL_hid_ble_scan => :void,
|
128
|
-
}
|
129
|
-
symbols.each do |sym|
|
130
|
-
begin
|
131
|
-
attach_function apis[sym], sym, args[sym], retvals[sym]
|
132
|
-
rescue FFI::NotFoundError => error
|
133
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
|
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
|
+
class Hid_device_info < FFI::Struct
|
23
|
+
layout(
|
24
|
+
:path, :pointer,
|
25
|
+
:vendor_id, :ushort,
|
26
|
+
:product_id, :ushort,
|
27
|
+
:serial_number, :pointer,
|
28
|
+
:release_number, :ushort,
|
29
|
+
:manufacturer_string, :pointer,
|
30
|
+
:product_string, :pointer,
|
31
|
+
:usage_page, :ushort,
|
32
|
+
:usage, :ushort,
|
33
|
+
:interface_number, :int,
|
34
|
+
:interface_class, :int,
|
35
|
+
:interface_subclass, :int,
|
36
|
+
:interface_protocol, :int,
|
37
|
+
:next, :pointer,
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
# Function
|
43
|
+
|
44
|
+
def self.setup_hidapi_symbols(output_error = false)
|
45
|
+
symbols = [
|
46
|
+
:SDL_hid_init,
|
47
|
+
:SDL_hid_exit,
|
48
|
+
:SDL_hid_device_change_count,
|
49
|
+
:SDL_hid_enumerate,
|
50
|
+
:SDL_hid_free_enumeration,
|
51
|
+
:SDL_hid_open,
|
52
|
+
:SDL_hid_open_path,
|
53
|
+
:SDL_hid_write,
|
54
|
+
:SDL_hid_read_timeout,
|
55
|
+
:SDL_hid_read,
|
56
|
+
:SDL_hid_set_nonblocking,
|
57
|
+
:SDL_hid_send_feature_report,
|
58
|
+
:SDL_hid_get_feature_report,
|
59
|
+
:SDL_hid_close,
|
60
|
+
:SDL_hid_get_manufacturer_string,
|
61
|
+
:SDL_hid_get_product_string,
|
62
|
+
:SDL_hid_get_serial_number_string,
|
63
|
+
:SDL_hid_get_indexed_string,
|
64
|
+
:SDL_hid_ble_scan,
|
65
|
+
]
|
66
|
+
apis = {
|
67
|
+
:SDL_hid_init => :hid_init,
|
68
|
+
:SDL_hid_exit => :hid_exit,
|
69
|
+
:SDL_hid_device_change_count => :hid_device_change_count,
|
70
|
+
:SDL_hid_enumerate => :hid_enumerate,
|
71
|
+
:SDL_hid_free_enumeration => :hid_free_enumeration,
|
72
|
+
:SDL_hid_open => :hid_open,
|
73
|
+
:SDL_hid_open_path => :hid_open_path,
|
74
|
+
:SDL_hid_write => :hid_write,
|
75
|
+
:SDL_hid_read_timeout => :hid_read_timeout,
|
76
|
+
:SDL_hid_read => :hid_read,
|
77
|
+
:SDL_hid_set_nonblocking => :hid_set_nonblocking,
|
78
|
+
:SDL_hid_send_feature_report => :hid_send_feature_report,
|
79
|
+
:SDL_hid_get_feature_report => :hid_get_feature_report,
|
80
|
+
:SDL_hid_close => :hid_close,
|
81
|
+
:SDL_hid_get_manufacturer_string => :hid_get_manufacturer_string,
|
82
|
+
:SDL_hid_get_product_string => :hid_get_product_string,
|
83
|
+
:SDL_hid_get_serial_number_string => :hid_get_serial_number_string,
|
84
|
+
:SDL_hid_get_indexed_string => :hid_get_indexed_string,
|
85
|
+
:SDL_hid_ble_scan => :hid_ble_scan,
|
86
|
+
}
|
87
|
+
args = {
|
88
|
+
:SDL_hid_init => [],
|
89
|
+
:SDL_hid_exit => [],
|
90
|
+
:SDL_hid_device_change_count => [],
|
91
|
+
:SDL_hid_enumerate => [:ushort, :ushort],
|
92
|
+
:SDL_hid_free_enumeration => [:pointer],
|
93
|
+
:SDL_hid_open => [:ushort, :ushort, :pointer],
|
94
|
+
:SDL_hid_open_path => [:pointer, :int],
|
95
|
+
:SDL_hid_write => [:pointer, :pointer, :ulong],
|
96
|
+
:SDL_hid_read_timeout => [:pointer, :pointer, :ulong, :int],
|
97
|
+
:SDL_hid_read => [:pointer, :pointer, :ulong],
|
98
|
+
:SDL_hid_set_nonblocking => [:pointer, :int],
|
99
|
+
:SDL_hid_send_feature_report => [:pointer, :pointer, :ulong],
|
100
|
+
:SDL_hid_get_feature_report => [:pointer, :pointer, :ulong],
|
101
|
+
:SDL_hid_close => [:pointer],
|
102
|
+
:SDL_hid_get_manufacturer_string => [:pointer, :pointer, :ulong],
|
103
|
+
:SDL_hid_get_product_string => [:pointer, :pointer, :ulong],
|
104
|
+
:SDL_hid_get_serial_number_string => [:pointer, :pointer, :ulong],
|
105
|
+
:SDL_hid_get_indexed_string => [:pointer, :int, :pointer, :ulong],
|
106
|
+
:SDL_hid_ble_scan => [:int],
|
107
|
+
}
|
108
|
+
retvals = {
|
109
|
+
:SDL_hid_init => :int,
|
110
|
+
:SDL_hid_exit => :int,
|
111
|
+
:SDL_hid_device_change_count => :uint,
|
112
|
+
:SDL_hid_enumerate => :pointer,
|
113
|
+
:SDL_hid_free_enumeration => :void,
|
114
|
+
:SDL_hid_open => :pointer,
|
115
|
+
:SDL_hid_open_path => :pointer,
|
116
|
+
:SDL_hid_write => :int,
|
117
|
+
:SDL_hid_read_timeout => :int,
|
118
|
+
:SDL_hid_read => :int,
|
119
|
+
:SDL_hid_set_nonblocking => :int,
|
120
|
+
:SDL_hid_send_feature_report => :int,
|
121
|
+
:SDL_hid_get_feature_report => :int,
|
122
|
+
:SDL_hid_close => :void,
|
123
|
+
:SDL_hid_get_manufacturer_string => :int,
|
124
|
+
:SDL_hid_get_product_string => :int,
|
125
|
+
:SDL_hid_get_serial_number_string => :int,
|
126
|
+
:SDL_hid_get_indexed_string => :int,
|
127
|
+
:SDL_hid_ble_scan => :void,
|
128
|
+
}
|
129
|
+
symbols.each do |sym|
|
130
|
+
begin
|
131
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
132
|
+
rescue FFI::NotFoundError => error
|
133
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|