sdl2-bindings 0.0.8 → 0.1.1

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 +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_hidapi.rb CHANGED
@@ -1,118 +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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
-
17
- # Typedef
18
-
19
-
20
- # Struct
21
-
22
- class SDL_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()
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
- args = {
67
- :SDL_hid_init => [],
68
- :SDL_hid_exit => [],
69
- :SDL_hid_device_change_count => [],
70
- :SDL_hid_enumerate => [:ushort, :ushort],
71
- :SDL_hid_free_enumeration => [:pointer],
72
- :SDL_hid_open => [:ushort, :ushort, :pointer],
73
- :SDL_hid_open_path => [:pointer, :int],
74
- :SDL_hid_write => [:pointer, :pointer, :int],
75
- :SDL_hid_read_timeout => [:pointer, :pointer, :int, :int],
76
- :SDL_hid_read => [:pointer, :pointer, :int],
77
- :SDL_hid_set_nonblocking => [:pointer, :int],
78
- :SDL_hid_send_feature_report => [:pointer, :pointer, :int],
79
- :SDL_hid_get_feature_report => [:pointer, :pointer, :int],
80
- :SDL_hid_close => [:pointer],
81
- :SDL_hid_get_manufacturer_string => [:pointer, :pointer, :int],
82
- :SDL_hid_get_product_string => [:pointer, :pointer, :int],
83
- :SDL_hid_get_serial_number_string => [:pointer, :pointer, :int],
84
- :SDL_hid_get_indexed_string => [:pointer, :int, :pointer, :int],
85
- :SDL_hid_ble_scan => [:int],
86
- }
87
- retvals = {
88
- :SDL_hid_init => :int,
89
- :SDL_hid_exit => :int,
90
- :SDL_hid_device_change_count => :uint,
91
- :SDL_hid_enumerate => :pointer,
92
- :SDL_hid_free_enumeration => :void,
93
- :SDL_hid_open => :pointer,
94
- :SDL_hid_open_path => :pointer,
95
- :SDL_hid_write => :int,
96
- :SDL_hid_read_timeout => :int,
97
- :SDL_hid_read => :int,
98
- :SDL_hid_set_nonblocking => :int,
99
- :SDL_hid_send_feature_report => :int,
100
- :SDL_hid_get_feature_report => :int,
101
- :SDL_hid_close => :void,
102
- :SDL_hid_get_manufacturer_string => :int,
103
- :SDL_hid_get_product_string => :int,
104
- :SDL_hid_get_serial_number_string => :int,
105
- :SDL_hid_get_indexed_string => :int,
106
- :SDL_hid_ble_scan => :void,
107
- }
108
- symbols.each do |sym|
109
- begin
110
- attach_function sym, args[sym], retvals[sym]
111
- rescue FFI::NotFoundError => error
112
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
113
- end
114
- end
115
- end
116
-
117
- end
118
-
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, :int],
96
+ :SDL_hid_read_timeout => [:pointer, :pointer, :int, :int],
97
+ :SDL_hid_read => [:pointer, :pointer, :int],
98
+ :SDL_hid_set_nonblocking => [:pointer, :int],
99
+ :SDL_hid_send_feature_report => [:pointer, :pointer, :int],
100
+ :SDL_hid_get_feature_report => [:pointer, :pointer, :int],
101
+ :SDL_hid_close => [:pointer],
102
+ :SDL_hid_get_manufacturer_string => [:pointer, :pointer, :int],
103
+ :SDL_hid_get_product_string => [:pointer, :pointer, :int],
104
+ :SDL_hid_get_serial_number_string => [:pointer, :pointer, :int],
105
+ :SDL_hid_get_indexed_string => [:pointer, :int, :pointer, :int],
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
+