sdl2-bindings 0.0.5 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +96 -79
  3. data/LICENSE.txt +1 -1
  4. data/README.md +55 -49
  5. data/lib/sdl2.rb +172 -170
  6. data/lib/sdl2_audio.rb +222 -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 +533 -530
  12. data/lib/sdl2_filesystem.rb +48 -48
  13. data/lib/sdl2_framerate.rb +67 -67
  14. data/lib/sdl2_gamecontroller.rb +274 -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_hidapi.rb +118 -0
  19. data/lib/sdl2_hints.rb +198 -174
  20. data/lib/sdl2_image.rb +185 -185
  21. data/lib/sdl2_imageFilter.rb +132 -132
  22. data/lib/sdl2_joystick.rb +239 -230
  23. data/lib/sdl2_keyboard.rb +99 -99
  24. data/lib/sdl2_keycode.rb +305 -304
  25. data/lib/sdl2_log.rb +115 -115
  26. data/lib/sdl2_main.rb +67 -67
  27. data/lib/sdl2_messagebox.rb +98 -98
  28. data/lib/sdl2_misc.rb +45 -0
  29. data/lib/sdl2_mixer.rb +317 -307
  30. data/lib/sdl2_mouse.rb +117 -117
  31. data/lib/sdl2_pixels.rb +224 -224
  32. data/lib/sdl2_platform.rb +45 -45
  33. data/lib/sdl2_power.rb +51 -51
  34. data/lib/sdl2_rect.rb +102 -102
  35. data/lib/sdl2_render.rb +322 -290
  36. data/lib/sdl2_rotozoom.rb +66 -66
  37. data/lib/sdl2_rwops.rb +208 -208
  38. data/lib/sdl2_scancode.rb +287 -287
  39. data/lib/sdl2_sensor.rb +97 -0
  40. data/lib/sdl2_shape.rb +77 -77
  41. data/lib/sdl2_stdinc.rb +439 -393
  42. data/lib/sdl2_surface.rb +188 -182
  43. data/lib/sdl2_syswm.rb +157 -154
  44. data/lib/sdl2_timer.rb +65 -62
  45. data/lib/sdl2_touch.rb +75 -73
  46. data/lib/sdl2_ttf.rb +202 -190
  47. data/lib/sdl2_version.rb +62 -62
  48. data/lib/sdl2_video.rb +446 -411
  49. data/lib/sdl2_vulkan.rb +64 -64
  50. metadata +9 -6
data/lib/sdl2_surface.rb CHANGED
@@ -1,182 +1,188 @@
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_PremultiplyAlpha,
84
+ :SDL_FillRect,
85
+ :SDL_FillRects,
86
+ :SDL_UpperBlit,
87
+ :SDL_LowerBlit,
88
+ :SDL_SoftStretch,
89
+ :SDL_SoftStretchLinear,
90
+ :SDL_UpperBlitScaled,
91
+ :SDL_LowerBlitScaled,
92
+ :SDL_SetYUVConversionMode,
93
+ :SDL_GetYUVConversionMode,
94
+ :SDL_GetYUVConversionModeForResolution,
95
+ ]
96
+ args = {
97
+ :SDL_CreateRGBSurface => [:uint, :int, :int, :int, :uint, :uint, :uint, :uint],
98
+ :SDL_CreateRGBSurfaceWithFormat => [:uint, :int, :int, :int, :uint],
99
+ :SDL_CreateRGBSurfaceFrom => [:pointer, :int, :int, :int, :int, :uint, :uint, :uint, :uint],
100
+ :SDL_CreateRGBSurfaceWithFormatFrom => [:pointer, :int, :int, :int, :int, :uint],
101
+ :SDL_FreeSurface => [:pointer],
102
+ :SDL_SetSurfacePalette => [:pointer, :pointer],
103
+ :SDL_LockSurface => [:pointer],
104
+ :SDL_UnlockSurface => [:pointer],
105
+ :SDL_LoadBMP_RW => [:pointer, :int],
106
+ :SDL_SaveBMP_RW => [:pointer, :pointer, :int],
107
+ :SDL_SetSurfaceRLE => [:pointer, :int],
108
+ :SDL_HasSurfaceRLE => [:pointer],
109
+ :SDL_SetColorKey => [:pointer, :int, :uint],
110
+ :SDL_HasColorKey => [:pointer],
111
+ :SDL_GetColorKey => [:pointer, :pointer],
112
+ :SDL_SetSurfaceColorMod => [:pointer, :uchar, :uchar, :uchar],
113
+ :SDL_GetSurfaceColorMod => [:pointer, :pointer, :pointer, :pointer],
114
+ :SDL_SetSurfaceAlphaMod => [:pointer, :uchar],
115
+ :SDL_GetSurfaceAlphaMod => [:pointer, :pointer],
116
+ :SDL_SetSurfaceBlendMode => [:pointer, :int],
117
+ :SDL_GetSurfaceBlendMode => [:pointer, :pointer],
118
+ :SDL_SetClipRect => [:pointer, :pointer],
119
+ :SDL_GetClipRect => [:pointer, :pointer],
120
+ :SDL_DuplicateSurface => [:pointer],
121
+ :SDL_ConvertSurface => [:pointer, :pointer, :uint],
122
+ :SDL_ConvertSurfaceFormat => [:pointer, :uint, :uint],
123
+ :SDL_ConvertPixels => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
124
+ :SDL_PremultiplyAlpha => [:int, :int, :uint, :pointer, :int, :uint, :pointer, :int],
125
+ :SDL_FillRect => [:pointer, :pointer, :uint],
126
+ :SDL_FillRects => [:pointer, :pointer, :int, :uint],
127
+ :SDL_UpperBlit => [:pointer, :pointer, :pointer, :pointer],
128
+ :SDL_LowerBlit => [:pointer, :pointer, :pointer, :pointer],
129
+ :SDL_SoftStretch => [:pointer, :pointer, :pointer, :pointer],
130
+ :SDL_SoftStretchLinear => [:pointer, :pointer, :pointer, :pointer],
131
+ :SDL_UpperBlitScaled => [:pointer, :pointer, :pointer, :pointer],
132
+ :SDL_LowerBlitScaled => [:pointer, :pointer, :pointer, :pointer],
133
+ :SDL_SetYUVConversionMode => [:int],
134
+ :SDL_GetYUVConversionMode => [],
135
+ :SDL_GetYUVConversionModeForResolution => [:int, :int],
136
+ }
137
+ retvals = {
138
+ :SDL_CreateRGBSurface => :pointer,
139
+ :SDL_CreateRGBSurfaceWithFormat => :pointer,
140
+ :SDL_CreateRGBSurfaceFrom => :pointer,
141
+ :SDL_CreateRGBSurfaceWithFormatFrom => :pointer,
142
+ :SDL_FreeSurface => :void,
143
+ :SDL_SetSurfacePalette => :int,
144
+ :SDL_LockSurface => :int,
145
+ :SDL_UnlockSurface => :void,
146
+ :SDL_LoadBMP_RW => :pointer,
147
+ :SDL_SaveBMP_RW => :int,
148
+ :SDL_SetSurfaceRLE => :int,
149
+ :SDL_HasSurfaceRLE => :int,
150
+ :SDL_SetColorKey => :int,
151
+ :SDL_HasColorKey => :int,
152
+ :SDL_GetColorKey => :int,
153
+ :SDL_SetSurfaceColorMod => :int,
154
+ :SDL_GetSurfaceColorMod => :int,
155
+ :SDL_SetSurfaceAlphaMod => :int,
156
+ :SDL_GetSurfaceAlphaMod => :int,
157
+ :SDL_SetSurfaceBlendMode => :int,
158
+ :SDL_GetSurfaceBlendMode => :int,
159
+ :SDL_SetClipRect => :int,
160
+ :SDL_GetClipRect => :void,
161
+ :SDL_DuplicateSurface => :pointer,
162
+ :SDL_ConvertSurface => :pointer,
163
+ :SDL_ConvertSurfaceFormat => :pointer,
164
+ :SDL_ConvertPixels => :int,
165
+ :SDL_PremultiplyAlpha => :int,
166
+ :SDL_FillRect => :int,
167
+ :SDL_FillRects => :int,
168
+ :SDL_UpperBlit => :int,
169
+ :SDL_LowerBlit => :int,
170
+ :SDL_SoftStretch => :int,
171
+ :SDL_SoftStretchLinear => :int,
172
+ :SDL_UpperBlitScaled => :int,
173
+ :SDL_LowerBlitScaled => :int,
174
+ :SDL_SetYUVConversionMode => :void,
175
+ :SDL_GetYUVConversionMode => :int,
176
+ :SDL_GetYUVConversionModeForResolution => :int,
177
+ }
178
+ symbols.each do |sym|
179
+ begin
180
+ attach_function sym, args[sym], retvals[sym]
181
+ rescue FFI::NotFoundError => error
182
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
183
+ end
184
+ end
185
+ end
186
+
187
+ end
188
+