sdl2-bindings 0.0.5 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +96 -79
- data/LICENSE.txt +1 -1
- data/README.md +55 -49
- data/lib/sdl2.rb +172 -170
- data/lib/sdl2_audio.rb +222 -201
- data/lib/sdl2_blendmode.rb +69 -69
- data/lib/sdl2_clipboard.rb +51 -51
- data/lib/sdl2_cpuinfo.rb +106 -106
- data/lib/sdl2_error.rb +64 -64
- data/lib/sdl2_events.rb +533 -530
- data/lib/sdl2_filesystem.rb +48 -48
- data/lib/sdl2_framerate.rb +67 -67
- data/lib/sdl2_gamecontroller.rb +274 -254
- data/lib/sdl2_gesture.rb +55 -55
- data/lib/sdl2_gfxPrimitives.rb +222 -222
- data/lib/sdl2_haptic.rb +269 -269
- data/lib/sdl2_hidapi.rb +118 -0
- data/lib/sdl2_hints.rb +198 -174
- data/lib/sdl2_image.rb +185 -185
- data/lib/sdl2_imageFilter.rb +132 -132
- data/lib/sdl2_joystick.rb +239 -230
- data/lib/sdl2_keyboard.rb +99 -99
- data/lib/sdl2_keycode.rb +305 -304
- data/lib/sdl2_log.rb +115 -115
- data/lib/sdl2_main.rb +67 -67
- data/lib/sdl2_messagebox.rb +98 -98
- data/lib/sdl2_misc.rb +45 -0
- data/lib/sdl2_mixer.rb +317 -307
- data/lib/sdl2_mouse.rb +117 -117
- data/lib/sdl2_pixels.rb +224 -224
- data/lib/sdl2_platform.rb +45 -45
- data/lib/sdl2_power.rb +51 -51
- data/lib/sdl2_rect.rb +102 -102
- data/lib/sdl2_render.rb +322 -290
- data/lib/sdl2_rotozoom.rb +66 -66
- data/lib/sdl2_rwops.rb +208 -208
- data/lib/sdl2_scancode.rb +287 -287
- data/lib/sdl2_sensor.rb +97 -0
- data/lib/sdl2_shape.rb +77 -77
- data/lib/sdl2_stdinc.rb +439 -393
- data/lib/sdl2_surface.rb +188 -182
- data/lib/sdl2_syswm.rb +157 -154
- data/lib/sdl2_timer.rb +65 -62
- data/lib/sdl2_touch.rb +75 -73
- data/lib/sdl2_ttf.rb +202 -190
- data/lib/sdl2_version.rb +62 -62
- data/lib/sdl2_video.rb +446 -411
- data/lib/sdl2_vulkan.rb +64 -64
- metadata +9 -6
data/lib/sdl2_platform.rb
CHANGED
@@ -1,45 +1,45 @@
|
|
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
|
-
|
23
|
-
# Function
|
24
|
-
|
25
|
-
def self.setup_platform_symbols()
|
26
|
-
symbols = [
|
27
|
-
:SDL_GetPlatform,
|
28
|
-
]
|
29
|
-
args = {
|
30
|
-
:SDL_GetPlatform => [],
|
31
|
-
}
|
32
|
-
retvals = {
|
33
|
-
:SDL_GetPlatform => :pointer,
|
34
|
-
}
|
35
|
-
symbols.each do |sym|
|
36
|
-
begin
|
37
|
-
attach_function sym, args[sym], retvals[sym]
|
38
|
-
rescue FFI::NotFoundError => error
|
39
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
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
|
+
|
23
|
+
# Function
|
24
|
+
|
25
|
+
def self.setup_platform_symbols()
|
26
|
+
symbols = [
|
27
|
+
:SDL_GetPlatform,
|
28
|
+
]
|
29
|
+
args = {
|
30
|
+
:SDL_GetPlatform => [],
|
31
|
+
}
|
32
|
+
retvals = {
|
33
|
+
:SDL_GetPlatform => :pointer,
|
34
|
+
}
|
35
|
+
symbols.each do |sym|
|
36
|
+
begin
|
37
|
+
attach_function sym, args[sym], retvals[sym]
|
38
|
+
rescue FFI::NotFoundError => error
|
39
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
data/lib/sdl2_power.rb
CHANGED
@@ -1,51 +1,51 @@
|
|
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
|
-
SDL_POWERSTATE_UNKNOWN = 0
|
17
|
-
SDL_POWERSTATE_ON_BATTERY = 1
|
18
|
-
SDL_POWERSTATE_NO_BATTERY = 2
|
19
|
-
SDL_POWERSTATE_CHARGING = 3
|
20
|
-
SDL_POWERSTATE_CHARGED = 4
|
21
|
-
|
22
|
-
# Typedef
|
23
|
-
|
24
|
-
typedef :int, :SDL_PowerState
|
25
|
-
|
26
|
-
# Struct
|
27
|
-
|
28
|
-
|
29
|
-
# Function
|
30
|
-
|
31
|
-
def self.setup_power_symbols()
|
32
|
-
symbols = [
|
33
|
-
:SDL_GetPowerInfo,
|
34
|
-
]
|
35
|
-
args = {
|
36
|
-
:SDL_GetPowerInfo => [:pointer, :pointer],
|
37
|
-
}
|
38
|
-
retvals = {
|
39
|
-
:SDL_GetPowerInfo => :int,
|
40
|
-
}
|
41
|
-
symbols.each do |sym|
|
42
|
-
begin
|
43
|
-
attach_function sym, args[sym], retvals[sym]
|
44
|
-
rescue FFI::NotFoundError => error
|
45
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
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
|
+
SDL_POWERSTATE_UNKNOWN = 0
|
17
|
+
SDL_POWERSTATE_ON_BATTERY = 1
|
18
|
+
SDL_POWERSTATE_NO_BATTERY = 2
|
19
|
+
SDL_POWERSTATE_CHARGING = 3
|
20
|
+
SDL_POWERSTATE_CHARGED = 4
|
21
|
+
|
22
|
+
# Typedef
|
23
|
+
|
24
|
+
typedef :int, :SDL_PowerState
|
25
|
+
|
26
|
+
# Struct
|
27
|
+
|
28
|
+
|
29
|
+
# Function
|
30
|
+
|
31
|
+
def self.setup_power_symbols()
|
32
|
+
symbols = [
|
33
|
+
:SDL_GetPowerInfo,
|
34
|
+
]
|
35
|
+
args = {
|
36
|
+
:SDL_GetPowerInfo => [:pointer, :pointer],
|
37
|
+
}
|
38
|
+
retvals = {
|
39
|
+
:SDL_GetPowerInfo => :int,
|
40
|
+
}
|
41
|
+
symbols.each do |sym|
|
42
|
+
begin
|
43
|
+
attach_function sym, args[sym], retvals[sym]
|
44
|
+
rescue FFI::NotFoundError => error
|
45
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
data/lib/sdl2_rect.rb
CHANGED
@@ -1,102 +1,102 @@
|
|
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
|
-
def SDL_PointInRect(p, r)
|
21
|
-
return ( (p.x >= r.x) && (p.x < (r.x + r.w)) && (p.y >= r.y) && (p.y < (r.y + r.h)) ) ? 1 : 0;
|
22
|
-
end
|
23
|
-
|
24
|
-
def SDL_RectEmpty(r)
|
25
|
-
return (!r.null? || (r.w <= 0) || (r.h <= 0)) ? 1 : 0
|
26
|
-
end
|
27
|
-
|
28
|
-
def SDL_RectEquals(a, b)
|
29
|
-
return (!a.null? && !b.null? && (a.x == b.x) && (a.y == b.y) && (a.w == b.w) && (a.h == b.h)) ? 1 : 0
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
# Struct
|
34
|
-
|
35
|
-
class SDL_Point < FFI::Struct
|
36
|
-
layout(
|
37
|
-
:x, :int,
|
38
|
-
:y, :int,
|
39
|
-
)
|
40
|
-
end
|
41
|
-
|
42
|
-
class SDL_FPoint < FFI::Struct
|
43
|
-
layout(
|
44
|
-
:x, :float,
|
45
|
-
:y, :float,
|
46
|
-
)
|
47
|
-
end
|
48
|
-
|
49
|
-
class SDL_Rect < FFI::Struct
|
50
|
-
layout(
|
51
|
-
:x, :int,
|
52
|
-
:y, :int,
|
53
|
-
:w, :int,
|
54
|
-
:h, :int,
|
55
|
-
)
|
56
|
-
end
|
57
|
-
|
58
|
-
class SDL_FRect < FFI::Struct
|
59
|
-
layout(
|
60
|
-
:x, :float,
|
61
|
-
:y, :float,
|
62
|
-
:w, :float,
|
63
|
-
:h, :float,
|
64
|
-
)
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
# Function
|
69
|
-
|
70
|
-
def self.setup_rect_symbols()
|
71
|
-
symbols = [
|
72
|
-
:SDL_HasIntersection,
|
73
|
-
:SDL_IntersectRect,
|
74
|
-
:SDL_UnionRect,
|
75
|
-
:SDL_EnclosePoints,
|
76
|
-
:SDL_IntersectRectAndLine,
|
77
|
-
]
|
78
|
-
args = {
|
79
|
-
:SDL_HasIntersection => [:pointer, :pointer],
|
80
|
-
:SDL_IntersectRect => [:pointer, :pointer, :pointer],
|
81
|
-
:SDL_UnionRect => [:pointer, :pointer, :pointer],
|
82
|
-
:SDL_EnclosePoints => [:pointer, :int, :pointer, :pointer],
|
83
|
-
:SDL_IntersectRectAndLine => [:pointer, :pointer, :pointer, :pointer, :pointer],
|
84
|
-
}
|
85
|
-
retvals = {
|
86
|
-
:SDL_HasIntersection => :int,
|
87
|
-
:SDL_IntersectRect => :int,
|
88
|
-
:SDL_UnionRect => :void,
|
89
|
-
:SDL_EnclosePoints => :int,
|
90
|
-
:SDL_IntersectRectAndLine => :int,
|
91
|
-
}
|
92
|
-
symbols.each do |sym|
|
93
|
-
begin
|
94
|
-
attach_function sym, args[sym], retvals[sym]
|
95
|
-
rescue FFI::NotFoundError => error
|
96
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
102
|
-
|
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
|
+
def SDL_PointInRect(p, r)
|
21
|
+
return ( (p.x >= r.x) && (p.x < (r.x + r.w)) && (p.y >= r.y) && (p.y < (r.y + r.h)) ) ? 1 : 0;
|
22
|
+
end
|
23
|
+
|
24
|
+
def SDL_RectEmpty(r)
|
25
|
+
return (!r.null? || (r.w <= 0) || (r.h <= 0)) ? 1 : 0
|
26
|
+
end
|
27
|
+
|
28
|
+
def SDL_RectEquals(a, b)
|
29
|
+
return (!a.null? && !b.null? && (a.x == b.x) && (a.y == b.y) && (a.w == b.w) && (a.h == b.h)) ? 1 : 0
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
# Struct
|
34
|
+
|
35
|
+
class SDL_Point < FFI::Struct
|
36
|
+
layout(
|
37
|
+
:x, :int,
|
38
|
+
:y, :int,
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
class SDL_FPoint < FFI::Struct
|
43
|
+
layout(
|
44
|
+
:x, :float,
|
45
|
+
:y, :float,
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
class SDL_Rect < FFI::Struct
|
50
|
+
layout(
|
51
|
+
:x, :int,
|
52
|
+
:y, :int,
|
53
|
+
:w, :int,
|
54
|
+
:h, :int,
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
class SDL_FRect < FFI::Struct
|
59
|
+
layout(
|
60
|
+
:x, :float,
|
61
|
+
:y, :float,
|
62
|
+
:w, :float,
|
63
|
+
:h, :float,
|
64
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
# Function
|
69
|
+
|
70
|
+
def self.setup_rect_symbols()
|
71
|
+
symbols = [
|
72
|
+
:SDL_HasIntersection,
|
73
|
+
:SDL_IntersectRect,
|
74
|
+
:SDL_UnionRect,
|
75
|
+
:SDL_EnclosePoints,
|
76
|
+
:SDL_IntersectRectAndLine,
|
77
|
+
]
|
78
|
+
args = {
|
79
|
+
:SDL_HasIntersection => [:pointer, :pointer],
|
80
|
+
:SDL_IntersectRect => [:pointer, :pointer, :pointer],
|
81
|
+
:SDL_UnionRect => [:pointer, :pointer, :pointer],
|
82
|
+
:SDL_EnclosePoints => [:pointer, :int, :pointer, :pointer],
|
83
|
+
:SDL_IntersectRectAndLine => [:pointer, :pointer, :pointer, :pointer, :pointer],
|
84
|
+
}
|
85
|
+
retvals = {
|
86
|
+
:SDL_HasIntersection => :int,
|
87
|
+
:SDL_IntersectRect => :int,
|
88
|
+
:SDL_UnionRect => :void,
|
89
|
+
:SDL_EnclosePoints => :int,
|
90
|
+
:SDL_IntersectRectAndLine => :int,
|
91
|
+
}
|
92
|
+
symbols.each do |sym|
|
93
|
+
begin
|
94
|
+
attach_function sym, args[sym], retvals[sym]
|
95
|
+
rescue FFI::NotFoundError => error
|
96
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|