sdl2-bindings 0.1.3 → 0.1.5

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 +145 -134
  3. data/LICENSE.txt +0 -0
  4. data/README.md +108 -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 +572 -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
data/lib/sdl2.rb CHANGED
@@ -1,131 +1,131 @@
1
- # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/sdl2-bindings
4
-
5
- require 'ffi'
6
- require_relative 'sdl2_main.rb'
7
- require_relative 'sdl2_audio.rb'
8
- require_relative 'sdl2_blendmode.rb'
9
- require_relative 'sdl2_clipboard.rb'
10
- require_relative 'sdl2_cpuinfo.rb'
11
- require_relative 'sdl2_error.rb'
12
- require_relative 'sdl2_events.rb'
13
- require_relative 'sdl2_filesystem.rb'
14
- require_relative 'sdl2_gamecontroller.rb'
15
- require_relative 'sdl2_gesture.rb'
16
- require_relative 'sdl2_haptic.rb'
17
- require_relative 'sdl2_hints.rb'
18
- require_relative 'sdl2_joystick.rb'
19
- require_relative 'sdl2_keyboard.rb'
20
- require_relative 'sdl2_keycode.rb'
21
- require_relative 'sdl2_log.rb'
22
- require_relative 'sdl2_messagebox.rb'
23
- require_relative 'sdl2_misc.rb'
24
- require_relative 'sdl2_mouse.rb'
25
- require_relative 'sdl2_pixels.rb'
26
- require_relative 'sdl2_platform.rb'
27
- require_relative 'sdl2_power.rb'
28
- require_relative 'sdl2_rect.rb'
29
- require_relative 'sdl2_render.rb'
30
- require_relative 'sdl2_rwops.rb'
31
- require_relative 'sdl2_scancode.rb'
32
- require_relative 'sdl2_sensor.rb'
33
- require_relative 'sdl2_shape.rb'
34
- require_relative 'sdl2_stdinc.rb'
35
- require_relative 'sdl2_surface.rb'
36
- require_relative 'sdl2_syswm.rb'
37
- require_relative 'sdl2_timer.rb'
38
- require_relative 'sdl2_touch.rb'
39
- require_relative 'sdl2_version.rb'
40
- require_relative 'sdl2_video.rb'
41
- require_relative 'sdl2_vulkan.rb'
42
-
43
- # SDL2_gfx
44
- require_relative 'sdl2_framerate.rb'
45
- require_relative 'sdl2_gfxPrimitives.rb'
46
- require_relative 'sdl2_rotozoom.rb'
47
- require_relative 'sdl2_imageFilter.rb'
48
- # SDL_image
49
- require_relative 'sdl2_image.rb'
50
- # SDL_mixer
51
- require_relative 'sdl2_mixer.rb'
52
- # SDL_ttf
53
- require_relative 'sdl2_ttf.rb'
54
- # SDL_sound
55
- require_relative 'sdl2_sound.rb'
56
-
57
- module SDL
58
- extend FFI::Library
59
-
60
- @@sdl2_import_done = false
61
- def self.load_lib(libpath, output_error = false, image_libpath: nil, ttf_libpath: nil, mixer_libpath: nil, gfx_libpath: nil, sound_libpath: nil)
62
-
63
- unless @@sdl2_import_done
64
- # Ref.: Using Multiple and Alternate Libraries
65
- # https://github.com/ffi/ffi/wiki/Using-Multiple-and-Alternate-Libraries
66
- begin
67
- lib_paths = [libpath, image_libpath, ttf_libpath, mixer_libpath, gfx_libpath, sound_libpath].compact
68
-
69
- ffi_lib_flags :now, :global
70
- ffi_lib *lib_paths
71
- setup_symbols(output_error)
72
-
73
- setup_image_symbols(output_error) if image_libpath
74
- setup_ttf_symbols(output_error) if ttf_libpath
75
- setup_mixer_symbols(output_error) if mixer_libpath
76
-
77
- if gfx_libpath != nil
78
- setup_gfx_framerate_symbols(output_error)
79
- setup_gfx_primitives_symbols(output_error)
80
- setup_gfx_imagefilter_symbols(output_error)
81
- setup_gfx_rotozoom_symbols(output_error)
82
- end
83
-
84
- setup_sound_symbols(output_error) if sound_libpath
85
- rescue => error
86
- $stderr.puts("[Warning] Failed to load libraries (#{error}).") if output_error
87
- end
88
- end
89
-
90
- end
91
-
92
- def self.setup_symbols(output_error = false)
93
- setup_main_symbols(output_error)
94
- setup_audio_symbols(output_error)
95
- setup_blendmode_symbols(output_error)
96
- setup_clipboard_symbols(output_error)
97
- setup_cpuinfo_symbols(output_error)
98
- setup_error_symbols(output_error)
99
- setup_events_symbols(output_error)
100
- setup_filesystem_symbols(output_error)
101
- setup_gamecontroller_symbols(output_error)
102
- setup_gesture_symbols(output_error)
103
- setup_haptic_symbols(output_error)
104
- setup_hints_symbols(output_error)
105
- setup_joystick_symbols(output_error)
106
- setup_keyboard_symbols(output_error)
107
- setup_keycode_symbols(output_error)
108
- setup_log_symbols(output_error)
109
- setup_messagebox_symbols(output_error)
110
- setup_misc_symbols(output_error)
111
- setup_mouse_symbols(output_error)
112
- setup_pixels_symbols(output_error)
113
- setup_platform_symbols(output_error)
114
- setup_power_symbols(output_error)
115
- setup_rect_symbols(output_error)
116
- setup_render_symbols(output_error)
117
- setup_rwops_symbols(output_error)
118
- setup_scancode_symbols(output_error)
119
- setup_sensor_symbols(output_error)
120
- setup_shape_symbols(output_error)
121
- setup_surface_symbols(output_error)
122
- setup_syswm_symbols(output_error)
123
- setup_stdinc_symbols(output_error)
124
- setup_timer_symbols(output_error)
125
- setup_touch_symbols(output_error)
126
- setup_version_symbols(output_error)
127
- setup_video_symbols(output_error)
128
- setup_vulkan_symbols(output_error)
129
- end
130
-
131
- end
1
+ # Ruby-SDL2 : Yet another SDL2 wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/sdl2-bindings
4
+
5
+ require 'ffi'
6
+ require_relative 'sdl2_main.rb'
7
+ require_relative 'sdl2_audio.rb'
8
+ require_relative 'sdl2_blendmode.rb'
9
+ require_relative 'sdl2_clipboard.rb'
10
+ require_relative 'sdl2_cpuinfo.rb'
11
+ require_relative 'sdl2_error.rb'
12
+ require_relative 'sdl2_events.rb'
13
+ require_relative 'sdl2_filesystem.rb'
14
+ require_relative 'sdl2_gamecontroller.rb'
15
+ require_relative 'sdl2_gesture.rb'
16
+ require_relative 'sdl2_haptic.rb'
17
+ require_relative 'sdl2_hints.rb'
18
+ require_relative 'sdl2_joystick.rb'
19
+ require_relative 'sdl2_keyboard.rb'
20
+ require_relative 'sdl2_keycode.rb'
21
+ require_relative 'sdl2_log.rb'
22
+ require_relative 'sdl2_messagebox.rb'
23
+ require_relative 'sdl2_misc.rb'
24
+ require_relative 'sdl2_mouse.rb'
25
+ require_relative 'sdl2_pixels.rb'
26
+ require_relative 'sdl2_platform.rb'
27
+ require_relative 'sdl2_power.rb'
28
+ require_relative 'sdl2_rect.rb'
29
+ require_relative 'sdl2_render.rb'
30
+ require_relative 'sdl2_rwops.rb'
31
+ require_relative 'sdl2_scancode.rb'
32
+ require_relative 'sdl2_sensor.rb'
33
+ require_relative 'sdl2_shape.rb'
34
+ require_relative 'sdl2_stdinc.rb'
35
+ require_relative 'sdl2_surface.rb'
36
+ require_relative 'sdl2_syswm.rb'
37
+ require_relative 'sdl2_timer.rb'
38
+ require_relative 'sdl2_touch.rb'
39
+ require_relative 'sdl2_version.rb'
40
+ require_relative 'sdl2_video.rb'
41
+ require_relative 'sdl2_vulkan.rb'
42
+
43
+ # SDL2_gfx
44
+ require_relative 'sdl2_framerate.rb'
45
+ require_relative 'sdl2_gfxPrimitives.rb'
46
+ require_relative 'sdl2_rotozoom.rb'
47
+ require_relative 'sdl2_imageFilter.rb'
48
+ # SDL_image
49
+ require_relative 'sdl2_image.rb'
50
+ # SDL_mixer
51
+ require_relative 'sdl2_mixer.rb'
52
+ # SDL_ttf
53
+ require_relative 'sdl2_ttf.rb'
54
+ # SDL_sound
55
+ require_relative 'sdl2_sound.rb'
56
+
57
+ module SDL
58
+ extend FFI::Library
59
+
60
+ @@sdl2_import_done = false
61
+ def self.load_lib(libpath, output_error = false, image_libpath: nil, ttf_libpath: nil, mixer_libpath: nil, gfx_libpath: nil, sound_libpath: nil)
62
+
63
+ unless @@sdl2_import_done
64
+ # Ref.: Using Multiple and Alternate Libraries
65
+ # https://github.com/ffi/ffi/wiki/Using-Multiple-and-Alternate-Libraries
66
+ begin
67
+ lib_paths = [libpath, image_libpath, ttf_libpath, mixer_libpath, gfx_libpath, sound_libpath].compact
68
+
69
+ ffi_lib_flags :now, :global
70
+ ffi_lib *lib_paths
71
+ setup_symbols(output_error)
72
+
73
+ setup_image_symbols(output_error) if image_libpath
74
+ setup_ttf_symbols(output_error) if ttf_libpath
75
+ setup_mixer_symbols(output_error) if mixer_libpath
76
+
77
+ if gfx_libpath != nil
78
+ setup_gfx_framerate_symbols(output_error)
79
+ setup_gfx_primitives_symbols(output_error)
80
+ setup_gfx_imagefilter_symbols(output_error)
81
+ setup_gfx_rotozoom_symbols(output_error)
82
+ end
83
+
84
+ setup_sound_symbols(output_error) if sound_libpath
85
+ rescue => error
86
+ $stderr.puts("[Warning] Failed to load libraries (#{error}).") if output_error
87
+ end
88
+ end
89
+
90
+ end
91
+
92
+ def self.setup_symbols(output_error = false)
93
+ setup_main_symbols(output_error)
94
+ setup_audio_symbols(output_error)
95
+ setup_blendmode_symbols(output_error)
96
+ setup_clipboard_symbols(output_error)
97
+ setup_cpuinfo_symbols(output_error)
98
+ setup_error_symbols(output_error)
99
+ setup_events_symbols(output_error)
100
+ setup_filesystem_symbols(output_error)
101
+ setup_gamecontroller_symbols(output_error)
102
+ setup_gesture_symbols(output_error)
103
+ setup_haptic_symbols(output_error)
104
+ setup_hints_symbols(output_error)
105
+ setup_joystick_symbols(output_error)
106
+ setup_keyboard_symbols(output_error)
107
+ setup_keycode_symbols(output_error)
108
+ setup_log_symbols(output_error)
109
+ setup_messagebox_symbols(output_error)
110
+ setup_misc_symbols(output_error)
111
+ setup_mouse_symbols(output_error)
112
+ setup_pixels_symbols(output_error)
113
+ setup_platform_symbols(output_error)
114
+ setup_power_symbols(output_error)
115
+ setup_rect_symbols(output_error)
116
+ setup_render_symbols(output_error)
117
+ setup_rwops_symbols(output_error)
118
+ setup_scancode_symbols(output_error)
119
+ setup_sensor_symbols(output_error)
120
+ setup_shape_symbols(output_error)
121
+ setup_surface_symbols(output_error)
122
+ setup_syswm_symbols(output_error)
123
+ setup_stdinc_symbols(output_error)
124
+ setup_timer_symbols(output_error)
125
+ setup_touch_symbols(output_error)
126
+ setup_version_symbols(output_error)
127
+ setup_video_symbols(output_error)
128
+ setup_vulkan_symbols(output_error)
129
+ end
130
+
131
+ end