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.
- checksums.yaml +4 -4
- data/ChangeLog +134 -108
- data/LICENSE.txt +0 -0
- data/README.md +86 -68
- data/lib/sdl2.rb +131 -127
- data/lib/sdl2_audio.rb +261 -261
- data/lib/sdl2_blendmode.rb +72 -72
- data/lib/sdl2_clipboard.rb +56 -56
- data/lib/sdl2_cpuinfo.rb +129 -129
- data/lib/sdl2_error.rb +71 -71
- data/lib/sdl2_events.rb +564 -552
- data/lib/sdl2_filesystem.rb +52 -52
- data/lib/sdl2_framerate.rb +74 -74
- data/lib/sdl2_gamecontroller.rb +329 -329
- data/lib/sdl2_gesture.rb +61 -61
- data/lib/sdl2_gfxPrimitives.rb +283 -283
- data/lib/sdl2_haptic.rb +301 -301
- data/lib/sdl2_hidapi.rb +139 -139
- data/lib/sdl2_hints.rb +221 -207
- data/lib/sdl2_image.rb +296 -232
- data/lib/sdl2_imageFilter.rb +164 -164
- data/lib/sdl2_joystick.rb +294 -294
- data/lib/sdl2_keyboard.rb +125 -117
- data/lib/sdl2_keycode.rb +307 -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 -109
- data/lib/sdl2_render.rb +408 -404
- data/lib/sdl2_rotozoom.rb +76 -76
- data/lib/sdl2_rwops.rb +242 -238
- data/lib/sdl2_scancode.rb +289 -289
- data/lib/sdl2_sensor.rb +115 -115
- data/lib/sdl2_shape.rb +83 -83
- data/lib/sdl2_sound.rb +154 -0
- data/lib/sdl2_stdinc.rb +548 -564
- 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 -82
- data/lib/sdl2_ttf.rb +414 -357
- data/lib/sdl2_version.rb +67 -67
- data/lib/sdl2_video.rb +540 -540
- data/lib/sdl2_vulkan.rb +72 -72
- metadata +3 -2
data/lib/sdl2_keyboard.rb
CHANGED
@@ -1,117 +1,125 @@
|
|
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
|
-
|
14
|
-
# Enum
|
15
|
-
|
16
|
-
|
17
|
-
# Typedef
|
18
|
-
|
19
|
-
|
20
|
-
# Struct
|
21
|
-
|
22
|
-
class Keysym < FFI::Struct
|
23
|
-
layout(
|
24
|
-
:scancode, :int,
|
25
|
-
:sym, :int,
|
26
|
-
:mod, :ushort,
|
27
|
-
:unused, :uint,
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
# Function
|
33
|
-
|
34
|
-
def self.setup_keyboard_symbols(output_error = false)
|
35
|
-
symbols = [
|
36
|
-
:SDL_GetKeyboardFocus,
|
37
|
-
:SDL_GetKeyboardState,
|
38
|
-
:SDL_GetModState,
|
39
|
-
:SDL_SetModState,
|
40
|
-
:SDL_GetKeyFromScancode,
|
41
|
-
:SDL_GetScancodeFromKey,
|
42
|
-
:SDL_GetScancodeName,
|
43
|
-
:SDL_GetScancodeFromName,
|
44
|
-
:SDL_GetKeyName,
|
45
|
-
:SDL_GetKeyFromName,
|
46
|
-
:SDL_StartTextInput,
|
47
|
-
:SDL_IsTextInputActive,
|
48
|
-
:SDL_StopTextInput,
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
|
71
|
-
|
72
|
-
:
|
73
|
-
:
|
74
|
-
|
75
|
-
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
80
|
-
:
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
87
|
-
:
|
88
|
-
|
89
|
-
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
93
|
-
:
|
94
|
-
|
95
|
-
|
96
|
-
:
|
97
|
-
:
|
98
|
-
:
|
99
|
-
:
|
100
|
-
:
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
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
|
+
|
14
|
+
# Enum
|
15
|
+
|
16
|
+
|
17
|
+
# Typedef
|
18
|
+
|
19
|
+
|
20
|
+
# Struct
|
21
|
+
|
22
|
+
class Keysym < FFI::Struct
|
23
|
+
layout(
|
24
|
+
:scancode, :int,
|
25
|
+
:sym, :int,
|
26
|
+
:mod, :ushort,
|
27
|
+
:unused, :uint,
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# Function
|
33
|
+
|
34
|
+
def self.setup_keyboard_symbols(output_error = false)
|
35
|
+
symbols = [
|
36
|
+
:SDL_GetKeyboardFocus,
|
37
|
+
:SDL_GetKeyboardState,
|
38
|
+
:SDL_GetModState,
|
39
|
+
:SDL_SetModState,
|
40
|
+
:SDL_GetKeyFromScancode,
|
41
|
+
:SDL_GetScancodeFromKey,
|
42
|
+
:SDL_GetScancodeName,
|
43
|
+
:SDL_GetScancodeFromName,
|
44
|
+
:SDL_GetKeyName,
|
45
|
+
:SDL_GetKeyFromName,
|
46
|
+
:SDL_StartTextInput,
|
47
|
+
:SDL_IsTextInputActive,
|
48
|
+
:SDL_StopTextInput,
|
49
|
+
:SDL_ClearComposition,
|
50
|
+
:SDL_IsTextInputShown,
|
51
|
+
:SDL_SetTextInputRect,
|
52
|
+
:SDL_HasScreenKeyboardSupport,
|
53
|
+
:SDL_IsScreenKeyboardShown,
|
54
|
+
]
|
55
|
+
apis = {
|
56
|
+
:SDL_GetKeyboardFocus => :GetKeyboardFocus,
|
57
|
+
:SDL_GetKeyboardState => :GetKeyboardState,
|
58
|
+
:SDL_GetModState => :GetModState,
|
59
|
+
:SDL_SetModState => :SetModState,
|
60
|
+
:SDL_GetKeyFromScancode => :GetKeyFromScancode,
|
61
|
+
:SDL_GetScancodeFromKey => :GetScancodeFromKey,
|
62
|
+
:SDL_GetScancodeName => :GetScancodeName,
|
63
|
+
:SDL_GetScancodeFromName => :GetScancodeFromName,
|
64
|
+
:SDL_GetKeyName => :GetKeyName,
|
65
|
+
:SDL_GetKeyFromName => :GetKeyFromName,
|
66
|
+
:SDL_StartTextInput => :StartTextInput,
|
67
|
+
:SDL_IsTextInputActive => :IsTextInputActive,
|
68
|
+
:SDL_StopTextInput => :StopTextInput,
|
69
|
+
:SDL_ClearComposition => :ClearComposition,
|
70
|
+
:SDL_IsTextInputShown => :IsTextInputShown,
|
71
|
+
:SDL_SetTextInputRect => :SetTextInputRect,
|
72
|
+
:SDL_HasScreenKeyboardSupport => :HasScreenKeyboardSupport,
|
73
|
+
:SDL_IsScreenKeyboardShown => :IsScreenKeyboardShown,
|
74
|
+
}
|
75
|
+
args = {
|
76
|
+
:SDL_GetKeyboardFocus => [],
|
77
|
+
:SDL_GetKeyboardState => [:pointer],
|
78
|
+
:SDL_GetModState => [],
|
79
|
+
:SDL_SetModState => [:int],
|
80
|
+
:SDL_GetKeyFromScancode => [:int],
|
81
|
+
:SDL_GetScancodeFromKey => [:int],
|
82
|
+
:SDL_GetScancodeName => [:int],
|
83
|
+
:SDL_GetScancodeFromName => [:pointer],
|
84
|
+
:SDL_GetKeyName => [:int],
|
85
|
+
:SDL_GetKeyFromName => [:pointer],
|
86
|
+
:SDL_StartTextInput => [],
|
87
|
+
:SDL_IsTextInputActive => [],
|
88
|
+
:SDL_StopTextInput => [],
|
89
|
+
:SDL_ClearComposition => [],
|
90
|
+
:SDL_IsTextInputShown => [],
|
91
|
+
:SDL_SetTextInputRect => [:pointer],
|
92
|
+
:SDL_HasScreenKeyboardSupport => [],
|
93
|
+
:SDL_IsScreenKeyboardShown => [:pointer],
|
94
|
+
}
|
95
|
+
retvals = {
|
96
|
+
:SDL_GetKeyboardFocus => :pointer,
|
97
|
+
:SDL_GetKeyboardState => :pointer,
|
98
|
+
:SDL_GetModState => :int,
|
99
|
+
:SDL_SetModState => :void,
|
100
|
+
:SDL_GetKeyFromScancode => :int,
|
101
|
+
:SDL_GetScancodeFromKey => :int,
|
102
|
+
:SDL_GetScancodeName => :pointer,
|
103
|
+
:SDL_GetScancodeFromName => :int,
|
104
|
+
:SDL_GetKeyName => :pointer,
|
105
|
+
:SDL_GetKeyFromName => :int,
|
106
|
+
:SDL_StartTextInput => :void,
|
107
|
+
:SDL_IsTextInputActive => :int,
|
108
|
+
:SDL_StopTextInput => :void,
|
109
|
+
:SDL_ClearComposition => :void,
|
110
|
+
:SDL_IsTextInputShown => :int,
|
111
|
+
:SDL_SetTextInputRect => :void,
|
112
|
+
:SDL_HasScreenKeyboardSupport => :int,
|
113
|
+
:SDL_IsScreenKeyboardShown => :int,
|
114
|
+
}
|
115
|
+
symbols.each do |sym|
|
116
|
+
begin
|
117
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
118
|
+
rescue FFI::NotFoundError => error
|
119
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|