class SDL2::Display::Modes
Public Class Methods
new(for_display)
click to toggle source
TODO: Consider converting this into some kind of enumerator?
# File lib/sdl2/display/modes.rb, line 9 def initialize(for_display) @for_display = for_display end
Public Instance Methods
[](index)
click to toggle source
TODO: Probably leaks memory.. WeakRef cache?
# File lib/sdl2/display/modes.rb, line 18 def [](index) if (idx = index.to_i) < count dm_buffer = SDL2::Display::Mode.new if SDL2.get_display_mode(@for_display.id, idx, dm_buffer) == 0 return dm_buffer else dm_buffer.pointer.free end else return nil end end
count()
click to toggle source
# File lib/sdl2/display/modes.rb, line 13 def count SDL2.get_num_display_modes(@for_display.id) end
first()
click to toggle source
# File lib/sdl2/display/modes.rb, line 31 def first self[0] end