sdl2_ffi 0.0.5 → 0.0.6

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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -59
  3. data/lib/sdl2.rb +52 -15
  4. data/lib/sdl2/application.rb +71 -0
  5. data/lib/sdl2/audio.rb +72 -24
  6. data/lib/sdl2/clipboard.rb +9 -3
  7. data/lib/sdl2/color.rb +8 -3
  8. data/lib/sdl2/cpuinfo.rb +30 -10
  9. data/lib/sdl2/engine.rb +52 -0
  10. data/lib/sdl2/engine/block_engine.rb +27 -0
  11. data/lib/sdl2/engine/engines.rb +46 -0
  12. data/lib/sdl2/error.rb +9 -3
  13. data/lib/sdl2/events.rb +68 -6
  14. data/lib/sdl2/gamecontroller.rb +60 -20
  15. data/lib/sdl2/gem_version.rb +1 -1
  16. data/lib/sdl2/gesture.rb +12 -4
  17. data/lib/sdl2/haptic.rb +90 -30
  18. data/lib/sdl2/hints.rb +12 -4
  19. data/lib/sdl2/image.rb +85 -3
  20. data/lib/sdl2/init.rb +15 -5
  21. data/lib/sdl2/joystick.rb +63 -21
  22. data/lib/sdl2/keyboard.rb +101 -17
  23. data/lib/sdl2/keycode.rb +72 -72
  24. data/lib/sdl2/library.rb +7 -0
  25. data/lib/sdl2/log.rb +78 -21
  26. data/lib/sdl2/mixer.rb +651 -0
  27. data/lib/sdl2/mixer/chunk.rb +47 -0
  28. data/lib/sdl2/mixer/lib_paths.rb +8 -0
  29. data/lib/sdl2/mouse.rb +39 -13
  30. data/lib/sdl2/pixels.rb +39 -13
  31. data/lib/sdl2/point.rb +29 -0
  32. data/lib/sdl2/power.rb +3 -1
  33. data/lib/sdl2/rect.rb +94 -19
  34. data/lib/sdl2/render.rb +156 -52
  35. data/lib/sdl2/rwops.rb +60 -20
  36. data/lib/sdl2/surface.rb +85 -28
  37. data/lib/sdl2/syswm.rb +3 -1
  38. data/lib/sdl2/timer.rb +18 -6
  39. data/lib/sdl2/touch.rb +12 -4
  40. data/lib/sdl2/ttf.rb +153 -59
  41. data/lib/sdl2/ttf/font.rb +21 -5
  42. data/lib/sdl2/version.rb +9 -3
  43. data/lib/sdl2/video.rb +210 -70
  44. data/lib/sdl2/window.rb +9 -3
  45. data/spec/fixtures/approvals/lazyfoonet_lesson_07_true_type_fonts/draws_the_message_to_the_screen.approved.png +0 -0
  46. data/spec/fixtures/approvals/lazyfoonet_lesson_07_true_type_fonts/writes_a_message_to_a_surface.approved.png +0 -0
  47. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/defaults_to_mouse_out.approved.png +0 -0
  48. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/has_a_button_sheet.approved.png +0 -0
  49. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/shows_mouse_down.approved.png +0 -0
  50. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/shows_mouse_in.approved.png +0 -0
  51. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/shows_mouse_out.approved.png +0 -0
  52. data/spec/fixtures/approvals/lazyfoonet_lesson_09_mouse_events/shows_mouse_up.approved.png +0 -0
  53. data/spec/fixtures/images/button_sheet.png +0 -0
  54. data/spec/functional/lazy_foo_tutorial/lazy_foo_01_hello_world_spec.rb +9 -2
  55. data/spec/functional/lazy_foo_tutorial/lazy_foo_03_extension_libraries_spec.rb +1 -0
  56. data/spec/functional/lazy_foo_tutorial/lazy_foo_04_event_driven_programming_spec.rb +4 -3
  57. data/spec/functional/lazy_foo_tutorial/lazy_foo_05_color_keying_spec.rb +1 -1
  58. data/spec/functional/lazy_foo_tutorial/lazy_foo_06_clip_blitting_and_sprite_sheets_spec.rb +4 -3
  59. data/spec/functional/lazy_foo_tutorial/lazy_foo_07_true_type_fonts_spec.rb +4 -2
  60. data/spec/functional/lazy_foo_tutorial/lazy_foo_08_key_presses_spec.rb +10 -22
  61. data/spec/functional/lazy_foo_tutorial/lazy_foo_09_mouse_events_spec.rb +121 -0
  62. data/spec/functional/lazy_foo_tutorial/lazy_foo_10_key_states_spec.rb +30 -0
  63. data/spec/functional/lazy_foo_tutorial/lazy_foo_11_playing_sounds_spec.rb +116 -0
  64. data/spec/functional/lazy_foo_tutorial/lazy_foo_12_timing_spec.rb +57 -0
  65. data/spec/spec_helper.rb +3 -1
  66. metadata +31 -2
@@ -0,0 +1,47 @@
1
+ require 'sdl2'
2
+
3
+ module SDL2
4
+
5
+ module Mixer
6
+
7
+ # The internal format for an audio chunk
8
+ #
9
+ # * allocated - :int
10
+ # * abuf - :pointer of :uint8
11
+ # * alen - :uint32
12
+ # * volume - :uint8 "Per-sample volume, 0-128"
13
+ class Chunk < SDL2::Struct
14
+
15
+ layout :allocated, :int,
16
+ :abuf, :pointer, #of :uint8
17
+ :alen, :uint32,
18
+ :volume, :uint8
19
+
20
+ member_readers *members
21
+ member_writers *members
22
+
23
+ def self.load_wav(filepath)
24
+ Mixer.load_wav!(filepath)
25
+ end
26
+
27
+ # Plays chunk
28
+ # @param opts[:channel]: defaults to -1
29
+ # @param opts[:loop]: defaults to 0
30
+ # @param opts[:ms]: defaults to -1
31
+ def play(opts = {})
32
+ channel = opts[:channel] || -1
33
+ loop = opts[:loop] || 0
34
+ ms = opts[:ms] || -1
35
+ Mixer::play_channel_timed(channel, self, loop, ms)
36
+ end
37
+
38
+ # Check if anything is playing?
39
+ def self.playing?
40
+ Mixer::playing?(-1)
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
47
+ end
@@ -0,0 +1,8 @@
1
+ module SDL2
2
+
3
+ module Mixer
4
+
5
+ LibPaths = ['libSDL2_mixer', '/usr/local/lib/libSDL2_mixer.so']
6
+
7
+ end
8
+ end
data/lib/sdl2/mouse.rb CHANGED
@@ -13,19 +13,45 @@ module SDL2
13
13
  enum :system_cursor, [:ARROW,:IBEAM,:WAIT,:CROSSHAIR,:WAITARROW,:SIZENWSE,:SIZENESW,:SIZEWE,
14
14
  :SIZENS,:SIZEALL,:NO,:HAND]
15
15
 
16
- api :SDL_GetMouseFocus, [], Window.by_ref
17
- api :SDL_GetMouseState, [IntStruct.by_ref, IntStruct.by_ref], :uint32
18
- api :SDL_GetRelativeMouseState, [IntStruct.by_ref, IntStruct.by_ref], :uint32
19
- api :SDL_WarpMouseInWindow, [Window.by_ref, :int, :int], :void
20
- api :SDL_SetRelativeMouseMode, [:bool], :int
21
- api :SDL_GetRelativeMouseMode, [], :bool
22
- api :SDL_CreateCursor, [:pointer, :pointer, :int, :int, :int, :int], Cursor.auto_ptr
23
- api :SDL_CreateColorCursor, [Surface.by_ref, :int, :int], Cursor.auto_ptr
24
- api :SDL_CreateSystemCursor, [:system_cursor], Cursor.auto_ptr
25
- api :SDL_GetCursor, [], Cursor.by_ref
26
- api :SDL_GetDefaultCursor, [], Cursor.by_ref
27
- api :SDL_FreeCursor, [Cursor.by_ref], :void
28
- api :SDL_ShowCursor, [:int], :int
16
+ ##
17
+ #
18
+ api :SDL_GetMouseFocus, [], Window.by_ref
19
+ ##
20
+ #
21
+ api :SDL_GetMouseState, [IntStruct.by_ref, IntStruct.by_ref], :uint32
22
+ ##
23
+ #
24
+ api :SDL_GetRelativeMouseState, [IntStruct.by_ref, IntStruct.by_ref], :uint32
25
+ ##
26
+ #
27
+ api :SDL_WarpMouseInWindow, [Window.by_ref, :int, :int], :void
28
+ ##
29
+ #
30
+ api :SDL_SetRelativeMouseMode, [:bool], :int
31
+ ##
32
+ #
33
+ api :SDL_GetRelativeMouseMode, [], :bool
34
+ ##
35
+ #
36
+ api :SDL_CreateCursor, [:pointer, :pointer, :int, :int, :int, :int], Cursor.auto_ptr
37
+ ##
38
+ #
39
+ api :SDL_CreateColorCursor, [Surface.by_ref, :int, :int], Cursor.auto_ptr
40
+ ##
41
+ #
42
+ api :SDL_CreateSystemCursor, [:system_cursor], Cursor.auto_ptr
43
+ ##
44
+ #
45
+ api :SDL_GetCursor, [], Cursor.by_ref
46
+ ##
47
+ #
48
+ api :SDL_GetDefaultCursor, [], Cursor.by_ref
49
+ ##
50
+ #
51
+ api :SDL_FreeCursor, [Cursor.by_ref], :void
52
+ ##
53
+ #
54
+ api :SDL_ShowCursor, [:int], :int
29
55
 
30
56
  module Mouse
31
57
 
data/lib/sdl2/pixels.rb CHANGED
@@ -194,18 +194,44 @@ module SDL2
194
194
  YVYU = SDL2.define_pixelfourcc('Y', 'V', 'Y', 'U')
195
195
  end
196
196
 
197
- api :SDL_GetPixelFormatName, [:pixel_format], :string
198
- api :SDL_PixelFormatEnumToMasks, [:pixel_format, IntStruct.by_ref, UInt32Struct.by_ref, UInt32Struct.by_ref,UInt32Struct.by_ref,UInt32Struct.by_ref,], :bool
199
- api :SDL_MasksToPixelFormatEnum, [:int, :uint32, :uint32, :uint32, :uint32], :pixel_format
200
- api :SDL_AllocFormat, [:pixel_format], PixelFormat.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
201
- api :SDL_FreeFormat, [PixelFormat.by_ref], :void
202
- api :SDL_AllocPalette, [:count], Palette.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
203
- api :SDL_SetPixelFormatPalette, [PixelFormat.by_ref, Palette.by_ref], :int
204
- api :SDL_SetPaletteColors, [Palette.by_ref, :pointer, :int, :count], :int
205
- api :SDL_FreePalette, [Palette.by_ref], :void
206
- api :SDL_MapRGB, [PixelFormat.by_ref, :uint8, :uint8, :uint8], :uint32
207
- api :SDL_MapRGBA, [PixelFormat.by_ref, :uint8, :uint8, :uint8, :uint8], :uint32
208
- api :SDL_GetRGB, [:uint32, PixelFormat.by_ref, UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref], :void
209
- api :SDL_GetRGBA, [:uint32, PixelFormat.by_ref, UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref], :void
197
+ ##
198
+ #
199
+ api :SDL_GetPixelFormatName, [:pixel_format], :string
200
+ ##
201
+ #
202
+ api :SDL_PixelFormatEnumToMasks, [:pixel_format, IntStruct.by_ref, UInt32Struct.by_ref, UInt32Struct.by_ref,UInt32Struct.by_ref,UInt32Struct.by_ref,], :bool
203
+ ##
204
+ #
205
+ api :SDL_MasksToPixelFormatEnum, [:int, :uint32, :uint32, :uint32, :uint32], :pixel_format
206
+ ##
207
+ #
208
+ api :SDL_AllocFormat, [:pixel_format], PixelFormat.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
209
+ ##
210
+ #
211
+ api :SDL_FreeFormat, [PixelFormat.by_ref], :void
212
+ ##
213
+ #
214
+ api :SDL_AllocPalette, [:count], Palette.auto_ptr, {error: true, filter: TRUE_WHEN_NOT_NULL}
215
+ ##
216
+ #
217
+ api :SDL_SetPixelFormatPalette, [PixelFormat.by_ref, Palette.by_ref], :int
218
+ ##
219
+ #
220
+ api :SDL_SetPaletteColors, [Palette.by_ref, :pointer, :int, :count], :int
221
+ ##
222
+ #
223
+ api :SDL_FreePalette, [Palette.by_ref], :void
224
+ ##
225
+ #
226
+ api :SDL_MapRGB, [PixelFormat.by_ref, :uint8, :uint8, :uint8], :uint32
227
+ ##
228
+ #
229
+ api :SDL_MapRGBA, [PixelFormat.by_ref, :uint8, :uint8, :uint8, :uint8], :uint32
230
+ ##
231
+ #
232
+ api :SDL_GetRGB, [:uint32, PixelFormat.by_ref, UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref], :void
233
+ ##
234
+ #
235
+ api :SDL_GetRGBA, [:uint32, PixelFormat.by_ref, UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref], :void
210
236
 
211
237
  end
data/lib/sdl2/point.rb CHANGED
@@ -18,6 +18,35 @@ module SDL2
18
18
  end
19
19
  end
20
20
 
21
+ def self.cast_array(somethings, count_something = nil)
22
+
23
+ # Convert Ruby arrays into Struct Arrays.
24
+ if somethings.kind_of? Array
25
+ count_something = somethings.count if count_something.nil?
26
+
27
+ raise "count_something > somethings.count" if count_something > somethings.count
28
+
29
+ pointer = FFI::MemoryPointer.new(self, count_something)
30
+
31
+ count_something.times do |idx|
32
+ pointer[idx].update_members(somethings[idx])
33
+ end
34
+
35
+ somethings = pointer
36
+
37
+ # If it is already a structure, then it is an array of 1, unless
38
+ # someone defined a count, in which case we assume they know what they
39
+ # are doing.
40
+ elsif somethings.kind_of? self
41
+ count_something = 1 if count_something.nil?
42
+
43
+ else
44
+ raise "#{self} cannot cast array from #{somethings.inspect}"
45
+ end
46
+
47
+ return somethings, count_something
48
+ end
49
+
21
50
 
22
51
  end
23
52
  end
data/lib/sdl2/power.rb CHANGED
@@ -13,6 +13,8 @@ module SDL2
13
13
  enum :powerstate, POWERSTATE.flatten_consts
14
14
 
15
15
 
16
- api :SDL_GetPowerInfo, [IntStruct.by_ref, IntStruct.by_ref], :powerstate
16
+ ##
17
+ #
18
+ api :SDL_GetPowerInfo, [IntStruct.by_ref, IntStruct.by_ref], :powerstate
17
19
 
18
20
  end
data/lib/sdl2/rect.rb CHANGED
@@ -10,52 +10,127 @@ module SDL2
10
10
 
11
11
  member_readers *members
12
12
  member_writers *members
13
-
13
+
14
+ # Automatically construct a Rect out of something.
15
+ # * Accepts an array of &:to_i with length 2 or 4 as [x, y, [w, h]]
14
16
  def self.cast(something)
15
-
16
- if something.kind_of?(Array)
17
+
18
+ if something.kind_of?(Array)
17
19
  something.map!(&:to_i)
18
20
  result = Rect.new
19
21
  case something.count
20
- when 4
21
- result.x, result.y, result.w, result.h = something
22
- when 2
23
- result.x, result.y = something
24
- else
25
- raise "#{self}#cast cannot convert array length #{something.count} of: #{something.inspect}"
22
+ when 4
23
+ result.x, result.y, result.w, result.h = something
24
+ when 2
25
+ result.x, result.y = something
26
+ else
27
+ raise "#{self}#cast cannot convert array length #{something.count} of: #{something.inspect}"
26
28
  end
27
29
  return result
28
30
  else
29
31
  return super
30
32
  end
31
33
  end
32
-
34
+
35
+ # Returns true if the rectangle has no area.
33
36
  def empty
34
37
  return ((!self.null?) || (self[:w] <= 0) || (self[:h] <= 0))
35
38
  end
36
39
 
37
40
  alias_method :empty?, :empty
38
41
 
39
- def equals(other)
40
- return false if other.nil?
41
- return false unless other.kind_of? Rect
42
+ # SDL Defines a macro that is roughly the same as Struct#==
43
+ alias_method :equals, :==
44
+ # TODO: Review for removal. Originally this was a MACRO reimplementation,
45
+ # but has since been replaced with a working #== methond on SDL2::Struct
46
+ #
47
+ # def equals(other)
48
+ # return false if other.nil?
49
+ # return false unless other.kind_of? Rect
50
+ #
51
+ # if self.null? or other.null? # Either null?
52
+ # return (self.null? and other.null?) # Equal if both are null!
53
+ # else
54
+ # members.each do |field| # Compare our fields.
55
+ # return false unless self[field] == other[field]
56
+ # end
57
+ # end
58
+ # return true # if we made it this far
59
+ # end
60
+
61
+
62
+ # Determine whether two rectangles intersect.
63
+ # @param Another rectangle to test against.
64
+ # @return True when they touch, false when they don't
65
+ def has_intersection?(rect)
66
+ rect = Rect.cast(rect)
67
+ SDL2.has_intersection?(self, rect)
68
+ end
69
+
70
+ # Calculate the intersection of two rectangles.
71
+ # @param Another rectangle to find intersection with self.
72
+ # @return Rect or Nil if no intersection found.
73
+ def intersection(rect)
74
+ rect = Rect.cast(rect)
75
+ result = Rect.new
76
+ if SDL2.intersect_rect?(self, rect, result)
77
+ return result
78
+ else
79
+ result.free
80
+ return nil
81
+ end
82
+ end
83
+ # I prefer #intersection, but aliased for compatibility.
84
+ alias_method :intersect_rect, :intersection
85
+
86
+ # Calculate the union of two rectangles.
87
+ def union(rect)
88
+ rect = Rect.cast(rect)
89
+ result = Rect.new
90
+ SDL2.union_rect(self, rect, result)
91
+ return result
92
+ end
93
+
94
+ # Calculate a minimal rectangle enclosing a set of points
95
+ def enclose_points(points, count = nil, clip = self)
96
+ clip = Rect.cast(clip)
97
+ points, count = Point.cast_array(points, count)
98
+ result = Rect.new
99
+ if SDL2.enclose_points?(points, count, clip, result)
100
+ return result
101
+ else
102
+ result.free
103
+ return nil
104
+ end
105
+ end
42
106
 
43
- if self.null? or other.null? # Either null?
44
- return (self.null? and other.null?) # Equal if both are null!
107
+ # Calculate the intersection of a rectangle and line segment.
108
+ def intersect_line(x1, y1, x2, y2)
109
+ result = Rect.new
110
+ if SDL2.intersect_rect_and_line(self, x1, y1, x2, y2)
111
+ return result
45
112
  else
46
- members.each do |field| # Compare our fields.
47
- return false unless self[field] == other[field]
48
- end
113
+ result.free
114
+ return nil
49
115
  end
50
- return true # if we made it this far
51
116
  end
52
117
 
53
118
  end
54
119
 
120
+ ##
121
+ # Determine whether two rectangles intersect.
55
122
  api :SDL_HasIntersection, [Rect.by_ref, Rect.by_ref], :bool
123
+ ##
124
+ # Calculate the intersection of two rectangles.
56
125
  api :SDL_IntersectRect, [Rect.by_ref, Rect.by_ref, Rect.by_ref], :bool
126
+ ##
127
+ # Calculate the union of two rectangles.
57
128
  api :SDL_UnionRect, [Rect.by_ref, Rect.by_ref, Rect.by_ref], :void
129
+ ##
130
+ # Calculate a minimal rectangle enclosing a set of points
58
131
  api :SDL_EnclosePoints, [Point.by_ref, :count, Rect.by_ref, Rect.by_ref], :bool
132
+ ##
133
+ # Calculate the intersection of a rectangle and a line segment.
59
134
  api :SDL_IntersectRectAndLine, [Rect.by_ref, :int, :int, :int, :int], :bool
60
135
 
61
136
  end
data/lib/sdl2/render.rb CHANGED
@@ -36,58 +36,162 @@ module SDL2
36
36
 
37
37
  typedef :int, :render_driver_index
38
38
 
39
- api :SDL_GetNumRenderDrivers, [], :int
40
- api :SDL_GetRenderDriverInfo, [:render_driver_index, RendererInfo.by_ref], :int
41
- api :SDL_CreateWindowAndRenderer, [:int, :int, :window_flags, Window.by_ref, Renderer.by_ref], :int
42
- api :SDL_CreateRenderer, [Window.by_ref, :render_driver_index, :renderer_flags], Renderer.auto_ptr
43
- api :SDL_CreateSoftwareRenderer, [Surface.by_ref], Renderer.auto_ptr
44
- api :SDL_GetRenderer, [Window.by_ref], Renderer.auto_ptr
45
- api :SDL_GetRendererInfo, [Renderer.by_ref, RendererInfo.by_ref], :int
46
- api :SDL_GetRendererOutputSize, [Renderer.by_ref, IntStruct.by_ref, IntStruct.by_ref], :int
47
- api :SDL_CreateTexture, [Renderer.by_ref, :pixel_format, :texture_access, :int, :int], Texture.auto_ptr
48
- api :SDL_CreateTextureFromSurface, [Renderer.by_ref, Surface.by_ref], Texture.auto_ptr
49
- api :SDL_QueryTexture, [Texture.by_ref, UInt32Struct.by_ref, IntStruct.by_ref, IntStruct.by_ref, IntStruct.by_ref], :int
50
- api :SDL_SetTextureColorMod, [Texture.by_ref, :uint8, :uint8, :uint8], :int
51
- api :SDL_GetTextureColorMod, [Texture.by_ref, UInt8Struct.by_ref, UInt8Struct.by_ref, UInt8Struct.by_ref], :int
52
- api :SDL_SetTextureAlphaMod, [Texture.by_ref, :uint8], :int
53
- api :SDL_GetTextureAlphaMod, [Texture.by_ref, UInt8Struct.by_ref], :int
54
- api :SDL_SetTextureBlendMode, [Texture.by_ref, :blend_mode], :int
55
- api :SDL_GetTextureBlendMode, [Texture.by_ref, BlendModeStruct.by_ref], :int
56
- api :SDL_UpdateTexture, [Texture.by_ref, Rect.by_ref, :pointer, :int], :int
57
- api :SDL_LockTexture, [Texture.by_ref, Rect.by_ref, :pointer, IntStruct.by_ref], :int
58
- api :SDL_UnlockTexture, [Texture.by_ref], :void
59
- api :SDL_RenderTargetSupported, [Renderer.by_ref], :bool
60
- api :SDL_GetRenderTarget, [Renderer.by_ref], Texture.by_ref
61
- api :SDL_SetRenderTarget, [Renderer.by_ref, Texture.by_ref], :int
62
- api :SDL_RenderSetLogicalSize, [Renderer.by_ref, :int, :int],:int
63
- api :SDL_RenderGetLogicalSize, [Renderer.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
64
- api :SDL_RenderSetViewport, [Renderer.by_ref, Rect.by_ref], :int
65
- api :SDL_RenderGetViewport, [Renderer.by_ref, Rect.by_ref], :int
66
- api :SDL_RenderSetClipRect, [Renderer.by_ref, Rect.by_ref], :int
67
- api :SDL_RenderGetClipRect, [Renderer.by_ref, Rect.by_ref], :int
68
- api :SDL_RenderSetScale, [Renderer.by_ref, :float, :float], :int
69
- api :SDL_RenderGetScale, [Renderer.by_ref, FloatPointer.by_ref, FloatPointer.by_ref], :int
70
- api :SDL_SetRenderDrawColor, [Renderer.by_ref, :uint8, :uint8, :uint8, :uint8], :int
71
- api :SDL_GetRenderDrawColor, [Renderer.by_ref, UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref], :int
72
- api :SDL_SetRenderDrawBlendMode, [Renderer.by_ref, :blend_mode], :int
73
- api :SDL_GetRenderDrawBlendMode, [Renderer.by_ref, BlendModeStruct.by_ref], :int
74
- api :SDL_RenderClear, [Renderer.by_ref], :int
75
- api :SDL_RenderDrawPoint, [Renderer.by_ref, :int, :int], :int
76
- api :SDL_RenderDrawPoints, [Renderer.by_ref, Point.by_ref, :count], :int
77
- api :SDL_RenderDrawLine, [Renderer.by_ref, :int, :int, :int, :int], :int
78
- api :SDL_RenderDrawLines, [Renderer.by_ref, Point.by_ref, :count], :int
79
- api :SDL_RenderDrawRect, [Renderer.by_ref, Rect.by_ref], :int
80
- api :SDL_RenderDrawRects, [Renderer.by_ref, Rect.by_ref, :count], :int
81
- api :SDL_RenderFillRect, [Renderer.by_ref, Rect.by_ref], :int
82
- api :SDL_RenderFillRects, [Renderer.by_ref, Rect.by_ref, :count], :int
83
- api :SDL_RenderCopy, [Renderer.by_ref, Texture.by_ref, Rect.by_ref, Rect.by_ref], :int
84
- api :SDL_RenderCopyEx, [Renderer.by_ref, Texture.by_ref, Rect.by_ref, Rect.by_ref, :double, Point.by_ref, :renderer_flip], :int
85
- api :SDL_RenderReadPixels, [Renderer.by_ref, Rect.by_ref, :pixel_format, :pointer, :int], :int #TODO: Review linking.
86
- api :SDL_RenderPresent, [Renderer.by_ref], :void
87
- api :SDL_DestroyTexture, [Texture.by_ref], :void
88
- api :SDL_DestroyRenderer, [Renderer.by_ref], :void
89
- api :SDL_GL_BindTexture, [Texture.by_ref, FloatPointer.by_ref, FloatPointer.by_ref], :int
90
- api :SDL_GL_UnbindTexture, [Texture.by_ref], :int
39
+ ##
40
+ #
41
+ api :SDL_GetNumRenderDrivers, [], :int
42
+ ##
43
+ #
44
+ api :SDL_GetRenderDriverInfo, [:render_driver_index, RendererInfo.by_ref], :int
45
+ ##
46
+ #
47
+ api :SDL_CreateWindowAndRenderer, [:int, :int, :window_flags, Window.by_ref, Renderer.by_ref], :int
48
+ ##
49
+ #
50
+ api :SDL_CreateRenderer, [Window.by_ref, :render_driver_index, :renderer_flags], Renderer.auto_ptr
51
+ ##
52
+ #
53
+ api :SDL_CreateSoftwareRenderer, [Surface.by_ref], Renderer.auto_ptr
54
+ ##
55
+ #
56
+ api :SDL_GetRenderer, [Window.by_ref], Renderer.auto_ptr
57
+ ##
58
+ #
59
+ api :SDL_GetRendererInfo, [Renderer.by_ref, RendererInfo.by_ref], :int
60
+ ##
61
+ #
62
+ api :SDL_GetRendererOutputSize, [Renderer.by_ref, IntStruct.by_ref, IntStruct.by_ref], :int
63
+ ##
64
+ #
65
+ api :SDL_CreateTexture, [Renderer.by_ref, :pixel_format, :texture_access, :int, :int], Texture.auto_ptr
66
+ ##
67
+ #
68
+ api :SDL_CreateTextureFromSurface, [Renderer.by_ref, Surface.by_ref], Texture.auto_ptr
69
+ ##
70
+ #
71
+ api :SDL_QueryTexture, [Texture.by_ref, UInt32Struct.by_ref, IntStruct.by_ref, IntStruct.by_ref, IntStruct.by_ref], :int
72
+ ##
73
+ #
74
+ api :SDL_SetTextureColorMod, [Texture.by_ref, :uint8, :uint8, :uint8], :int
75
+ ##
76
+ #
77
+ api :SDL_GetTextureColorMod, [Texture.by_ref, UInt8Struct.by_ref, UInt8Struct.by_ref, UInt8Struct.by_ref], :int
78
+ ##
79
+ #
80
+ api :SDL_SetTextureAlphaMod, [Texture.by_ref, :uint8], :int
81
+ ##
82
+ #
83
+ api :SDL_GetTextureAlphaMod, [Texture.by_ref, UInt8Struct.by_ref], :int
84
+ ##
85
+ #
86
+ api :SDL_SetTextureBlendMode, [Texture.by_ref, :blend_mode], :int
87
+ ##
88
+ #
89
+ api :SDL_GetTextureBlendMode, [Texture.by_ref, BlendModeStruct.by_ref], :int
90
+ ##
91
+ #
92
+ api :SDL_UpdateTexture, [Texture.by_ref, Rect.by_ref, :pointer, :int], :int
93
+ ##
94
+ #
95
+ api :SDL_LockTexture, [Texture.by_ref, Rect.by_ref, :pointer, IntStruct.by_ref], :int
96
+ ##
97
+ #
98
+ api :SDL_UnlockTexture, [Texture.by_ref], :void
99
+ ##
100
+ #
101
+ api :SDL_RenderTargetSupported, [Renderer.by_ref], :bool
102
+ ##
103
+ #
104
+ api :SDL_GetRenderTarget, [Renderer.by_ref], Texture.by_ref
105
+ ##
106
+ #
107
+ api :SDL_SetRenderTarget, [Renderer.by_ref, Texture.by_ref], :int
108
+ ##
109
+ #
110
+ api :SDL_RenderSetLogicalSize, [Renderer.by_ref, :int, :int],:int
111
+ ##
112
+ #
113
+ api :SDL_RenderGetLogicalSize, [Renderer.by_ref, IntStruct.by_ref, IntStruct.by_ref], :void
114
+ ##
115
+ #
116
+ api :SDL_RenderSetViewport, [Renderer.by_ref, Rect.by_ref], :int
117
+ ##
118
+ #
119
+ api :SDL_RenderGetViewport, [Renderer.by_ref, Rect.by_ref], :int
120
+ ##
121
+ #
122
+ api :SDL_RenderSetClipRect, [Renderer.by_ref, Rect.by_ref], :int
123
+ ##
124
+ #
125
+ api :SDL_RenderGetClipRect, [Renderer.by_ref, Rect.by_ref], :int
126
+ ##
127
+ #
128
+ api :SDL_RenderSetScale, [Renderer.by_ref, :float, :float], :int
129
+ ##
130
+ #
131
+ api :SDL_RenderGetScale, [Renderer.by_ref, FloatPointer.by_ref, FloatPointer.by_ref], :int
132
+ ##
133
+ #
134
+ api :SDL_SetRenderDrawColor, [Renderer.by_ref, :uint8, :uint8, :uint8, :uint8], :int
135
+ ##
136
+ #
137
+ api :SDL_GetRenderDrawColor, [Renderer.by_ref, UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref,UInt8Struct.by_ref], :int
138
+ ##
139
+ #
140
+ api :SDL_SetRenderDrawBlendMode, [Renderer.by_ref, :blend_mode], :int
141
+ ##
142
+ #
143
+ api :SDL_GetRenderDrawBlendMode, [Renderer.by_ref, BlendModeStruct.by_ref], :int
144
+ ##
145
+ #
146
+ api :SDL_RenderClear, [Renderer.by_ref], :int
147
+ ##
148
+ #
149
+ api :SDL_RenderDrawPoint, [Renderer.by_ref, :int, :int], :int
150
+ ##
151
+ #
152
+ api :SDL_RenderDrawPoints, [Renderer.by_ref, Point.by_ref, :count], :int
153
+ ##
154
+ #
155
+ api :SDL_RenderDrawLine, [Renderer.by_ref, :int, :int, :int, :int], :int
156
+ ##
157
+ #
158
+ api :SDL_RenderDrawLines, [Renderer.by_ref, Point.by_ref, :count], :int
159
+ ##
160
+ #
161
+ api :SDL_RenderDrawRect, [Renderer.by_ref, Rect.by_ref], :int
162
+ ##
163
+ #
164
+ api :SDL_RenderDrawRects, [Renderer.by_ref, Rect.by_ref, :count], :int
165
+ ##
166
+ #
167
+ api :SDL_RenderFillRect, [Renderer.by_ref, Rect.by_ref], :int
168
+ ##
169
+ #
170
+ api :SDL_RenderFillRects, [Renderer.by_ref, Rect.by_ref, :count], :int
171
+ ##
172
+ #
173
+ api :SDL_RenderCopy, [Renderer.by_ref, Texture.by_ref, Rect.by_ref, Rect.by_ref], :int
174
+ ##
175
+ #
176
+ api :SDL_RenderCopyEx, [Renderer.by_ref, Texture.by_ref, Rect.by_ref, Rect.by_ref, :double, Point.by_ref, :renderer_flip], :int
177
+ ##
178
+ #
179
+ api :SDL_RenderReadPixels, [Renderer.by_ref, Rect.by_ref, :pixel_format, :pointer, :int], :int #TODO: Review linking.
180
+ ##
181
+ #
182
+ api :SDL_RenderPresent, [Renderer.by_ref], :void
183
+ ##
184
+ #
185
+ api :SDL_DestroyTexture, [Texture.by_ref], :void
186
+ ##
187
+ #
188
+ api :SDL_DestroyRenderer, [Renderer.by_ref], :void
189
+ ##
190
+ #
191
+ api :SDL_GL_BindTexture, [Texture.by_ref, FloatPointer.by_ref, FloatPointer.by_ref], :int
192
+ ##
193
+ #
194
+ api :SDL_GL_UnbindTexture, [Texture.by_ref], :int
91
195
 
92
196
 
93
197
  end