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