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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +83 -79
  3. data/LICENSE.txt +1 -1
  4. data/README.md +49 -49
  5. data/lib/sdl2.rb +170 -170
  6. data/lib/sdl2_audio.rb +219 -201
  7. data/lib/sdl2_blendmode.rb +69 -69
  8. data/lib/sdl2_clipboard.rb +51 -51
  9. data/lib/sdl2_cpuinfo.rb +106 -106
  10. data/lib/sdl2_error.rb +64 -64
  11. data/lib/sdl2_events.rb +530 -530
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +254 -254
  15. data/lib/sdl2_gesture.rb +55 -55
  16. data/lib/sdl2_gfxPrimitives.rb +222 -222
  17. data/lib/sdl2_haptic.rb +269 -269
  18. data/lib/sdl2_hints.rb +174 -174
  19. data/lib/sdl2_image.rb +185 -185
  20. data/lib/sdl2_imageFilter.rb +132 -132
  21. data/lib/sdl2_joystick.rb +230 -230
  22. data/lib/sdl2_keyboard.rb +99 -99
  23. data/lib/sdl2_keycode.rb +304 -304
  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 +317 -307
  28. data/lib/sdl2_mouse.rb +117 -117
  29. data/lib/sdl2_pixels.rb +224 -224
  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 -393
  39. data/lib/sdl2_surface.rb +182 -182
  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 +202 -190
  44. data/lib/sdl2_version.rb +62 -62
  45. data/lib/sdl2_video.rb +411 -411
  46. data/lib/sdl2_vulkan.rb +64 -64
  47. metadata +6 -6
data/lib/sdl2_platform.rb CHANGED
@@ -1,45 +1,45 @@
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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
-
17
- # Typedef
18
-
19
-
20
- # Struct
21
-
22
-
23
- # Function
24
-
25
- def self.setup_platform_symbols()
26
- symbols = [
27
- :SDL_GetPlatform,
28
- ]
29
- args = {
30
- :SDL_GetPlatform => [],
31
- }
32
- retvals = {
33
- :SDL_GetPlatform => :pointer,
34
- }
35
- symbols.each do |sym|
36
- begin
37
- attach_function sym, args[sym], retvals[sym]
38
- rescue FFI::NotFoundError => error
39
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
40
- end
41
- end
42
- end
43
-
44
- end
45
-
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 SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ # Struct
21
+
22
+
23
+ # Function
24
+
25
+ def self.setup_platform_symbols()
26
+ symbols = [
27
+ :SDL_GetPlatform,
28
+ ]
29
+ args = {
30
+ :SDL_GetPlatform => [],
31
+ }
32
+ retvals = {
33
+ :SDL_GetPlatform => :pointer,
34
+ }
35
+ symbols.each do |sym|
36
+ begin
37
+ attach_function sym, args[sym], retvals[sym]
38
+ rescue FFI::NotFoundError => error
39
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
40
+ end
41
+ end
42
+ end
43
+
44
+ end
45
+
data/lib/sdl2_power.rb CHANGED
@@ -1,51 +1,51 @@
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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
- SDL_POWERSTATE_UNKNOWN = 0
17
- SDL_POWERSTATE_ON_BATTERY = 1
18
- SDL_POWERSTATE_NO_BATTERY = 2
19
- SDL_POWERSTATE_CHARGING = 3
20
- SDL_POWERSTATE_CHARGED = 4
21
-
22
- # Typedef
23
-
24
- typedef :int, :SDL_PowerState
25
-
26
- # Struct
27
-
28
-
29
- # Function
30
-
31
- def self.setup_power_symbols()
32
- symbols = [
33
- :SDL_GetPowerInfo,
34
- ]
35
- args = {
36
- :SDL_GetPowerInfo => [:pointer, :pointer],
37
- }
38
- retvals = {
39
- :SDL_GetPowerInfo => :int,
40
- }
41
- symbols.each do |sym|
42
- begin
43
- attach_function sym, args[sym], retvals[sym]
44
- rescue FFI::NotFoundError => error
45
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
46
- end
47
- end
48
- end
49
-
50
- end
51
-
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 SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ SDL_POWERSTATE_UNKNOWN = 0
17
+ SDL_POWERSTATE_ON_BATTERY = 1
18
+ SDL_POWERSTATE_NO_BATTERY = 2
19
+ SDL_POWERSTATE_CHARGING = 3
20
+ SDL_POWERSTATE_CHARGED = 4
21
+
22
+ # Typedef
23
+
24
+ typedef :int, :SDL_PowerState
25
+
26
+ # Struct
27
+
28
+
29
+ # Function
30
+
31
+ def self.setup_power_symbols()
32
+ symbols = [
33
+ :SDL_GetPowerInfo,
34
+ ]
35
+ args = {
36
+ :SDL_GetPowerInfo => [:pointer, :pointer],
37
+ }
38
+ retvals = {
39
+ :SDL_GetPowerInfo => :int,
40
+ }
41
+ symbols.each do |sym|
42
+ begin
43
+ attach_function sym, args[sym], retvals[sym]
44
+ rescue FFI::NotFoundError => error
45
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
46
+ end
47
+ end
48
+ end
49
+
50
+ end
51
+
data/lib/sdl2_rect.rb CHANGED
@@ -1,102 +1,102 @@
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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
-
17
- # Typedef
18
-
19
-
20
- def SDL_PointInRect(p, r)
21
- return ( (p.x >= r.x) && (p.x < (r.x + r.w)) && (p.y >= r.y) && (p.y < (r.y + r.h)) ) ? 1 : 0;
22
- end
23
-
24
- def SDL_RectEmpty(r)
25
- return (!r.null? || (r.w <= 0) || (r.h <= 0)) ? 1 : 0
26
- end
27
-
28
- def SDL_RectEquals(a, b)
29
- return (!a.null? && !b.null? && (a.x == b.x) && (a.y == b.y) && (a.w == b.w) && (a.h == b.h)) ? 1 : 0
30
- end
31
-
32
-
33
- # Struct
34
-
35
- class SDL_Point < FFI::Struct
36
- layout(
37
- :x, :int,
38
- :y, :int,
39
- )
40
- end
41
-
42
- class SDL_FPoint < FFI::Struct
43
- layout(
44
- :x, :float,
45
- :y, :float,
46
- )
47
- end
48
-
49
- class SDL_Rect < FFI::Struct
50
- layout(
51
- :x, :int,
52
- :y, :int,
53
- :w, :int,
54
- :h, :int,
55
- )
56
- end
57
-
58
- class SDL_FRect < FFI::Struct
59
- layout(
60
- :x, :float,
61
- :y, :float,
62
- :w, :float,
63
- :h, :float,
64
- )
65
- end
66
-
67
-
68
- # Function
69
-
70
- def self.setup_rect_symbols()
71
- symbols = [
72
- :SDL_HasIntersection,
73
- :SDL_IntersectRect,
74
- :SDL_UnionRect,
75
- :SDL_EnclosePoints,
76
- :SDL_IntersectRectAndLine,
77
- ]
78
- args = {
79
- :SDL_HasIntersection => [:pointer, :pointer],
80
- :SDL_IntersectRect => [:pointer, :pointer, :pointer],
81
- :SDL_UnionRect => [:pointer, :pointer, :pointer],
82
- :SDL_EnclosePoints => [:pointer, :int, :pointer, :pointer],
83
- :SDL_IntersectRectAndLine => [:pointer, :pointer, :pointer, :pointer, :pointer],
84
- }
85
- retvals = {
86
- :SDL_HasIntersection => :int,
87
- :SDL_IntersectRect => :int,
88
- :SDL_UnionRect => :void,
89
- :SDL_EnclosePoints => :int,
90
- :SDL_IntersectRectAndLine => :int,
91
- }
92
- symbols.each do |sym|
93
- begin
94
- attach_function sym, args[sym], retvals[sym]
95
- rescue FFI::NotFoundError => error
96
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
97
- end
98
- end
99
- end
100
-
101
- end
102
-
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 SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+
17
+ # Typedef
18
+
19
+
20
+ def SDL_PointInRect(p, r)
21
+ return ( (p.x >= r.x) && (p.x < (r.x + r.w)) && (p.y >= r.y) && (p.y < (r.y + r.h)) ) ? 1 : 0;
22
+ end
23
+
24
+ def SDL_RectEmpty(r)
25
+ return (!r.null? || (r.w <= 0) || (r.h <= 0)) ? 1 : 0
26
+ end
27
+
28
+ def SDL_RectEquals(a, b)
29
+ return (!a.null? && !b.null? && (a.x == b.x) && (a.y == b.y) && (a.w == b.w) && (a.h == b.h)) ? 1 : 0
30
+ end
31
+
32
+
33
+ # Struct
34
+
35
+ class SDL_Point < FFI::Struct
36
+ layout(
37
+ :x, :int,
38
+ :y, :int,
39
+ )
40
+ end
41
+
42
+ class SDL_FPoint < FFI::Struct
43
+ layout(
44
+ :x, :float,
45
+ :y, :float,
46
+ )
47
+ end
48
+
49
+ class SDL_Rect < FFI::Struct
50
+ layout(
51
+ :x, :int,
52
+ :y, :int,
53
+ :w, :int,
54
+ :h, :int,
55
+ )
56
+ end
57
+
58
+ class SDL_FRect < FFI::Struct
59
+ layout(
60
+ :x, :float,
61
+ :y, :float,
62
+ :w, :float,
63
+ :h, :float,
64
+ )
65
+ end
66
+
67
+
68
+ # Function
69
+
70
+ def self.setup_rect_symbols()
71
+ symbols = [
72
+ :SDL_HasIntersection,
73
+ :SDL_IntersectRect,
74
+ :SDL_UnionRect,
75
+ :SDL_EnclosePoints,
76
+ :SDL_IntersectRectAndLine,
77
+ ]
78
+ args = {
79
+ :SDL_HasIntersection => [:pointer, :pointer],
80
+ :SDL_IntersectRect => [:pointer, :pointer, :pointer],
81
+ :SDL_UnionRect => [:pointer, :pointer, :pointer],
82
+ :SDL_EnclosePoints => [:pointer, :int, :pointer, :pointer],
83
+ :SDL_IntersectRectAndLine => [:pointer, :pointer, :pointer, :pointer, :pointer],
84
+ }
85
+ retvals = {
86
+ :SDL_HasIntersection => :int,
87
+ :SDL_IntersectRect => :int,
88
+ :SDL_UnionRect => :void,
89
+ :SDL_EnclosePoints => :int,
90
+ :SDL_IntersectRectAndLine => :int,
91
+ }
92
+ symbols.each do |sym|
93
+ begin
94
+ attach_function sym, args[sym], retvals[sym]
95
+ rescue FFI::NotFoundError => error
96
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
97
+ end
98
+ end
99
+ end
100
+
101
+ end
102
+
data/lib/sdl2_render.rb CHANGED
@@ -1,290 +1,290 @@
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 SDL2
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
-
14
- # Enum
15
-
16
- SDL_RENDERER_SOFTWARE = 1
17
- SDL_RENDERER_ACCELERATED = 2
18
- SDL_RENDERER_PRESENTVSYNC = 4
19
- SDL_RENDERER_TARGETTEXTURE = 8
20
- SDL_ScaleModeNearest = 0
21
- SDL_ScaleModeLinear = 1
22
- SDL_ScaleModeBest = 2
23
- SDL_TEXTUREACCESS_STATIC = 0
24
- SDL_TEXTUREACCESS_STREAMING = 1
25
- SDL_TEXTUREACCESS_TARGET = 2
26
- SDL_TEXTUREMODULATE_NONE = 0
27
- SDL_TEXTUREMODULATE_COLOR = 1
28
- SDL_TEXTUREMODULATE_ALPHA = 2
29
- SDL_FLIP_NONE = 0
30
- SDL_FLIP_HORIZONTAL = 1
31
- SDL_FLIP_VERTICAL = 2
32
-
33
- # Typedef
34
-
35
- typedef :int, :SDL_RendererFlags
36
- typedef :int, :SDL_ScaleMode
37
- typedef :int, :SDL_TextureAccess
38
- typedef :int, :SDL_TextureModulate
39
- typedef :int, :SDL_RendererFlip
40
-
41
- # Struct
42
-
43
- class SDL_RendererInfo < FFI::Struct
44
- layout(
45
- :name, :pointer,
46
- :flags, :uint,
47
- :num_texture_formats, :uint,
48
- :texture_formats, [:uint, 16],
49
- :max_texture_width, :int,
50
- :max_texture_height, :int,
51
- )
52
- end
53
-
54
-
55
- # Function
56
-
57
- def self.setup_render_symbols()
58
- symbols = [
59
- :SDL_GetNumRenderDrivers,
60
- :SDL_GetRenderDriverInfo,
61
- :SDL_CreateWindowAndRenderer,
62
- :SDL_CreateRenderer,
63
- :SDL_CreateSoftwareRenderer,
64
- :SDL_GetRenderer,
65
- :SDL_GetRendererInfo,
66
- :SDL_GetRendererOutputSize,
67
- :SDL_CreateTexture,
68
- :SDL_CreateTextureFromSurface,
69
- :SDL_QueryTexture,
70
- :SDL_SetTextureColorMod,
71
- :SDL_GetTextureColorMod,
72
- :SDL_SetTextureAlphaMod,
73
- :SDL_GetTextureAlphaMod,
74
- :SDL_SetTextureBlendMode,
75
- :SDL_GetTextureBlendMode,
76
- :SDL_SetTextureScaleMode,
77
- :SDL_GetTextureScaleMode,
78
- :SDL_UpdateTexture,
79
- :SDL_UpdateYUVTexture,
80
- :SDL_LockTexture,
81
- :SDL_LockTextureToSurface,
82
- :SDL_UnlockTexture,
83
- :SDL_RenderTargetSupported,
84
- :SDL_SetRenderTarget,
85
- :SDL_GetRenderTarget,
86
- :SDL_RenderSetLogicalSize,
87
- :SDL_RenderGetLogicalSize,
88
- :SDL_RenderSetIntegerScale,
89
- :SDL_RenderGetIntegerScale,
90
- :SDL_RenderSetViewport,
91
- :SDL_RenderGetViewport,
92
- :SDL_RenderSetClipRect,
93
- :SDL_RenderGetClipRect,
94
- :SDL_RenderIsClipEnabled,
95
- :SDL_RenderSetScale,
96
- :SDL_RenderGetScale,
97
- :SDL_SetRenderDrawColor,
98
- :SDL_GetRenderDrawColor,
99
- :SDL_SetRenderDrawBlendMode,
100
- :SDL_GetRenderDrawBlendMode,
101
- :SDL_RenderClear,
102
- :SDL_RenderDrawPoint,
103
- :SDL_RenderDrawPoints,
104
- :SDL_RenderDrawLine,
105
- :SDL_RenderDrawLines,
106
- :SDL_RenderDrawRect,
107
- :SDL_RenderDrawRects,
108
- :SDL_RenderFillRect,
109
- :SDL_RenderFillRects,
110
- :SDL_RenderCopy,
111
- :SDL_RenderCopyEx,
112
- :SDL_RenderDrawPointF,
113
- :SDL_RenderDrawPointsF,
114
- :SDL_RenderDrawLineF,
115
- :SDL_RenderDrawLinesF,
116
- :SDL_RenderDrawRectF,
117
- :SDL_RenderDrawRectsF,
118
- :SDL_RenderFillRectF,
119
- :SDL_RenderFillRectsF,
120
- :SDL_RenderCopyF,
121
- :SDL_RenderCopyExF,
122
- :SDL_RenderReadPixels,
123
- :SDL_RenderPresent,
124
- :SDL_DestroyTexture,
125
- :SDL_DestroyRenderer,
126
- :SDL_RenderFlush,
127
- :SDL_GL_BindTexture,
128
- :SDL_GL_UnbindTexture,
129
- :SDL_RenderGetMetalLayer,
130
- :SDL_RenderGetMetalCommandEncoder,
131
- ]
132
- args = {
133
- :SDL_GetNumRenderDrivers => [],
134
- :SDL_GetRenderDriverInfo => [:int, :pointer],
135
- :SDL_CreateWindowAndRenderer => [:int, :int, :uint, :pointer, :pointer],
136
- :SDL_CreateRenderer => [:pointer, :int, :uint],
137
- :SDL_CreateSoftwareRenderer => [:pointer],
138
- :SDL_GetRenderer => [:pointer],
139
- :SDL_GetRendererInfo => [:pointer, :pointer],
140
- :SDL_GetRendererOutputSize => [:pointer, :pointer, :pointer],
141
- :SDL_CreateTexture => [:pointer, :uint, :int, :int, :int],
142
- :SDL_CreateTextureFromSurface => [:pointer, :pointer],
143
- :SDL_QueryTexture => [:pointer, :pointer, :pointer, :pointer, :pointer],
144
- :SDL_SetTextureColorMod => [:pointer, :uchar, :uchar, :uchar],
145
- :SDL_GetTextureColorMod => [:pointer, :pointer, :pointer, :pointer],
146
- :SDL_SetTextureAlphaMod => [:pointer, :uchar],
147
- :SDL_GetTextureAlphaMod => [:pointer, :pointer],
148
- :SDL_SetTextureBlendMode => [:pointer, :int],
149
- :SDL_GetTextureBlendMode => [:pointer, :pointer],
150
- :SDL_SetTextureScaleMode => [:pointer, :int],
151
- :SDL_GetTextureScaleMode => [:pointer, :pointer],
152
- :SDL_UpdateTexture => [:pointer, :pointer, :pointer, :int],
153
- :SDL_UpdateYUVTexture => [:pointer, :pointer, :pointer, :int, :pointer, :int, :pointer, :int],
154
- :SDL_LockTexture => [:pointer, :pointer, :pointer, :pointer],
155
- :SDL_LockTextureToSurface => [:pointer, :pointer, :pointer],
156
- :SDL_UnlockTexture => [:pointer],
157
- :SDL_RenderTargetSupported => [:pointer],
158
- :SDL_SetRenderTarget => [:pointer, :pointer],
159
- :SDL_GetRenderTarget => [:pointer],
160
- :SDL_RenderSetLogicalSize => [:pointer, :int, :int],
161
- :SDL_RenderGetLogicalSize => [:pointer, :pointer, :pointer],
162
- :SDL_RenderSetIntegerScale => [:pointer, :int],
163
- :SDL_RenderGetIntegerScale => [:pointer],
164
- :SDL_RenderSetViewport => [:pointer, :pointer],
165
- :SDL_RenderGetViewport => [:pointer, :pointer],
166
- :SDL_RenderSetClipRect => [:pointer, :pointer],
167
- :SDL_RenderGetClipRect => [:pointer, :pointer],
168
- :SDL_RenderIsClipEnabled => [:pointer],
169
- :SDL_RenderSetScale => [:pointer, :float, :float],
170
- :SDL_RenderGetScale => [:pointer, :pointer, :pointer],
171
- :SDL_SetRenderDrawColor => [:pointer, :uchar, :uchar, :uchar, :uchar],
172
- :SDL_GetRenderDrawColor => [:pointer, :pointer, :pointer, :pointer, :pointer],
173
- :SDL_SetRenderDrawBlendMode => [:pointer, :int],
174
- :SDL_GetRenderDrawBlendMode => [:pointer, :pointer],
175
- :SDL_RenderClear => [:pointer],
176
- :SDL_RenderDrawPoint => [:pointer, :int, :int],
177
- :SDL_RenderDrawPoints => [:pointer, :pointer, :int],
178
- :SDL_RenderDrawLine => [:pointer, :int, :int, :int, :int],
179
- :SDL_RenderDrawLines => [:pointer, :pointer, :int],
180
- :SDL_RenderDrawRect => [:pointer, :pointer],
181
- :SDL_RenderDrawRects => [:pointer, :pointer, :int],
182
- :SDL_RenderFillRect => [:pointer, :pointer],
183
- :SDL_RenderFillRects => [:pointer, :pointer, :int],
184
- :SDL_RenderCopy => [:pointer, :pointer, :pointer, :pointer],
185
- :SDL_RenderCopyEx => [:pointer, :pointer, :pointer, :pointer, :double, :pointer, :int],
186
- :SDL_RenderDrawPointF => [:pointer, :float, :float],
187
- :SDL_RenderDrawPointsF => [:pointer, :pointer, :int],
188
- :SDL_RenderDrawLineF => [:pointer, :float, :float, :float, :float],
189
- :SDL_RenderDrawLinesF => [:pointer, :pointer, :int],
190
- :SDL_RenderDrawRectF => [:pointer, :pointer],
191
- :SDL_RenderDrawRectsF => [:pointer, :pointer, :int],
192
- :SDL_RenderFillRectF => [:pointer, :pointer],
193
- :SDL_RenderFillRectsF => [:pointer, :pointer, :int],
194
- :SDL_RenderCopyF => [:pointer, :pointer, :pointer, :pointer],
195
- :SDL_RenderCopyExF => [:pointer, :pointer, :pointer, :pointer, :double, :pointer, :int],
196
- :SDL_RenderReadPixels => [:pointer, :pointer, :uint, :pointer, :int],
197
- :SDL_RenderPresent => [:pointer],
198
- :SDL_DestroyTexture => [:pointer],
199
- :SDL_DestroyRenderer => [:pointer],
200
- :SDL_RenderFlush => [:pointer],
201
- :SDL_GL_BindTexture => [:pointer, :pointer, :pointer],
202
- :SDL_GL_UnbindTexture => [:pointer],
203
- :SDL_RenderGetMetalLayer => [:pointer],
204
- :SDL_RenderGetMetalCommandEncoder => [:pointer],
205
- }
206
- retvals = {
207
- :SDL_GetNumRenderDrivers => :int,
208
- :SDL_GetRenderDriverInfo => :int,
209
- :SDL_CreateWindowAndRenderer => :int,
210
- :SDL_CreateRenderer => :pointer,
211
- :SDL_CreateSoftwareRenderer => :pointer,
212
- :SDL_GetRenderer => :pointer,
213
- :SDL_GetRendererInfo => :int,
214
- :SDL_GetRendererOutputSize => :int,
215
- :SDL_CreateTexture => :pointer,
216
- :SDL_CreateTextureFromSurface => :pointer,
217
- :SDL_QueryTexture => :int,
218
- :SDL_SetTextureColorMod => :int,
219
- :SDL_GetTextureColorMod => :int,
220
- :SDL_SetTextureAlphaMod => :int,
221
- :SDL_GetTextureAlphaMod => :int,
222
- :SDL_SetTextureBlendMode => :int,
223
- :SDL_GetTextureBlendMode => :int,
224
- :SDL_SetTextureScaleMode => :int,
225
- :SDL_GetTextureScaleMode => :int,
226
- :SDL_UpdateTexture => :int,
227
- :SDL_UpdateYUVTexture => :int,
228
- :SDL_LockTexture => :int,
229
- :SDL_LockTextureToSurface => :int,
230
- :SDL_UnlockTexture => :void,
231
- :SDL_RenderTargetSupported => :int,
232
- :SDL_SetRenderTarget => :int,
233
- :SDL_GetRenderTarget => :pointer,
234
- :SDL_RenderSetLogicalSize => :int,
235
- :SDL_RenderGetLogicalSize => :void,
236
- :SDL_RenderSetIntegerScale => :int,
237
- :SDL_RenderGetIntegerScale => :int,
238
- :SDL_RenderSetViewport => :int,
239
- :SDL_RenderGetViewport => :void,
240
- :SDL_RenderSetClipRect => :int,
241
- :SDL_RenderGetClipRect => :void,
242
- :SDL_RenderIsClipEnabled => :int,
243
- :SDL_RenderSetScale => :int,
244
- :SDL_RenderGetScale => :void,
245
- :SDL_SetRenderDrawColor => :int,
246
- :SDL_GetRenderDrawColor => :int,
247
- :SDL_SetRenderDrawBlendMode => :int,
248
- :SDL_GetRenderDrawBlendMode => :int,
249
- :SDL_RenderClear => :int,
250
- :SDL_RenderDrawPoint => :int,
251
- :SDL_RenderDrawPoints => :int,
252
- :SDL_RenderDrawLine => :int,
253
- :SDL_RenderDrawLines => :int,
254
- :SDL_RenderDrawRect => :int,
255
- :SDL_RenderDrawRects => :int,
256
- :SDL_RenderFillRect => :int,
257
- :SDL_RenderFillRects => :int,
258
- :SDL_RenderCopy => :int,
259
- :SDL_RenderCopyEx => :int,
260
- :SDL_RenderDrawPointF => :int,
261
- :SDL_RenderDrawPointsF => :int,
262
- :SDL_RenderDrawLineF => :int,
263
- :SDL_RenderDrawLinesF => :int,
264
- :SDL_RenderDrawRectF => :int,
265
- :SDL_RenderDrawRectsF => :int,
266
- :SDL_RenderFillRectF => :int,
267
- :SDL_RenderFillRectsF => :int,
268
- :SDL_RenderCopyF => :int,
269
- :SDL_RenderCopyExF => :int,
270
- :SDL_RenderReadPixels => :int,
271
- :SDL_RenderPresent => :void,
272
- :SDL_DestroyTexture => :void,
273
- :SDL_DestroyRenderer => :void,
274
- :SDL_RenderFlush => :int,
275
- :SDL_GL_BindTexture => :int,
276
- :SDL_GL_UnbindTexture => :int,
277
- :SDL_RenderGetMetalLayer => :pointer,
278
- :SDL_RenderGetMetalCommandEncoder => :pointer,
279
- }
280
- symbols.each do |sym|
281
- begin
282
- attach_function sym, args[sym], retvals[sym]
283
- rescue FFI::NotFoundError => error
284
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
285
- end
286
- end
287
- end
288
-
289
- end
290
-
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 SDL2
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+
14
+ # Enum
15
+
16
+ SDL_RENDERER_SOFTWARE = 1
17
+ SDL_RENDERER_ACCELERATED = 2
18
+ SDL_RENDERER_PRESENTVSYNC = 4
19
+ SDL_RENDERER_TARGETTEXTURE = 8
20
+ SDL_ScaleModeNearest = 0
21
+ SDL_ScaleModeLinear = 1
22
+ SDL_ScaleModeBest = 2
23
+ SDL_TEXTUREACCESS_STATIC = 0
24
+ SDL_TEXTUREACCESS_STREAMING = 1
25
+ SDL_TEXTUREACCESS_TARGET = 2
26
+ SDL_TEXTUREMODULATE_NONE = 0
27
+ SDL_TEXTUREMODULATE_COLOR = 1
28
+ SDL_TEXTUREMODULATE_ALPHA = 2
29
+ SDL_FLIP_NONE = 0
30
+ SDL_FLIP_HORIZONTAL = 1
31
+ SDL_FLIP_VERTICAL = 2
32
+
33
+ # Typedef
34
+
35
+ typedef :int, :SDL_RendererFlags
36
+ typedef :int, :SDL_ScaleMode
37
+ typedef :int, :SDL_TextureAccess
38
+ typedef :int, :SDL_TextureModulate
39
+ typedef :int, :SDL_RendererFlip
40
+
41
+ # Struct
42
+
43
+ class SDL_RendererInfo < FFI::Struct
44
+ layout(
45
+ :name, :pointer,
46
+ :flags, :uint,
47
+ :num_texture_formats, :uint,
48
+ :texture_formats, [:uint, 16],
49
+ :max_texture_width, :int,
50
+ :max_texture_height, :int,
51
+ )
52
+ end
53
+
54
+
55
+ # Function
56
+
57
+ def self.setup_render_symbols()
58
+ symbols = [
59
+ :SDL_GetNumRenderDrivers,
60
+ :SDL_GetRenderDriverInfo,
61
+ :SDL_CreateWindowAndRenderer,
62
+ :SDL_CreateRenderer,
63
+ :SDL_CreateSoftwareRenderer,
64
+ :SDL_GetRenderer,
65
+ :SDL_GetRendererInfo,
66
+ :SDL_GetRendererOutputSize,
67
+ :SDL_CreateTexture,
68
+ :SDL_CreateTextureFromSurface,
69
+ :SDL_QueryTexture,
70
+ :SDL_SetTextureColorMod,
71
+ :SDL_GetTextureColorMod,
72
+ :SDL_SetTextureAlphaMod,
73
+ :SDL_GetTextureAlphaMod,
74
+ :SDL_SetTextureBlendMode,
75
+ :SDL_GetTextureBlendMode,
76
+ :SDL_SetTextureScaleMode,
77
+ :SDL_GetTextureScaleMode,
78
+ :SDL_UpdateTexture,
79
+ :SDL_UpdateYUVTexture,
80
+ :SDL_LockTexture,
81
+ :SDL_LockTextureToSurface,
82
+ :SDL_UnlockTexture,
83
+ :SDL_RenderTargetSupported,
84
+ :SDL_SetRenderTarget,
85
+ :SDL_GetRenderTarget,
86
+ :SDL_RenderSetLogicalSize,
87
+ :SDL_RenderGetLogicalSize,
88
+ :SDL_RenderSetIntegerScale,
89
+ :SDL_RenderGetIntegerScale,
90
+ :SDL_RenderSetViewport,
91
+ :SDL_RenderGetViewport,
92
+ :SDL_RenderSetClipRect,
93
+ :SDL_RenderGetClipRect,
94
+ :SDL_RenderIsClipEnabled,
95
+ :SDL_RenderSetScale,
96
+ :SDL_RenderGetScale,
97
+ :SDL_SetRenderDrawColor,
98
+ :SDL_GetRenderDrawColor,
99
+ :SDL_SetRenderDrawBlendMode,
100
+ :SDL_GetRenderDrawBlendMode,
101
+ :SDL_RenderClear,
102
+ :SDL_RenderDrawPoint,
103
+ :SDL_RenderDrawPoints,
104
+ :SDL_RenderDrawLine,
105
+ :SDL_RenderDrawLines,
106
+ :SDL_RenderDrawRect,
107
+ :SDL_RenderDrawRects,
108
+ :SDL_RenderFillRect,
109
+ :SDL_RenderFillRects,
110
+ :SDL_RenderCopy,
111
+ :SDL_RenderCopyEx,
112
+ :SDL_RenderDrawPointF,
113
+ :SDL_RenderDrawPointsF,
114
+ :SDL_RenderDrawLineF,
115
+ :SDL_RenderDrawLinesF,
116
+ :SDL_RenderDrawRectF,
117
+ :SDL_RenderDrawRectsF,
118
+ :SDL_RenderFillRectF,
119
+ :SDL_RenderFillRectsF,
120
+ :SDL_RenderCopyF,
121
+ :SDL_RenderCopyExF,
122
+ :SDL_RenderReadPixels,
123
+ :SDL_RenderPresent,
124
+ :SDL_DestroyTexture,
125
+ :SDL_DestroyRenderer,
126
+ :SDL_RenderFlush,
127
+ :SDL_GL_BindTexture,
128
+ :SDL_GL_UnbindTexture,
129
+ :SDL_RenderGetMetalLayer,
130
+ :SDL_RenderGetMetalCommandEncoder,
131
+ ]
132
+ args = {
133
+ :SDL_GetNumRenderDrivers => [],
134
+ :SDL_GetRenderDriverInfo => [:int, :pointer],
135
+ :SDL_CreateWindowAndRenderer => [:int, :int, :uint, :pointer, :pointer],
136
+ :SDL_CreateRenderer => [:pointer, :int, :uint],
137
+ :SDL_CreateSoftwareRenderer => [:pointer],
138
+ :SDL_GetRenderer => [:pointer],
139
+ :SDL_GetRendererInfo => [:pointer, :pointer],
140
+ :SDL_GetRendererOutputSize => [:pointer, :pointer, :pointer],
141
+ :SDL_CreateTexture => [:pointer, :uint, :int, :int, :int],
142
+ :SDL_CreateTextureFromSurface => [:pointer, :pointer],
143
+ :SDL_QueryTexture => [:pointer, :pointer, :pointer, :pointer, :pointer],
144
+ :SDL_SetTextureColorMod => [:pointer, :uchar, :uchar, :uchar],
145
+ :SDL_GetTextureColorMod => [:pointer, :pointer, :pointer, :pointer],
146
+ :SDL_SetTextureAlphaMod => [:pointer, :uchar],
147
+ :SDL_GetTextureAlphaMod => [:pointer, :pointer],
148
+ :SDL_SetTextureBlendMode => [:pointer, :int],
149
+ :SDL_GetTextureBlendMode => [:pointer, :pointer],
150
+ :SDL_SetTextureScaleMode => [:pointer, :int],
151
+ :SDL_GetTextureScaleMode => [:pointer, :pointer],
152
+ :SDL_UpdateTexture => [:pointer, :pointer, :pointer, :int],
153
+ :SDL_UpdateYUVTexture => [:pointer, :pointer, :pointer, :int, :pointer, :int, :pointer, :int],
154
+ :SDL_LockTexture => [:pointer, :pointer, :pointer, :pointer],
155
+ :SDL_LockTextureToSurface => [:pointer, :pointer, :pointer],
156
+ :SDL_UnlockTexture => [:pointer],
157
+ :SDL_RenderTargetSupported => [:pointer],
158
+ :SDL_SetRenderTarget => [:pointer, :pointer],
159
+ :SDL_GetRenderTarget => [:pointer],
160
+ :SDL_RenderSetLogicalSize => [:pointer, :int, :int],
161
+ :SDL_RenderGetLogicalSize => [:pointer, :pointer, :pointer],
162
+ :SDL_RenderSetIntegerScale => [:pointer, :int],
163
+ :SDL_RenderGetIntegerScale => [:pointer],
164
+ :SDL_RenderSetViewport => [:pointer, :pointer],
165
+ :SDL_RenderGetViewport => [:pointer, :pointer],
166
+ :SDL_RenderSetClipRect => [:pointer, :pointer],
167
+ :SDL_RenderGetClipRect => [:pointer, :pointer],
168
+ :SDL_RenderIsClipEnabled => [:pointer],
169
+ :SDL_RenderSetScale => [:pointer, :float, :float],
170
+ :SDL_RenderGetScale => [:pointer, :pointer, :pointer],
171
+ :SDL_SetRenderDrawColor => [:pointer, :uchar, :uchar, :uchar, :uchar],
172
+ :SDL_GetRenderDrawColor => [:pointer, :pointer, :pointer, :pointer, :pointer],
173
+ :SDL_SetRenderDrawBlendMode => [:pointer, :int],
174
+ :SDL_GetRenderDrawBlendMode => [:pointer, :pointer],
175
+ :SDL_RenderClear => [:pointer],
176
+ :SDL_RenderDrawPoint => [:pointer, :int, :int],
177
+ :SDL_RenderDrawPoints => [:pointer, :pointer, :int],
178
+ :SDL_RenderDrawLine => [:pointer, :int, :int, :int, :int],
179
+ :SDL_RenderDrawLines => [:pointer, :pointer, :int],
180
+ :SDL_RenderDrawRect => [:pointer, :pointer],
181
+ :SDL_RenderDrawRects => [:pointer, :pointer, :int],
182
+ :SDL_RenderFillRect => [:pointer, :pointer],
183
+ :SDL_RenderFillRects => [:pointer, :pointer, :int],
184
+ :SDL_RenderCopy => [:pointer, :pointer, :pointer, :pointer],
185
+ :SDL_RenderCopyEx => [:pointer, :pointer, :pointer, :pointer, :double, :pointer, :int],
186
+ :SDL_RenderDrawPointF => [:pointer, :float, :float],
187
+ :SDL_RenderDrawPointsF => [:pointer, :pointer, :int],
188
+ :SDL_RenderDrawLineF => [:pointer, :float, :float, :float, :float],
189
+ :SDL_RenderDrawLinesF => [:pointer, :pointer, :int],
190
+ :SDL_RenderDrawRectF => [:pointer, :pointer],
191
+ :SDL_RenderDrawRectsF => [:pointer, :pointer, :int],
192
+ :SDL_RenderFillRectF => [:pointer, :pointer],
193
+ :SDL_RenderFillRectsF => [:pointer, :pointer, :int],
194
+ :SDL_RenderCopyF => [:pointer, :pointer, :pointer, :pointer],
195
+ :SDL_RenderCopyExF => [:pointer, :pointer, :pointer, :pointer, :double, :pointer, :int],
196
+ :SDL_RenderReadPixels => [:pointer, :pointer, :uint, :pointer, :int],
197
+ :SDL_RenderPresent => [:pointer],
198
+ :SDL_DestroyTexture => [:pointer],
199
+ :SDL_DestroyRenderer => [:pointer],
200
+ :SDL_RenderFlush => [:pointer],
201
+ :SDL_GL_BindTexture => [:pointer, :pointer, :pointer],
202
+ :SDL_GL_UnbindTexture => [:pointer],
203
+ :SDL_RenderGetMetalLayer => [:pointer],
204
+ :SDL_RenderGetMetalCommandEncoder => [:pointer],
205
+ }
206
+ retvals = {
207
+ :SDL_GetNumRenderDrivers => :int,
208
+ :SDL_GetRenderDriverInfo => :int,
209
+ :SDL_CreateWindowAndRenderer => :int,
210
+ :SDL_CreateRenderer => :pointer,
211
+ :SDL_CreateSoftwareRenderer => :pointer,
212
+ :SDL_GetRenderer => :pointer,
213
+ :SDL_GetRendererInfo => :int,
214
+ :SDL_GetRendererOutputSize => :int,
215
+ :SDL_CreateTexture => :pointer,
216
+ :SDL_CreateTextureFromSurface => :pointer,
217
+ :SDL_QueryTexture => :int,
218
+ :SDL_SetTextureColorMod => :int,
219
+ :SDL_GetTextureColorMod => :int,
220
+ :SDL_SetTextureAlphaMod => :int,
221
+ :SDL_GetTextureAlphaMod => :int,
222
+ :SDL_SetTextureBlendMode => :int,
223
+ :SDL_GetTextureBlendMode => :int,
224
+ :SDL_SetTextureScaleMode => :int,
225
+ :SDL_GetTextureScaleMode => :int,
226
+ :SDL_UpdateTexture => :int,
227
+ :SDL_UpdateYUVTexture => :int,
228
+ :SDL_LockTexture => :int,
229
+ :SDL_LockTextureToSurface => :int,
230
+ :SDL_UnlockTexture => :void,
231
+ :SDL_RenderTargetSupported => :int,
232
+ :SDL_SetRenderTarget => :int,
233
+ :SDL_GetRenderTarget => :pointer,
234
+ :SDL_RenderSetLogicalSize => :int,
235
+ :SDL_RenderGetLogicalSize => :void,
236
+ :SDL_RenderSetIntegerScale => :int,
237
+ :SDL_RenderGetIntegerScale => :int,
238
+ :SDL_RenderSetViewport => :int,
239
+ :SDL_RenderGetViewport => :void,
240
+ :SDL_RenderSetClipRect => :int,
241
+ :SDL_RenderGetClipRect => :void,
242
+ :SDL_RenderIsClipEnabled => :int,
243
+ :SDL_RenderSetScale => :int,
244
+ :SDL_RenderGetScale => :void,
245
+ :SDL_SetRenderDrawColor => :int,
246
+ :SDL_GetRenderDrawColor => :int,
247
+ :SDL_SetRenderDrawBlendMode => :int,
248
+ :SDL_GetRenderDrawBlendMode => :int,
249
+ :SDL_RenderClear => :int,
250
+ :SDL_RenderDrawPoint => :int,
251
+ :SDL_RenderDrawPoints => :int,
252
+ :SDL_RenderDrawLine => :int,
253
+ :SDL_RenderDrawLines => :int,
254
+ :SDL_RenderDrawRect => :int,
255
+ :SDL_RenderDrawRects => :int,
256
+ :SDL_RenderFillRect => :int,
257
+ :SDL_RenderFillRects => :int,
258
+ :SDL_RenderCopy => :int,
259
+ :SDL_RenderCopyEx => :int,
260
+ :SDL_RenderDrawPointF => :int,
261
+ :SDL_RenderDrawPointsF => :int,
262
+ :SDL_RenderDrawLineF => :int,
263
+ :SDL_RenderDrawLinesF => :int,
264
+ :SDL_RenderDrawRectF => :int,
265
+ :SDL_RenderDrawRectsF => :int,
266
+ :SDL_RenderFillRectF => :int,
267
+ :SDL_RenderFillRectsF => :int,
268
+ :SDL_RenderCopyF => :int,
269
+ :SDL_RenderCopyExF => :int,
270
+ :SDL_RenderReadPixels => :int,
271
+ :SDL_RenderPresent => :void,
272
+ :SDL_DestroyTexture => :void,
273
+ :SDL_DestroyRenderer => :void,
274
+ :SDL_RenderFlush => :int,
275
+ :SDL_GL_BindTexture => :int,
276
+ :SDL_GL_UnbindTexture => :int,
277
+ :SDL_RenderGetMetalLayer => :pointer,
278
+ :SDL_RenderGetMetalCommandEncoder => :pointer,
279
+ }
280
+ symbols.each do |sym|
281
+ begin
282
+ attach_function sym, args[sym], retvals[sym]
283
+ rescue FFI::NotFoundError => error
284
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
285
+ end
286
+ end
287
+ end
288
+
289
+ end
290
+