sdl2-bindings 0.0.8 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +124 -92
- data/LICENSE.txt +1 -1
- data/README.md +77 -53
- data/lib/sdl2.rb +131 -172
- data/lib/sdl2_audio.rb +261 -222
- data/lib/sdl2_blendmode.rb +72 -69
- data/lib/sdl2_clipboard.rb +56 -51
- data/lib/sdl2_cpuinfo.rb +129 -106
- data/lib/sdl2_error.rb +71 -64
- data/lib/sdl2_events.rb +564 -533
- data/lib/sdl2_filesystem.rb +52 -48
- data/lib/sdl2_framerate.rb +74 -67
- data/lib/sdl2_gamecontroller.rb +329 -274
- data/lib/sdl2_gesture.rb +61 -55
- data/lib/sdl2_gfxPrimitives.rb +283 -222
- data/lib/sdl2_haptic.rb +301 -269
- data/lib/sdl2_hidapi.rb +139 -118
- data/lib/sdl2_hints.rb +221 -197
- data/lib/sdl2_image.rb +232 -185
- data/lib/sdl2_imageFilter.rb +164 -132
- data/lib/sdl2_joystick.rb +294 -239
- data/lib/sdl2_keyboard.rb +125 -99
- data/lib/sdl2_keycode.rb +307 -305
- data/lib/sdl2_log.rb +131 -115
- data/lib/sdl2_main.rb +74 -67
- data/lib/sdl2_messagebox.rb +102 -98
- data/lib/sdl2_misc.rb +48 -45
- data/lib/sdl2_mixer.rb +392 -317
- data/lib/sdl2_mouse.rb +136 -117
- data/lib/sdl2_pixels.rb +240 -224
- data/lib/sdl2_platform.rb +48 -45
- data/lib/sdl2_power.rb +54 -51
- data/lib/sdl2_rect.rb +145 -102
- data/lib/sdl2_render.rb +408 -322
- data/lib/sdl2_rotozoom.rb +76 -66
- data/lib/sdl2_rwops.rb +238 -208
- data/lib/sdl2_scancode.rb +289 -287
- data/lib/sdl2_sensor.rb +115 -97
- data/lib/sdl2_shape.rb +83 -77
- data/lib/sdl2_sound.rb +154 -0
- data/lib/sdl2_stdinc.rb +556 -439
- data/lib/sdl2_surface.rb +229 -188
- data/lib/sdl2_syswm.rb +160 -156
- data/lib/sdl2_timer.rb +74 -65
- data/lib/sdl2_touch.rb +86 -75
- data/lib/sdl2_ttf.rb +358 -202
- data/lib/sdl2_version.rb +67 -62
- data/lib/sdl2_video.rb +540 -446
- data/lib/sdl2_vulkan.rb +72 -64
- metadata +19 -4
data/lib/sdl2_mouse.rb
CHANGED
@@ -1,117 +1,136 @@
|
|
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
|
10
|
-
extend FFI::Library
|
11
|
-
# Define/Macro
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
# Enum
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
# Typedef
|
38
|
-
|
39
|
-
typedef :int, :SDL_SystemCursor
|
40
|
-
typedef :int, :SDL_MouseWheelDirection
|
41
|
-
|
42
|
-
# Struct
|
43
|
-
|
44
|
-
|
45
|
-
# Function
|
46
|
-
|
47
|
-
def self.setup_mouse_symbols()
|
48
|
-
symbols = [
|
49
|
-
:SDL_GetMouseFocus,
|
50
|
-
:SDL_GetMouseState,
|
51
|
-
:SDL_GetGlobalMouseState,
|
52
|
-
:SDL_GetRelativeMouseState,
|
53
|
-
:SDL_WarpMouseInWindow,
|
54
|
-
:SDL_WarpMouseGlobal,
|
55
|
-
:SDL_SetRelativeMouseMode,
|
56
|
-
:SDL_CaptureMouse,
|
57
|
-
:SDL_GetRelativeMouseMode,
|
58
|
-
:SDL_CreateCursor,
|
59
|
-
:SDL_CreateColorCursor,
|
60
|
-
:SDL_CreateSystemCursor,
|
61
|
-
:SDL_SetCursor,
|
62
|
-
:SDL_GetCursor,
|
63
|
-
:SDL_GetDefaultCursor,
|
64
|
-
:SDL_FreeCursor,
|
65
|
-
:SDL_ShowCursor,
|
66
|
-
]
|
67
|
-
|
68
|
-
:SDL_GetMouseFocus =>
|
69
|
-
:SDL_GetMouseState =>
|
70
|
-
:SDL_GetGlobalMouseState =>
|
71
|
-
:SDL_GetRelativeMouseState =>
|
72
|
-
:SDL_WarpMouseInWindow =>
|
73
|
-
:SDL_WarpMouseGlobal =>
|
74
|
-
:SDL_SetRelativeMouseMode =>
|
75
|
-
:SDL_CaptureMouse =>
|
76
|
-
:SDL_GetRelativeMouseMode =>
|
77
|
-
:SDL_CreateCursor =>
|
78
|
-
:SDL_CreateColorCursor =>
|
79
|
-
:SDL_CreateSystemCursor =>
|
80
|
-
:SDL_SetCursor =>
|
81
|
-
:SDL_GetCursor =>
|
82
|
-
:SDL_GetDefaultCursor =>
|
83
|
-
:SDL_FreeCursor =>
|
84
|
-
:SDL_ShowCursor =>
|
85
|
-
}
|
86
|
-
|
87
|
-
:SDL_GetMouseFocus =>
|
88
|
-
:SDL_GetMouseState => :
|
89
|
-
:SDL_GetGlobalMouseState => :
|
90
|
-
:SDL_GetRelativeMouseState => :
|
91
|
-
:SDL_WarpMouseInWindow => :
|
92
|
-
:SDL_WarpMouseGlobal => :int,
|
93
|
-
:SDL_SetRelativeMouseMode => :int,
|
94
|
-
:SDL_CaptureMouse => :int,
|
95
|
-
:SDL_GetRelativeMouseMode =>
|
96
|
-
:SDL_CreateCursor => :pointer,
|
97
|
-
:SDL_CreateColorCursor => :pointer,
|
98
|
-
:SDL_CreateSystemCursor => :
|
99
|
-
:SDL_SetCursor => :
|
100
|
-
:SDL_GetCursor =>
|
101
|
-
:SDL_GetDefaultCursor =>
|
102
|
-
:SDL_FreeCursor => :
|
103
|
-
:SDL_ShowCursor => :int,
|
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
|
+
BUTTON_LEFT = 1
|
14
|
+
BUTTON_MIDDLE = 2
|
15
|
+
BUTTON_RIGHT = 3
|
16
|
+
BUTTON_X1 = 4
|
17
|
+
BUTTON_X2 = 5
|
18
|
+
|
19
|
+
# Enum
|
20
|
+
|
21
|
+
SYSTEM_CURSOR_ARROW = 0
|
22
|
+
SYSTEM_CURSOR_IBEAM = 1
|
23
|
+
SYSTEM_CURSOR_WAIT = 2
|
24
|
+
SYSTEM_CURSOR_CROSSHAIR = 3
|
25
|
+
SYSTEM_CURSOR_WAITARROW = 4
|
26
|
+
SYSTEM_CURSOR_SIZENWSE = 5
|
27
|
+
SYSTEM_CURSOR_SIZENESW = 6
|
28
|
+
SYSTEM_CURSOR_SIZEWE = 7
|
29
|
+
SYSTEM_CURSOR_SIZENS = 8
|
30
|
+
SYSTEM_CURSOR_SIZEALL = 9
|
31
|
+
SYSTEM_CURSOR_NO = 10
|
32
|
+
SYSTEM_CURSOR_HAND = 11
|
33
|
+
NUM_SYSTEM_CURSORS = 12
|
34
|
+
MOUSEWHEEL_NORMAL = 0
|
35
|
+
MOUSEWHEEL_FLIPPED = 1
|
36
|
+
|
37
|
+
# Typedef
|
38
|
+
|
39
|
+
typedef :int, :SDL_SystemCursor
|
40
|
+
typedef :int, :SDL_MouseWheelDirection
|
41
|
+
|
42
|
+
# Struct
|
43
|
+
|
44
|
+
|
45
|
+
# Function
|
46
|
+
|
47
|
+
def self.setup_mouse_symbols(output_error = false)
|
48
|
+
symbols = [
|
49
|
+
:SDL_GetMouseFocus,
|
50
|
+
:SDL_GetMouseState,
|
51
|
+
:SDL_GetGlobalMouseState,
|
52
|
+
:SDL_GetRelativeMouseState,
|
53
|
+
:SDL_WarpMouseInWindow,
|
54
|
+
:SDL_WarpMouseGlobal,
|
55
|
+
:SDL_SetRelativeMouseMode,
|
56
|
+
:SDL_CaptureMouse,
|
57
|
+
:SDL_GetRelativeMouseMode,
|
58
|
+
:SDL_CreateCursor,
|
59
|
+
:SDL_CreateColorCursor,
|
60
|
+
:SDL_CreateSystemCursor,
|
61
|
+
:SDL_SetCursor,
|
62
|
+
:SDL_GetCursor,
|
63
|
+
:SDL_GetDefaultCursor,
|
64
|
+
:SDL_FreeCursor,
|
65
|
+
:SDL_ShowCursor,
|
66
|
+
]
|
67
|
+
apis = {
|
68
|
+
:SDL_GetMouseFocus => :GetMouseFocus,
|
69
|
+
:SDL_GetMouseState => :GetMouseState,
|
70
|
+
:SDL_GetGlobalMouseState => :GetGlobalMouseState,
|
71
|
+
:SDL_GetRelativeMouseState => :GetRelativeMouseState,
|
72
|
+
:SDL_WarpMouseInWindow => :WarpMouseInWindow,
|
73
|
+
:SDL_WarpMouseGlobal => :WarpMouseGlobal,
|
74
|
+
:SDL_SetRelativeMouseMode => :SetRelativeMouseMode,
|
75
|
+
:SDL_CaptureMouse => :CaptureMouse,
|
76
|
+
:SDL_GetRelativeMouseMode => :GetRelativeMouseMode,
|
77
|
+
:SDL_CreateCursor => :CreateCursor,
|
78
|
+
:SDL_CreateColorCursor => :CreateColorCursor,
|
79
|
+
:SDL_CreateSystemCursor => :CreateSystemCursor,
|
80
|
+
:SDL_SetCursor => :SetCursor,
|
81
|
+
:SDL_GetCursor => :GetCursor,
|
82
|
+
:SDL_GetDefaultCursor => :GetDefaultCursor,
|
83
|
+
:SDL_FreeCursor => :FreeCursor,
|
84
|
+
:SDL_ShowCursor => :ShowCursor,
|
85
|
+
}
|
86
|
+
args = {
|
87
|
+
:SDL_GetMouseFocus => [],
|
88
|
+
:SDL_GetMouseState => [:pointer, :pointer],
|
89
|
+
:SDL_GetGlobalMouseState => [:pointer, :pointer],
|
90
|
+
:SDL_GetRelativeMouseState => [:pointer, :pointer],
|
91
|
+
:SDL_WarpMouseInWindow => [:pointer, :int, :int],
|
92
|
+
:SDL_WarpMouseGlobal => [:int, :int],
|
93
|
+
:SDL_SetRelativeMouseMode => [:int],
|
94
|
+
:SDL_CaptureMouse => [:int],
|
95
|
+
:SDL_GetRelativeMouseMode => [],
|
96
|
+
:SDL_CreateCursor => [:pointer, :pointer, :int, :int, :int, :int],
|
97
|
+
:SDL_CreateColorCursor => [:pointer, :int, :int],
|
98
|
+
:SDL_CreateSystemCursor => [:int],
|
99
|
+
:SDL_SetCursor => [:pointer],
|
100
|
+
:SDL_GetCursor => [],
|
101
|
+
:SDL_GetDefaultCursor => [],
|
102
|
+
:SDL_FreeCursor => [:pointer],
|
103
|
+
:SDL_ShowCursor => [:int],
|
104
|
+
}
|
105
|
+
retvals = {
|
106
|
+
:SDL_GetMouseFocus => :pointer,
|
107
|
+
:SDL_GetMouseState => :uint,
|
108
|
+
:SDL_GetGlobalMouseState => :uint,
|
109
|
+
:SDL_GetRelativeMouseState => :uint,
|
110
|
+
:SDL_WarpMouseInWindow => :void,
|
111
|
+
:SDL_WarpMouseGlobal => :int,
|
112
|
+
:SDL_SetRelativeMouseMode => :int,
|
113
|
+
:SDL_CaptureMouse => :int,
|
114
|
+
:SDL_GetRelativeMouseMode => :int,
|
115
|
+
:SDL_CreateCursor => :pointer,
|
116
|
+
:SDL_CreateColorCursor => :pointer,
|
117
|
+
:SDL_CreateSystemCursor => :pointer,
|
118
|
+
:SDL_SetCursor => :void,
|
119
|
+
:SDL_GetCursor => :pointer,
|
120
|
+
:SDL_GetDefaultCursor => :pointer,
|
121
|
+
:SDL_FreeCursor => :void,
|
122
|
+
:SDL_ShowCursor => :int,
|
123
|
+
}
|
124
|
+
symbols.each do |sym|
|
125
|
+
begin
|
126
|
+
attach_function apis[sym], sym, args[sym], retvals[sym]
|
127
|
+
rescue FFI::NotFoundError => error
|
128
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).") if output_error
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
# TODO : def self.BUTTON(X); (1 << ((X)-1)); end;
|
136
|
+
|