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.
- checksums.yaml +4 -4
- data/ChangeLog +145 -134
- data/LICENSE.txt +0 -0
- data/README.md +108 -86
- 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 -296
- 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 -464
- 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 -242
- 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 +572 -548
- 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 -414
- 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_sound.rb
CHANGED
@@ -1,154 +1,154 @@
|
|
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
|
-
SOUND_VER_MAJOR = 2
|
14
|
-
SOUND_VER_MINOR = 0
|
15
|
-
SOUND_VER_PATCH = 1
|
16
|
-
|
17
|
-
# Enum
|
18
|
-
|
19
|
-
SOUND_SAMPLEFLAG_NONE = 0
|
20
|
-
SOUND_SAMPLEFLAG_CANSEEK = 1
|
21
|
-
SOUND_SAMPLEFLAG_EOF = 536870912
|
22
|
-
SOUND_SAMPLEFLAG_ERROR = 1073741824
|
23
|
-
SOUND_SAMPLEFLAG_EAGAIN = -2147483648
|
24
|
-
|
25
|
-
# Typedef
|
26
|
-
|
27
|
-
typedef :int, :Sound_SampleFlags
|
28
|
-
|
29
|
-
# Struct
|
30
|
-
|
31
|
-
class Sound_AudioInfo < FFI::Struct
|
32
|
-
layout(
|
33
|
-
:format, :ushort,
|
34
|
-
:channels, :uchar,
|
35
|
-
:rate, :uint,
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
class Sound_DecoderInfo < FFI::Struct
|
40
|
-
layout(
|
41
|
-
:extensions, :pointer,
|
42
|
-
:description, :pointer,
|
43
|
-
:author, :pointer,
|
44
|
-
:url, :pointer,
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
class Sound_Sample < FFI::Struct
|
49
|
-
layout(
|
50
|
-
:opaque, :pointer,
|
51
|
-
:decoder, :pointer,
|
52
|
-
:desired, Sound_AudioInfo,
|
53
|
-
:actual, Sound_AudioInfo,
|
54
|
-
:buffer, :pointer,
|
55
|
-
:buffer_size, :uint,
|
56
|
-
:flags, :int,
|
57
|
-
)
|
58
|
-
end
|
59
|
-
|
60
|
-
class Sound_Version < FFI::Struct
|
61
|
-
layout(
|
62
|
-
:major, :int,
|
63
|
-
:minor, :int,
|
64
|
-
:patch, :int,
|
65
|
-
)
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
# Function
|
70
|
-
|
71
|
-
def self.setup_sound_symbols(output_error = false)
|
72
|
-
symbols = [
|
73
|
-
:Sound_GetLinkedVersion,
|
74
|
-
:Sound_Init,
|
75
|
-
:Sound_Quit,
|
76
|
-
:Sound_AvailableDecoders,
|
77
|
-
:Sound_GetError,
|
78
|
-
:Sound_ClearError,
|
79
|
-
:Sound_NewSample,
|
80
|
-
:Sound_NewSampleFromMem,
|
81
|
-
:Sound_NewSampleFromFile,
|
82
|
-
:Sound_FreeSample,
|
83
|
-
:Sound_GetDuration,
|
84
|
-
:Sound_SetBufferSize,
|
85
|
-
:Sound_Decode,
|
86
|
-
:Sound_DecodeAll,
|
87
|
-
:Sound_Rewind,
|
88
|
-
:Sound_Seek,
|
89
|
-
]
|
90
|
-
apis = {
|
91
|
-
:Sound_GetLinkedVersion => :Sound_GetLinkedVersion,
|
92
|
-
:Sound_Init => :Sound_Init,
|
93
|
-
:Sound_Quit => :Sound_Quit,
|
94
|
-
:Sound_AvailableDecoders => :Sound_AvailableDecoders,
|
95
|
-
:Sound_GetError => :Sound_GetError,
|
96
|
-
:Sound_ClearError => :Sound_ClearError,
|
97
|
-
:Sound_NewSample => :Sound_NewSample,
|
98
|
-
:Sound_NewSampleFromMem => :Sound_NewSampleFromMem,
|
99
|
-
:Sound_NewSampleFromFile => :Sound_NewSampleFromFile,
|
100
|
-
:Sound_FreeSample => :Sound_FreeSample,
|
101
|
-
:Sound_GetDuration => :Sound_GetDuration,
|
102
|
-
:Sound_SetBufferSize => :Sound_SetBufferSize,
|
103
|
-
:Sound_Decode => :Sound_Decode,
|
104
|
-
:Sound_DecodeAll => :Sound_DecodeAll,
|
105
|
-
:Sound_Rewind => :Sound_Rewind,
|
106
|
-
:Sound_Seek => :Sound_Seek,
|
107
|
-
}
|
108
|
-
args = {
|
109
|
-
:Sound_GetLinkedVersion => [:pointer],
|
110
|
-
:Sound_Init => [],
|
111
|
-
:Sound_Quit => [],
|
112
|
-
:Sound_AvailableDecoders => [],
|
113
|
-
:Sound_GetError => [],
|
114
|
-
:Sound_ClearError => [],
|
115
|
-
:Sound_NewSample => [:pointer, :pointer, :pointer, :uint],
|
116
|
-
:Sound_NewSampleFromMem => [:pointer, :uint, :pointer, :pointer, :uint],
|
117
|
-
:Sound_NewSampleFromFile => [:pointer, :pointer, :uint],
|
118
|
-
:Sound_FreeSample => [:pointer],
|
119
|
-
:Sound_GetDuration => [:pointer],
|
120
|
-
:Sound_SetBufferSize => [:pointer, :uint],
|
121
|
-
:Sound_Decode => [:pointer],
|
122
|
-
:Sound_DecodeAll => [:pointer],
|
123
|
-
:Sound_Rewind => [:pointer],
|
124
|
-
:Sound_Seek => [:pointer, :uint],
|
125
|
-
}
|
126
|
-
retvals = {
|
127
|
-
:Sound_GetLinkedVersion => :void,
|
128
|
-
:Sound_Init => :int,
|
129
|
-
:Sound_Quit => :int,
|
130
|
-
:Sound_AvailableDecoders => :pointer,
|
131
|
-
:Sound_GetError => :pointer,
|
132
|
-
:Sound_ClearError => :void,
|
133
|
-
:Sound_NewSample => :pointer,
|
134
|
-
:Sound_NewSampleFromMem => :pointer,
|
135
|
-
:Sound_NewSampleFromFile => :pointer,
|
136
|
-
:Sound_FreeSample => :void,
|
137
|
-
:Sound_GetDuration => :int,
|
138
|
-
:Sound_SetBufferSize => :int,
|
139
|
-
:Sound_Decode => :uint,
|
140
|
-
:Sound_DecodeAll => :uint,
|
141
|
-
:Sound_Rewind => :int,
|
142
|
-
:Sound_Seek => :int,
|
143
|
-
}
|
144
|
-
symbols.each do |sym|
|
145
|
-
begin
|
146
|
-
attach_function apis[sym], sym, args[sym], retvals[sym]
|
147
|
-
rescue FFI::NotFoundError => error
|
148
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
end
|
154
|
-
|
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
|
+
SOUND_VER_MAJOR = 2
|
14
|
+
SOUND_VER_MINOR = 0
|
15
|
+
SOUND_VER_PATCH = 1
|
16
|
+
|
17
|
+
# Enum
|
18
|
+
|
19
|
+
SOUND_SAMPLEFLAG_NONE = 0
|
20
|
+
SOUND_SAMPLEFLAG_CANSEEK = 1
|
21
|
+
SOUND_SAMPLEFLAG_EOF = 536870912
|
22
|
+
SOUND_SAMPLEFLAG_ERROR = 1073741824
|
23
|
+
SOUND_SAMPLEFLAG_EAGAIN = -2147483648
|
24
|
+
|
25
|
+
# Typedef
|
26
|
+
|
27
|
+
typedef :int, :Sound_SampleFlags
|
28
|
+
|
29
|
+
# Struct
|
30
|
+
|
31
|
+
class Sound_AudioInfo < FFI::Struct
|
32
|
+
layout(
|
33
|
+
:format, :ushort,
|
34
|
+
:channels, :uchar,
|
35
|
+
:rate, :uint,
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
class Sound_DecoderInfo < FFI::Struct
|
40
|
+
layout(
|
41
|
+
:extensions, :pointer,
|
42
|
+
:description, :pointer,
|
43
|
+
:author, :pointer,
|
44
|
+
:url, :pointer,
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
class Sound_Sample < FFI::Struct
|
49
|
+
layout(
|
50
|
+
:opaque, :pointer,
|
51
|
+
:decoder, :pointer,
|
52
|
+
:desired, Sound_AudioInfo,
|
53
|
+
:actual, Sound_AudioInfo,
|
54
|
+
:buffer, :pointer,
|
55
|
+
:buffer_size, :uint,
|
56
|
+
:flags, :int,
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
class Sound_Version < FFI::Struct
|
61
|
+
layout(
|
62
|
+
:major, :int,
|
63
|
+
:minor, :int,
|
64
|
+
:patch, :int,
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# Function
|
70
|
+
|
71
|
+
def self.setup_sound_symbols(output_error = false)
|
72
|
+
symbols = [
|
73
|
+
:Sound_GetLinkedVersion,
|
74
|
+
:Sound_Init,
|
75
|
+
:Sound_Quit,
|
76
|
+
:Sound_AvailableDecoders,
|
77
|
+
:Sound_GetError,
|
78
|
+
:Sound_ClearError,
|
79
|
+
:Sound_NewSample,
|
80
|
+
:Sound_NewSampleFromMem,
|
81
|
+
:Sound_NewSampleFromFile,
|
82
|
+
:Sound_FreeSample,
|
83
|
+
:Sound_GetDuration,
|
84
|
+
:Sound_SetBufferSize,
|
85
|
+
:Sound_Decode,
|
86
|
+
:Sound_DecodeAll,
|
87
|
+
:Sound_Rewind,
|
88
|
+
:Sound_Seek,
|
89
|
+
]
|
90
|
+
apis = {
|
91
|
+
:Sound_GetLinkedVersion => :Sound_GetLinkedVersion,
|
92
|
+
:Sound_Init => :Sound_Init,
|
93
|
+
:Sound_Quit => :Sound_Quit,
|
94
|
+
:Sound_AvailableDecoders => :Sound_AvailableDecoders,
|
95
|
+
:Sound_GetError => :Sound_GetError,
|
96
|
+
:Sound_ClearError => :Sound_ClearError,
|
97
|
+
:Sound_NewSample => :Sound_NewSample,
|
98
|
+
:Sound_NewSampleFromMem => :Sound_NewSampleFromMem,
|
99
|
+
:Sound_NewSampleFromFile => :Sound_NewSampleFromFile,
|
100
|
+
:Sound_FreeSample => :Sound_FreeSample,
|
101
|
+
:Sound_GetDuration => :Sound_GetDuration,
|
102
|
+
:Sound_SetBufferSize => :Sound_SetBufferSize,
|
103
|
+
:Sound_Decode => :Sound_Decode,
|
104
|
+
:Sound_DecodeAll => :Sound_DecodeAll,
|
105
|
+
:Sound_Rewind => :Sound_Rewind,
|
106
|
+
:Sound_Seek => :Sound_Seek,
|
107
|
+
}
|
108
|
+
args = {
|
109
|
+
:Sound_GetLinkedVersion => [:pointer],
|
110
|
+
:Sound_Init => [],
|
111
|
+
:Sound_Quit => [],
|
112
|
+
:Sound_AvailableDecoders => [],
|
113
|
+
:Sound_GetError => [],
|
114
|
+
:Sound_ClearError => [],
|
115
|
+
:Sound_NewSample => [:pointer, :pointer, :pointer, :uint],
|
116
|
+
:Sound_NewSampleFromMem => [:pointer, :uint, :pointer, :pointer, :uint],
|
117
|
+
:Sound_NewSampleFromFile => [:pointer, :pointer, :uint],
|
118
|
+
:Sound_FreeSample => [:pointer],
|
119
|
+
:Sound_GetDuration => [:pointer],
|
120
|
+
:Sound_SetBufferSize => [:pointer, :uint],
|
121
|
+
:Sound_Decode => [:pointer],
|
122
|
+
:Sound_DecodeAll => [:pointer],
|
123
|
+
:Sound_Rewind => [:pointer],
|
124
|
+
:Sound_Seek => [:pointer, :uint],
|
125
|
+
}
|
126
|
+
retvals = {
|
127
|
+
:Sound_GetLinkedVersion => :void,
|
128
|
+
:Sound_Init => :int,
|
129
|
+
:Sound_Quit => :int,
|
130
|
+
:Sound_AvailableDecoders => :pointer,
|
131
|
+
:Sound_GetError => :pointer,
|
132
|
+
:Sound_ClearError => :void,
|
133
|
+
:Sound_NewSample => :pointer,
|
134
|
+
:Sound_NewSampleFromMem => :pointer,
|
135
|
+
:Sound_NewSampleFromFile => :pointer,
|
136
|
+
:Sound_FreeSample => :void,
|
137
|
+
:Sound_GetDuration => :int,
|
138
|
+
:Sound_SetBufferSize => :int,
|
139
|
+
:Sound_Decode => :uint,
|
140
|
+
:Sound_DecodeAll => :uint,
|
141
|
+
:Sound_Rewind => :int,
|
142
|
+
:Sound_Seek => :int,
|
143
|
+
}
|
144
|
+
symbols.each do |sym|
|
145
|
+
begin
|
146
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
147
|
+
rescue FFI::NotFoundError => error
|
148
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|