sdl2-bindings 0.0.4 → 0.0.5

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +79 -69
  3. data/LICENSE.txt +0 -0
  4. data/README.md +49 -47
  5. data/lib/sdl2.rb +170 -170
  6. data/lib/sdl2_audio.rb +201 -200
  7. data/lib/sdl2_blendmode.rb +69 -69
  8. data/lib/sdl2_clipboard.rb +51 -51
  9. data/lib/sdl2_cpuinfo.rb +106 -103
  10. data/lib/sdl2_error.rb +64 -61
  11. data/lib/sdl2_events.rb +530 -500
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +254 -207
  15. data/lib/sdl2_gesture.rb +55 -55
  16. data/lib/sdl2_gfxPrimitives.rb +222 -222
  17. data/lib/sdl2_haptic.rb +269 -268
  18. data/lib/sdl2_hints.rb +174 -159
  19. data/lib/sdl2_image.rb +185 -185
  20. data/lib/sdl2_imageFilter.rb +132 -132
  21. data/lib/sdl2_joystick.rb +230 -199
  22. data/lib/sdl2_keyboard.rb +99 -99
  23. data/lib/sdl2_keycode.rb +304 -300
  24. data/lib/sdl2_log.rb +115 -115
  25. data/lib/sdl2_main.rb +67 -67
  26. data/lib/sdl2_messagebox.rb +98 -98
  27. data/lib/sdl2_mixer.rb +307 -307
  28. data/lib/sdl2_mouse.rb +117 -117
  29. data/lib/sdl2_pixels.rb +224 -218
  30. data/lib/sdl2_platform.rb +45 -45
  31. data/lib/sdl2_power.rb +51 -51
  32. data/lib/sdl2_rect.rb +102 -102
  33. data/lib/sdl2_render.rb +290 -290
  34. data/lib/sdl2_rotozoom.rb +66 -66
  35. data/lib/sdl2_rwops.rb +208 -208
  36. data/lib/sdl2_scancode.rb +287 -287
  37. data/lib/sdl2_shape.rb +77 -77
  38. data/lib/sdl2_stdinc.rb +393 -370
  39. data/lib/sdl2_surface.rb +182 -179
  40. data/lib/sdl2_syswm.rb +154 -154
  41. data/lib/sdl2_timer.rb +62 -62
  42. data/lib/sdl2_touch.rb +73 -73
  43. data/lib/sdl2_ttf.rb +190 -190
  44. data/lib/sdl2_version.rb +62 -62
  45. data/lib/sdl2_video.rb +411 -407
  46. data/lib/sdl2_vulkan.rb +64 -64
  47. metadata +5 -5
@@ -1,179 +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
- :lock_data, :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_SetColorKey,
68
- :SDL_HasColorKey,
69
- :SDL_GetColorKey,
70
- :SDL_SetSurfaceColorMod,
71
- :SDL_GetSurfaceColorMod,
72
- :SDL_SetSurfaceAlphaMod,
73
- :SDL_GetSurfaceAlphaMod,
74
- :SDL_SetSurfaceBlendMode,
75
- :SDL_GetSurfaceBlendMode,
76
- :SDL_SetClipRect,
77
- :SDL_GetClipRect,
78
- :SDL_DuplicateSurface,
79
- :SDL_ConvertSurface,
80
- :SDL_ConvertSurfaceFormat,
81
- :SDL_ConvertPixels,
82
- :SDL_FillRect,
83
- :SDL_FillRects,
84
- :SDL_UpperBlit,
85
- :SDL_LowerBlit,
86
- :SDL_SoftStretch,
87
- :SDL_UpperBlitScaled,
88
- :SDL_LowerBlitScaled,
89
- :SDL_SetYUVConversionMode,
90
- :SDL_GetYUVConversionMode,
91
- :SDL_GetYUVConversionModeForResolution,
92
- ]
93
- args = {
94
- :SDL_CreateRGBSurface => [:uint, :int, :int, :int, :uint, :uint, :uint, :uint],
95
- :SDL_CreateRGBSurfaceWithFormat => [:uint, :int, :int, :int, :uint],
96
- :SDL_CreateRGBSurfaceFrom => [:pointer, :int, :int, :int, :int, :uint, :uint, :uint, :uint],
97
- :SDL_CreateRGBSurfaceWithFormatFrom => [:pointer, :int, :int, :int, :int, :uint],
98
- :SDL_FreeSurface => [:pointer],
99
- :SDL_SetSurfacePalette => [:pointer, :pointer],
100
- :SDL_LockSurface => [:pointer],
101
- :SDL_UnlockSurface => [:pointer],
102
- :SDL_LoadBMP_RW => [:pointer, :int],
103
- :SDL_SaveBMP_RW => [:pointer, :pointer, :int],
104
- :SDL_SetSurfaceRLE => [:pointer, :int],
105
- :SDL_SetColorKey => [:pointer, :int, :uint],
106
- :SDL_HasColorKey => [:pointer],
107
- :SDL_GetColorKey => [:pointer, :pointer],
108
- :SDL_SetSurfaceColorMod => [:pointer, :uchar, :uchar, :uchar],
109
- :SDL_GetSurfaceColorMod => [:pointer, :pointer, :pointer, :pointer],
110
- :SDL_SetSurfaceAlphaMod => [:pointer, :uchar],
111
- :SDL_GetSurfaceAlphaMod => [:pointer, :pointer],
112
- :SDL_SetSurfaceBlendMode => [:pointer, :int],
113
- :SDL_GetSurfaceBlendMode => [:pointer, :pointer],
114
- :SDL_SetClipRect => [:pointer, :pointer],
115
- :SDL_GetClipRect => [:pointer, :pointer],
116
- :SDL_DuplicateSurface => [:pointer],
117
- :SDL_ConvertSurface => [:pointer, :pointer, :uint],
118
- :SDL_ConvertSurfaceFormat => [:pointer, :uint, :uint],
119
- :SDL_ConvertPixels => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
120
- :SDL_FillRect => [:pointer, :pointer, :uint],
121
- :SDL_FillRects => [:pointer, :pointer, :int, :uint],
122
- :SDL_UpperBlit => [:pointer, :pointer, :pointer, :pointer],
123
- :SDL_LowerBlit => [:pointer, :pointer, :pointer, :pointer],
124
- :SDL_SoftStretch => [:pointer, :pointer, :pointer, :pointer],
125
- :SDL_UpperBlitScaled => [:pointer, :pointer, :pointer, :pointer],
126
- :SDL_LowerBlitScaled => [:pointer, :pointer, :pointer, :pointer],
127
- :SDL_SetYUVConversionMode => [:int],
128
- :SDL_GetYUVConversionMode => [],
129
- :SDL_GetYUVConversionModeForResolution => [:int, :int],
130
- }
131
- retvals = {
132
- :SDL_CreateRGBSurface => :pointer,
133
- :SDL_CreateRGBSurfaceWithFormat => :pointer,
134
- :SDL_CreateRGBSurfaceFrom => :pointer,
135
- :SDL_CreateRGBSurfaceWithFormatFrom => :pointer,
136
- :SDL_FreeSurface => :void,
137
- :SDL_SetSurfacePalette => :int,
138
- :SDL_LockSurface => :int,
139
- :SDL_UnlockSurface => :void,
140
- :SDL_LoadBMP_RW => :pointer,
141
- :SDL_SaveBMP_RW => :int,
142
- :SDL_SetSurfaceRLE => :int,
143
- :SDL_SetColorKey => :int,
144
- :SDL_HasColorKey => :int,
145
- :SDL_GetColorKey => :int,
146
- :SDL_SetSurfaceColorMod => :int,
147
- :SDL_GetSurfaceColorMod => :int,
148
- :SDL_SetSurfaceAlphaMod => :int,
149
- :SDL_GetSurfaceAlphaMod => :int,
150
- :SDL_SetSurfaceBlendMode => :int,
151
- :SDL_GetSurfaceBlendMode => :int,
152
- :SDL_SetClipRect => :int,
153
- :SDL_GetClipRect => :void,
154
- :SDL_DuplicateSurface => :pointer,
155
- :SDL_ConvertSurface => :pointer,
156
- :SDL_ConvertSurfaceFormat => :pointer,
157
- :SDL_ConvertPixels => :int,
158
- :SDL_FillRect => :int,
159
- :SDL_FillRects => :int,
160
- :SDL_UpperBlit => :int,
161
- :SDL_LowerBlit => :int,
162
- :SDL_SoftStretch => :int,
163
- :SDL_UpperBlitScaled => :int,
164
- :SDL_LowerBlitScaled => :int,
165
- :SDL_SetYUVConversionMode => :void,
166
- :SDL_GetYUVConversionMode => :int,
167
- :SDL_GetYUVConversionModeForResolution => :int,
168
- }
169
- symbols.each do |sym|
170
- begin
171
- attach_function sym, args[sym], retvals[sym]
172
- rescue FFI::NotFoundError => error
173
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
174
- end
175
- end
176
- end
177
-
178
- end
179
-
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,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
+