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_mouse.rb
CHANGED
@@ -1,136 +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 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
|
-
|
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
|
+
|