sdl2-bindings 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +83 -79
- data/LICENSE.txt +1 -1
- data/README.md +49 -49
- data/lib/sdl2.rb +170 -170
- data/lib/sdl2_audio.rb +219 -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 +530 -530
- data/lib/sdl2_filesystem.rb +48 -48
- data/lib/sdl2_framerate.rb +67 -67
- data/lib/sdl2_gamecontroller.rb +254 -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_hints.rb +174 -174
- data/lib/sdl2_image.rb +185 -185
- data/lib/sdl2_imageFilter.rb +132 -132
- data/lib/sdl2_joystick.rb +230 -230
- data/lib/sdl2_keyboard.rb +99 -99
- data/lib/sdl2_keycode.rb +304 -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_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 +290 -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_shape.rb +77 -77
- data/lib/sdl2_stdinc.rb +393 -393
- data/lib/sdl2_surface.rb +182 -182
- data/lib/sdl2_syswm.rb +154 -154
- data/lib/sdl2_timer.rb +62 -62
- data/lib/sdl2_touch.rb +73 -73
- data/lib/sdl2_ttf.rb +202 -190
- data/lib/sdl2_version.rb +62 -62
- data/lib/sdl2_video.rb +411 -411
- data/lib/sdl2_vulkan.rb +64 -64
- metadata +6 -6
data/lib/sdl2_surface.rb
CHANGED
@@ -1,182 +1,182 @@
|
|
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
|
-
require_relative 'sdl2_rect'
|
9
|
-
|
10
|
-
module SDL2
|
11
|
-
extend FFI::Library
|
12
|
-
# Define/Macro
|
13
|
-
|
14
|
-
SDL_SWSURFACE = 0
|
15
|
-
SDL_PREALLOC = 0x00000001
|
16
|
-
SDL_RLEACCEL = 0x00000002
|
17
|
-
SDL_DONTFREE = 0x00000004
|
18
|
-
SDL_SIMD_ALIGNED = 0x00000008
|
19
|
-
|
20
|
-
# Enum
|
21
|
-
|
22
|
-
SDL_YUV_CONVERSION_JPEG = 0
|
23
|
-
SDL_YUV_CONVERSION_BT601 = 1
|
24
|
-
SDL_YUV_CONVERSION_BT709 = 2
|
25
|
-
SDL_YUV_CONVERSION_AUTOMATIC = 3
|
26
|
-
|
27
|
-
# Typedef
|
28
|
-
|
29
|
-
callback :SDL_blit, [:pointer, :pointer, :pointer, :pointer], :int
|
30
|
-
typedef :int, :SDL_YUV_CONVERSION_MODE
|
31
|
-
|
32
|
-
# Struct
|
33
|
-
|
34
|
-
class SDL_Surface < FFI::Struct
|
35
|
-
layout(
|
36
|
-
:flags, :uint,
|
37
|
-
:format, :pointer,
|
38
|
-
:w, :int,
|
39
|
-
:h, :int,
|
40
|
-
:pitch, :int,
|
41
|
-
:pixels, :pointer,
|
42
|
-
:userdata, :pointer,
|
43
|
-
:locked, :int,
|
44
|
-
:list_blitmap, :pointer,
|
45
|
-
:clip_rect, SDL_Rect,
|
46
|
-
:map, :pointer,
|
47
|
-
:refcount, :int,
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
# Function
|
53
|
-
|
54
|
-
def self.setup_surface_symbols()
|
55
|
-
symbols = [
|
56
|
-
:SDL_CreateRGBSurface,
|
57
|
-
:SDL_CreateRGBSurfaceWithFormat,
|
58
|
-
:SDL_CreateRGBSurfaceFrom,
|
59
|
-
:SDL_CreateRGBSurfaceWithFormatFrom,
|
60
|
-
:SDL_FreeSurface,
|
61
|
-
:SDL_SetSurfacePalette,
|
62
|
-
:SDL_LockSurface,
|
63
|
-
:SDL_UnlockSurface,
|
64
|
-
:SDL_LoadBMP_RW,
|
65
|
-
:SDL_SaveBMP_RW,
|
66
|
-
:SDL_SetSurfaceRLE,
|
67
|
-
:SDL_HasSurfaceRLE,
|
68
|
-
:SDL_SetColorKey,
|
69
|
-
:SDL_HasColorKey,
|
70
|
-
:SDL_GetColorKey,
|
71
|
-
:SDL_SetSurfaceColorMod,
|
72
|
-
:SDL_GetSurfaceColorMod,
|
73
|
-
:SDL_SetSurfaceAlphaMod,
|
74
|
-
:SDL_GetSurfaceAlphaMod,
|
75
|
-
:SDL_SetSurfaceBlendMode,
|
76
|
-
:SDL_GetSurfaceBlendMode,
|
77
|
-
:SDL_SetClipRect,
|
78
|
-
:SDL_GetClipRect,
|
79
|
-
:SDL_DuplicateSurface,
|
80
|
-
:SDL_ConvertSurface,
|
81
|
-
:SDL_ConvertSurfaceFormat,
|
82
|
-
:SDL_ConvertPixels,
|
83
|
-
:SDL_FillRect,
|
84
|
-
:SDL_FillRects,
|
85
|
-
:SDL_UpperBlit,
|
86
|
-
:SDL_LowerBlit,
|
87
|
-
:SDL_SoftStretch,
|
88
|
-
:SDL_UpperBlitScaled,
|
89
|
-
:SDL_LowerBlitScaled,
|
90
|
-
:SDL_SetYUVConversionMode,
|
91
|
-
:SDL_GetYUVConversionMode,
|
92
|
-
:SDL_GetYUVConversionModeForResolution,
|
93
|
-
]
|
94
|
-
args = {
|
95
|
-
:SDL_CreateRGBSurface => [:uint, :int, :int, :int, :uint, :uint, :uint, :uint],
|
96
|
-
:SDL_CreateRGBSurfaceWithFormat => [:uint, :int, :int, :int, :uint],
|
97
|
-
:SDL_CreateRGBSurfaceFrom => [:pointer, :int, :int, :int, :int, :uint, :uint, :uint, :uint],
|
98
|
-
:SDL_CreateRGBSurfaceWithFormatFrom => [:pointer, :int, :int, :int, :int, :uint],
|
99
|
-
:SDL_FreeSurface => [:pointer],
|
100
|
-
:SDL_SetSurfacePalette => [:pointer, :pointer],
|
101
|
-
:SDL_LockSurface => [:pointer],
|
102
|
-
:SDL_UnlockSurface => [:pointer],
|
103
|
-
:SDL_LoadBMP_RW => [:pointer, :int],
|
104
|
-
:SDL_SaveBMP_RW => [:pointer, :pointer, :int],
|
105
|
-
:SDL_SetSurfaceRLE => [:pointer, :int],
|
106
|
-
:SDL_HasSurfaceRLE => [:pointer],
|
107
|
-
:SDL_SetColorKey => [:pointer, :int, :uint],
|
108
|
-
:SDL_HasColorKey => [:pointer],
|
109
|
-
:SDL_GetColorKey => [:pointer, :pointer],
|
110
|
-
:SDL_SetSurfaceColorMod => [:pointer, :uchar, :uchar, :uchar],
|
111
|
-
:SDL_GetSurfaceColorMod => [:pointer, :pointer, :pointer, :pointer],
|
112
|
-
:SDL_SetSurfaceAlphaMod => [:pointer, :uchar],
|
113
|
-
:SDL_GetSurfaceAlphaMod => [:pointer, :pointer],
|
114
|
-
:SDL_SetSurfaceBlendMode => [:pointer, :int],
|
115
|
-
:SDL_GetSurfaceBlendMode => [:pointer, :pointer],
|
116
|
-
:SDL_SetClipRect => [:pointer, :pointer],
|
117
|
-
:SDL_GetClipRect => [:pointer, :pointer],
|
118
|
-
:SDL_DuplicateSurface => [:pointer],
|
119
|
-
:SDL_ConvertSurface => [:pointer, :pointer, :uint],
|
120
|
-
:SDL_ConvertSurfaceFormat => [:pointer, :uint, :uint],
|
121
|
-
:SDL_ConvertPixels => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
|
122
|
-
:SDL_FillRect => [:pointer, :pointer, :uint],
|
123
|
-
:SDL_FillRects => [:pointer, :pointer, :int, :uint],
|
124
|
-
:SDL_UpperBlit => [:pointer, :pointer, :pointer, :pointer],
|
125
|
-
:SDL_LowerBlit => [:pointer, :pointer, :pointer, :pointer],
|
126
|
-
:SDL_SoftStretch => [:pointer, :pointer, :pointer, :pointer],
|
127
|
-
:SDL_UpperBlitScaled => [:pointer, :pointer, :pointer, :pointer],
|
128
|
-
:SDL_LowerBlitScaled => [:pointer, :pointer, :pointer, :pointer],
|
129
|
-
:SDL_SetYUVConversionMode => [:int],
|
130
|
-
:SDL_GetYUVConversionMode => [],
|
131
|
-
:SDL_GetYUVConversionModeForResolution => [:int, :int],
|
132
|
-
}
|
133
|
-
retvals = {
|
134
|
-
:SDL_CreateRGBSurface => :pointer,
|
135
|
-
:SDL_CreateRGBSurfaceWithFormat => :pointer,
|
136
|
-
:SDL_CreateRGBSurfaceFrom => :pointer,
|
137
|
-
:SDL_CreateRGBSurfaceWithFormatFrom => :pointer,
|
138
|
-
:SDL_FreeSurface => :void,
|
139
|
-
:SDL_SetSurfacePalette => :int,
|
140
|
-
:SDL_LockSurface => :int,
|
141
|
-
:SDL_UnlockSurface => :void,
|
142
|
-
:SDL_LoadBMP_RW => :pointer,
|
143
|
-
:SDL_SaveBMP_RW => :int,
|
144
|
-
:SDL_SetSurfaceRLE => :int,
|
145
|
-
:SDL_HasSurfaceRLE => :int,
|
146
|
-
:SDL_SetColorKey => :int,
|
147
|
-
:SDL_HasColorKey => :int,
|
148
|
-
:SDL_GetColorKey => :int,
|
149
|
-
:SDL_SetSurfaceColorMod => :int,
|
150
|
-
:SDL_GetSurfaceColorMod => :int,
|
151
|
-
:SDL_SetSurfaceAlphaMod => :int,
|
152
|
-
:SDL_GetSurfaceAlphaMod => :int,
|
153
|
-
:SDL_SetSurfaceBlendMode => :int,
|
154
|
-
:SDL_GetSurfaceBlendMode => :int,
|
155
|
-
:SDL_SetClipRect => :int,
|
156
|
-
:SDL_GetClipRect => :void,
|
157
|
-
:SDL_DuplicateSurface => :pointer,
|
158
|
-
:SDL_ConvertSurface => :pointer,
|
159
|
-
:SDL_ConvertSurfaceFormat => :pointer,
|
160
|
-
:SDL_ConvertPixels => :int,
|
161
|
-
:SDL_FillRect => :int,
|
162
|
-
:SDL_FillRects => :int,
|
163
|
-
:SDL_UpperBlit => :int,
|
164
|
-
:SDL_LowerBlit => :int,
|
165
|
-
:SDL_SoftStretch => :int,
|
166
|
-
:SDL_UpperBlitScaled => :int,
|
167
|
-
:SDL_LowerBlitScaled => :int,
|
168
|
-
:SDL_SetYUVConversionMode => :void,
|
169
|
-
:SDL_GetYUVConversionMode => :int,
|
170
|
-
:SDL_GetYUVConversionModeForResolution => :int,
|
171
|
-
}
|
172
|
-
symbols.each do |sym|
|
173
|
-
begin
|
174
|
-
attach_function sym, args[sym], retvals[sym]
|
175
|
-
rescue FFI::NotFoundError => error
|
176
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
end
|
182
|
-
|
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
|
+
require_relative 'sdl2_rect'
|
9
|
+
|
10
|
+
module SDL2
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
SDL_SWSURFACE = 0
|
15
|
+
SDL_PREALLOC = 0x00000001
|
16
|
+
SDL_RLEACCEL = 0x00000002
|
17
|
+
SDL_DONTFREE = 0x00000004
|
18
|
+
SDL_SIMD_ALIGNED = 0x00000008
|
19
|
+
|
20
|
+
# Enum
|
21
|
+
|
22
|
+
SDL_YUV_CONVERSION_JPEG = 0
|
23
|
+
SDL_YUV_CONVERSION_BT601 = 1
|
24
|
+
SDL_YUV_CONVERSION_BT709 = 2
|
25
|
+
SDL_YUV_CONVERSION_AUTOMATIC = 3
|
26
|
+
|
27
|
+
# Typedef
|
28
|
+
|
29
|
+
callback :SDL_blit, [:pointer, :pointer, :pointer, :pointer], :int
|
30
|
+
typedef :int, :SDL_YUV_CONVERSION_MODE
|
31
|
+
|
32
|
+
# Struct
|
33
|
+
|
34
|
+
class SDL_Surface < FFI::Struct
|
35
|
+
layout(
|
36
|
+
:flags, :uint,
|
37
|
+
:format, :pointer,
|
38
|
+
:w, :int,
|
39
|
+
:h, :int,
|
40
|
+
:pitch, :int,
|
41
|
+
:pixels, :pointer,
|
42
|
+
:userdata, :pointer,
|
43
|
+
:locked, :int,
|
44
|
+
:list_blitmap, :pointer,
|
45
|
+
:clip_rect, SDL_Rect,
|
46
|
+
:map, :pointer,
|
47
|
+
:refcount, :int,
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
# Function
|
53
|
+
|
54
|
+
def self.setup_surface_symbols()
|
55
|
+
symbols = [
|
56
|
+
:SDL_CreateRGBSurface,
|
57
|
+
:SDL_CreateRGBSurfaceWithFormat,
|
58
|
+
:SDL_CreateRGBSurfaceFrom,
|
59
|
+
:SDL_CreateRGBSurfaceWithFormatFrom,
|
60
|
+
:SDL_FreeSurface,
|
61
|
+
:SDL_SetSurfacePalette,
|
62
|
+
:SDL_LockSurface,
|
63
|
+
:SDL_UnlockSurface,
|
64
|
+
:SDL_LoadBMP_RW,
|
65
|
+
:SDL_SaveBMP_RW,
|
66
|
+
:SDL_SetSurfaceRLE,
|
67
|
+
:SDL_HasSurfaceRLE,
|
68
|
+
:SDL_SetColorKey,
|
69
|
+
:SDL_HasColorKey,
|
70
|
+
:SDL_GetColorKey,
|
71
|
+
:SDL_SetSurfaceColorMod,
|
72
|
+
:SDL_GetSurfaceColorMod,
|
73
|
+
:SDL_SetSurfaceAlphaMod,
|
74
|
+
:SDL_GetSurfaceAlphaMod,
|
75
|
+
:SDL_SetSurfaceBlendMode,
|
76
|
+
:SDL_GetSurfaceBlendMode,
|
77
|
+
:SDL_SetClipRect,
|
78
|
+
:SDL_GetClipRect,
|
79
|
+
:SDL_DuplicateSurface,
|
80
|
+
:SDL_ConvertSurface,
|
81
|
+
:SDL_ConvertSurfaceFormat,
|
82
|
+
:SDL_ConvertPixels,
|
83
|
+
:SDL_FillRect,
|
84
|
+
:SDL_FillRects,
|
85
|
+
:SDL_UpperBlit,
|
86
|
+
:SDL_LowerBlit,
|
87
|
+
:SDL_SoftStretch,
|
88
|
+
:SDL_UpperBlitScaled,
|
89
|
+
:SDL_LowerBlitScaled,
|
90
|
+
:SDL_SetYUVConversionMode,
|
91
|
+
:SDL_GetYUVConversionMode,
|
92
|
+
:SDL_GetYUVConversionModeForResolution,
|
93
|
+
]
|
94
|
+
args = {
|
95
|
+
:SDL_CreateRGBSurface => [:uint, :int, :int, :int, :uint, :uint, :uint, :uint],
|
96
|
+
:SDL_CreateRGBSurfaceWithFormat => [:uint, :int, :int, :int, :uint],
|
97
|
+
:SDL_CreateRGBSurfaceFrom => [:pointer, :int, :int, :int, :int, :uint, :uint, :uint, :uint],
|
98
|
+
:SDL_CreateRGBSurfaceWithFormatFrom => [:pointer, :int, :int, :int, :int, :uint],
|
99
|
+
:SDL_FreeSurface => [:pointer],
|
100
|
+
:SDL_SetSurfacePalette => [:pointer, :pointer],
|
101
|
+
:SDL_LockSurface => [:pointer],
|
102
|
+
:SDL_UnlockSurface => [:pointer],
|
103
|
+
:SDL_LoadBMP_RW => [:pointer, :int],
|
104
|
+
:SDL_SaveBMP_RW => [:pointer, :pointer, :int],
|
105
|
+
:SDL_SetSurfaceRLE => [:pointer, :int],
|
106
|
+
:SDL_HasSurfaceRLE => [:pointer],
|
107
|
+
:SDL_SetColorKey => [:pointer, :int, :uint],
|
108
|
+
:SDL_HasColorKey => [:pointer],
|
109
|
+
:SDL_GetColorKey => [:pointer, :pointer],
|
110
|
+
:SDL_SetSurfaceColorMod => [:pointer, :uchar, :uchar, :uchar],
|
111
|
+
:SDL_GetSurfaceColorMod => [:pointer, :pointer, :pointer, :pointer],
|
112
|
+
:SDL_SetSurfaceAlphaMod => [:pointer, :uchar],
|
113
|
+
:SDL_GetSurfaceAlphaMod => [:pointer, :pointer],
|
114
|
+
:SDL_SetSurfaceBlendMode => [:pointer, :int],
|
115
|
+
:SDL_GetSurfaceBlendMode => [:pointer, :pointer],
|
116
|
+
:SDL_SetClipRect => [:pointer, :pointer],
|
117
|
+
:SDL_GetClipRect => [:pointer, :pointer],
|
118
|
+
:SDL_DuplicateSurface => [:pointer],
|
119
|
+
:SDL_ConvertSurface => [:pointer, :pointer, :uint],
|
120
|
+
:SDL_ConvertSurfaceFormat => [:pointer, :uint, :uint],
|
121
|
+
:SDL_ConvertPixels => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
|
122
|
+
:SDL_FillRect => [:pointer, :pointer, :uint],
|
123
|
+
:SDL_FillRects => [:pointer, :pointer, :int, :uint],
|
124
|
+
:SDL_UpperBlit => [:pointer, :pointer, :pointer, :pointer],
|
125
|
+
:SDL_LowerBlit => [:pointer, :pointer, :pointer, :pointer],
|
126
|
+
:SDL_SoftStretch => [:pointer, :pointer, :pointer, :pointer],
|
127
|
+
:SDL_UpperBlitScaled => [:pointer, :pointer, :pointer, :pointer],
|
128
|
+
:SDL_LowerBlitScaled => [:pointer, :pointer, :pointer, :pointer],
|
129
|
+
:SDL_SetYUVConversionMode => [:int],
|
130
|
+
:SDL_GetYUVConversionMode => [],
|
131
|
+
:SDL_GetYUVConversionModeForResolution => [:int, :int],
|
132
|
+
}
|
133
|
+
retvals = {
|
134
|
+
:SDL_CreateRGBSurface => :pointer,
|
135
|
+
:SDL_CreateRGBSurfaceWithFormat => :pointer,
|
136
|
+
:SDL_CreateRGBSurfaceFrom => :pointer,
|
137
|
+
:SDL_CreateRGBSurfaceWithFormatFrom => :pointer,
|
138
|
+
:SDL_FreeSurface => :void,
|
139
|
+
:SDL_SetSurfacePalette => :int,
|
140
|
+
:SDL_LockSurface => :int,
|
141
|
+
:SDL_UnlockSurface => :void,
|
142
|
+
:SDL_LoadBMP_RW => :pointer,
|
143
|
+
:SDL_SaveBMP_RW => :int,
|
144
|
+
:SDL_SetSurfaceRLE => :int,
|
145
|
+
:SDL_HasSurfaceRLE => :int,
|
146
|
+
:SDL_SetColorKey => :int,
|
147
|
+
:SDL_HasColorKey => :int,
|
148
|
+
:SDL_GetColorKey => :int,
|
149
|
+
:SDL_SetSurfaceColorMod => :int,
|
150
|
+
:SDL_GetSurfaceColorMod => :int,
|
151
|
+
:SDL_SetSurfaceAlphaMod => :int,
|
152
|
+
:SDL_GetSurfaceAlphaMod => :int,
|
153
|
+
:SDL_SetSurfaceBlendMode => :int,
|
154
|
+
:SDL_GetSurfaceBlendMode => :int,
|
155
|
+
:SDL_SetClipRect => :int,
|
156
|
+
:SDL_GetClipRect => :void,
|
157
|
+
:SDL_DuplicateSurface => :pointer,
|
158
|
+
:SDL_ConvertSurface => :pointer,
|
159
|
+
:SDL_ConvertSurfaceFormat => :pointer,
|
160
|
+
:SDL_ConvertPixels => :int,
|
161
|
+
:SDL_FillRect => :int,
|
162
|
+
:SDL_FillRects => :int,
|
163
|
+
:SDL_UpperBlit => :int,
|
164
|
+
:SDL_LowerBlit => :int,
|
165
|
+
:SDL_SoftStretch => :int,
|
166
|
+
:SDL_UpperBlitScaled => :int,
|
167
|
+
:SDL_LowerBlitScaled => :int,
|
168
|
+
:SDL_SetYUVConversionMode => :void,
|
169
|
+
:SDL_GetYUVConversionMode => :int,
|
170
|
+
:SDL_GetYUVConversionModeForResolution => :int,
|
171
|
+
}
|
172
|
+
symbols.each do |sym|
|
173
|
+
begin
|
174
|
+
attach_function sym, args[sym], retvals[sym]
|
175
|
+
rescue FFI::NotFoundError => error
|
176
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
data/lib/sdl2_syswm.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
|
-
require_relative 'sdl2_version'
|
9
|
-
|
10
|
-
module SDL2
|
11
|
-
extend FFI::Library
|
12
|
-
# Define/Macro
|
13
|
-
|
14
|
-
|
15
|
-
# Enum
|
16
|
-
|
17
|
-
SDL_SYSWM_UNKNOWN = 0
|
18
|
-
SDL_SYSWM_WINDOWS = 1
|
19
|
-
SDL_SYSWM_X11 = 2
|
20
|
-
SDL_SYSWM_DIRECTFB = 3
|
21
|
-
SDL_SYSWM_COCOA = 4
|
22
|
-
SDL_SYSWM_UIKIT = 5
|
23
|
-
SDL_SYSWM_WAYLAND = 6
|
24
|
-
SDL_SYSWM_MIR = 7
|
25
|
-
SDL_SYSWM_WINRT = 8
|
26
|
-
SDL_SYSWM_ANDROID = 9
|
27
|
-
SDL_SYSWM_VIVANTE = 10
|
28
|
-
SDL_SYSWM_OS2 = 11
|
29
|
-
SDL_SYSWM_HAIKU = 12
|
30
|
-
|
31
|
-
# Typedef
|
32
|
-
|
33
|
-
typedef :int, :SDL_SYSWM_TYPE
|
34
|
-
|
35
|
-
class SDL_SysWMmsg_def_win < FFI::Struct
|
36
|
-
layout(
|
37
|
-
:hwnd, :pointer,
|
38
|
-
:msg, :uint32,
|
39
|
-
:wParam, :uint64,
|
40
|
-
:lParam, :int64
|
41
|
-
)
|
42
|
-
end
|
43
|
-
|
44
|
-
class SDL_SysWMmsg_value_win < FFI::Union
|
45
|
-
layout(
|
46
|
-
:win, SDL_SysWMmsg_def_win.by_value,
|
47
|
-
:dummy, :int
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
class SDL_SysWMmsg_win < FFI::Struct
|
52
|
-
layout(
|
53
|
-
:version, SDL_version.by_value,
|
54
|
-
:subsystem, :int,
|
55
|
-
:msg, SDL_SysWMmsg_value_win.by_value
|
56
|
-
)
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
class SDL_SysWMmsg_def_cocoa < FFI::Struct
|
61
|
-
layout(
|
62
|
-
:dummy, :int
|
63
|
-
)
|
64
|
-
end
|
65
|
-
|
66
|
-
class SDL_SysWMmsg_value_cocoa < FFI::Union
|
67
|
-
layout(
|
68
|
-
:cocoa, SDL_SysWMmsg_def_cocoa.by_value,
|
69
|
-
:dummy, :int
|
70
|
-
)
|
71
|
-
end
|
72
|
-
|
73
|
-
class SDL_SysWMmsg_cocoa < FFI::Struct
|
74
|
-
layout(
|
75
|
-
:version, SDL_version.by_value,
|
76
|
-
:subsystem, :int,
|
77
|
-
:msg, SDL_SysWMmsg_value_cocoa.by_value
|
78
|
-
)
|
79
|
-
end
|
80
|
-
|
81
|
-
################################################################################
|
82
|
-
|
83
|
-
class SDL_SysWMinfo_def_win < FFI::Struct
|
84
|
-
layout(
|
85
|
-
:window, :pointer,
|
86
|
-
:hdc, :pointer,
|
87
|
-
:hinstance, :pointer
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
|
-
class SDL_SysWMinfo_value_win < FFI::Union
|
92
|
-
layout(
|
93
|
-
:win, SDL_SysWMinfo_def_win.by_value,
|
94
|
-
:dummy, [:uint8, 64]
|
95
|
-
)
|
96
|
-
end
|
97
|
-
|
98
|
-
class SDL_SysWMinfo_win < FFI::Struct
|
99
|
-
layout(
|
100
|
-
:version, SDL_version.by_value,
|
101
|
-
:subsystem, :int,
|
102
|
-
:info, SDL_SysWMinfo_value_win.by_value
|
103
|
-
)
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
|
-
class SDL_SysWMinfo_def_cocoa < FFI::Struct
|
108
|
-
layout(
|
109
|
-
:window, :pointer
|
110
|
-
)
|
111
|
-
end
|
112
|
-
|
113
|
-
class SDL_SysWMinfo_value_cocoa < FFI::Union
|
114
|
-
layout(
|
115
|
-
:cocoa, SDL_SysWMinfo_def_cocoa.by_value,
|
116
|
-
:dummy, [:uint8, 64]
|
117
|
-
)
|
118
|
-
end
|
119
|
-
|
120
|
-
class SDL_SysWMinfo_cocoa < FFI::Struct
|
121
|
-
layout(
|
122
|
-
:version, SDL_version.by_value,
|
123
|
-
:subsystem, :int,
|
124
|
-
:info, SDL_SysWMinfo_value_cocoa.by_value
|
125
|
-
)
|
126
|
-
end
|
127
|
-
|
128
|
-
|
129
|
-
# Struct
|
130
|
-
|
131
|
-
|
132
|
-
# Function
|
133
|
-
|
134
|
-
def self.setup_syswm_symbols()
|
135
|
-
symbols = [
|
136
|
-
:SDL_GetWindowWMInfo,
|
137
|
-
]
|
138
|
-
args = {
|
139
|
-
:SDL_GetWindowWMInfo => [:pointer, :pointer],
|
140
|
-
}
|
141
|
-
retvals = {
|
142
|
-
:SDL_GetWindowWMInfo => :int,
|
143
|
-
}
|
144
|
-
symbols.each do |sym|
|
145
|
-
begin
|
146
|
-
attach_function sym, args[sym], retvals[sym]
|
147
|
-
rescue FFI::NotFoundError => error
|
148
|
-
$stderr.puts("[Warning] Failed to import #{sym} (#{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
|
+
require_relative 'sdl2_version'
|
9
|
+
|
10
|
+
module SDL2
|
11
|
+
extend FFI::Library
|
12
|
+
# Define/Macro
|
13
|
+
|
14
|
+
|
15
|
+
# Enum
|
16
|
+
|
17
|
+
SDL_SYSWM_UNKNOWN = 0
|
18
|
+
SDL_SYSWM_WINDOWS = 1
|
19
|
+
SDL_SYSWM_X11 = 2
|
20
|
+
SDL_SYSWM_DIRECTFB = 3
|
21
|
+
SDL_SYSWM_COCOA = 4
|
22
|
+
SDL_SYSWM_UIKIT = 5
|
23
|
+
SDL_SYSWM_WAYLAND = 6
|
24
|
+
SDL_SYSWM_MIR = 7
|
25
|
+
SDL_SYSWM_WINRT = 8
|
26
|
+
SDL_SYSWM_ANDROID = 9
|
27
|
+
SDL_SYSWM_VIVANTE = 10
|
28
|
+
SDL_SYSWM_OS2 = 11
|
29
|
+
SDL_SYSWM_HAIKU = 12
|
30
|
+
|
31
|
+
# Typedef
|
32
|
+
|
33
|
+
typedef :int, :SDL_SYSWM_TYPE
|
34
|
+
|
35
|
+
class SDL_SysWMmsg_def_win < FFI::Struct
|
36
|
+
layout(
|
37
|
+
:hwnd, :pointer,
|
38
|
+
:msg, :uint32,
|
39
|
+
:wParam, :uint64,
|
40
|
+
:lParam, :int64
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
class SDL_SysWMmsg_value_win < FFI::Union
|
45
|
+
layout(
|
46
|
+
:win, SDL_SysWMmsg_def_win.by_value,
|
47
|
+
:dummy, :int
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
class SDL_SysWMmsg_win < FFI::Struct
|
52
|
+
layout(
|
53
|
+
:version, SDL_version.by_value,
|
54
|
+
:subsystem, :int,
|
55
|
+
:msg, SDL_SysWMmsg_value_win.by_value
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
class SDL_SysWMmsg_def_cocoa < FFI::Struct
|
61
|
+
layout(
|
62
|
+
:dummy, :int
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
class SDL_SysWMmsg_value_cocoa < FFI::Union
|
67
|
+
layout(
|
68
|
+
:cocoa, SDL_SysWMmsg_def_cocoa.by_value,
|
69
|
+
:dummy, :int
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
class SDL_SysWMmsg_cocoa < FFI::Struct
|
74
|
+
layout(
|
75
|
+
:version, SDL_version.by_value,
|
76
|
+
:subsystem, :int,
|
77
|
+
:msg, SDL_SysWMmsg_value_cocoa.by_value
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
################################################################################
|
82
|
+
|
83
|
+
class SDL_SysWMinfo_def_win < FFI::Struct
|
84
|
+
layout(
|
85
|
+
:window, :pointer,
|
86
|
+
:hdc, :pointer,
|
87
|
+
:hinstance, :pointer
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
class SDL_SysWMinfo_value_win < FFI::Union
|
92
|
+
layout(
|
93
|
+
:win, SDL_SysWMinfo_def_win.by_value,
|
94
|
+
:dummy, [:uint8, 64]
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
class SDL_SysWMinfo_win < FFI::Struct
|
99
|
+
layout(
|
100
|
+
:version, SDL_version.by_value,
|
101
|
+
:subsystem, :int,
|
102
|
+
:info, SDL_SysWMinfo_value_win.by_value
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
class SDL_SysWMinfo_def_cocoa < FFI::Struct
|
108
|
+
layout(
|
109
|
+
:window, :pointer
|
110
|
+
)
|
111
|
+
end
|
112
|
+
|
113
|
+
class SDL_SysWMinfo_value_cocoa < FFI::Union
|
114
|
+
layout(
|
115
|
+
:cocoa, SDL_SysWMinfo_def_cocoa.by_value,
|
116
|
+
:dummy, [:uint8, 64]
|
117
|
+
)
|
118
|
+
end
|
119
|
+
|
120
|
+
class SDL_SysWMinfo_cocoa < FFI::Struct
|
121
|
+
layout(
|
122
|
+
:version, SDL_version.by_value,
|
123
|
+
:subsystem, :int,
|
124
|
+
:info, SDL_SysWMinfo_value_cocoa.by_value
|
125
|
+
)
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
# Struct
|
130
|
+
|
131
|
+
|
132
|
+
# Function
|
133
|
+
|
134
|
+
def self.setup_syswm_symbols()
|
135
|
+
symbols = [
|
136
|
+
:SDL_GetWindowWMInfo,
|
137
|
+
]
|
138
|
+
args = {
|
139
|
+
:SDL_GetWindowWMInfo => [:pointer, :pointer],
|
140
|
+
}
|
141
|
+
retvals = {
|
142
|
+
:SDL_GetWindowWMInfo => :int,
|
143
|
+
}
|
144
|
+
symbols.each do |sym|
|
145
|
+
begin
|
146
|
+
attach_function sym, args[sym], retvals[sym]
|
147
|
+
rescue FFI::NotFoundError => error
|
148
|
+
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|