sdl2-bindings 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +140 -124
- data/LICENSE.txt +0 -0
- data/README.md +93 -77
- data/lib/sdl2.rb +131 -131
- data/lib/sdl2_audio.rb +265 -261
- data/lib/sdl2_blendmode.rb +72 -72
- data/lib/sdl2_clipboard.rb +56 -56
- data/lib/sdl2_cpuinfo.rb +137 -129
- data/lib/sdl2_error.rb +71 -71
- data/lib/sdl2_events.rb +575 -564
- data/lib/sdl2_filesystem.rb +52 -52
- data/lib/sdl2_framerate.rb +74 -74
- data/lib/sdl2_gamecontroller.rb +345 -329
- data/lib/sdl2_gesture.rb +61 -61
- data/lib/sdl2_gfxPrimitives.rb +283 -283
- data/lib/sdl2_guid.rb +58 -0
- data/lib/sdl2_haptic.rb +301 -301
- data/lib/sdl2_hidapi.rb +139 -139
- data/lib/sdl2_hints.rb +240 -221
- data/lib/sdl2_image.rb +296 -232
- data/lib/sdl2_imageFilter.rb +164 -164
- data/lib/sdl2_joystick.rb +332 -294
- data/lib/sdl2_keyboard.rb +129 -125
- data/lib/sdl2_keycode.rb +311 -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 -145
- data/lib/sdl2_render.rb +408 -408
- data/lib/sdl2_rotozoom.rb +76 -76
- data/lib/sdl2_rwops.rb +242 -238
- data/lib/sdl2_scancode.rb +293 -289
- data/lib/sdl2_sensor.rb +115 -115
- data/lib/sdl2_shape.rb +83 -83
- data/lib/sdl2_sound.rb +154 -154
- data/lib/sdl2_stdinc.rb +564 -556
- 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 -86
- data/lib/sdl2_ttf.rb +414 -358
- data/lib/sdl2_version.rb +67 -67
- data/lib/sdl2_video.rb +549 -540
- data/lib/sdl2_vulkan.rb +72 -72
- 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
|