Class: RbSDL2::DisplayMode

Inherits:
Object
  • Object
show all
Includes:
PixelFormatEnum
Defined in:
lib/rb_sdl2/display_mode.rb

Constant Summary

Constants included from PixelFormatEnum

PixelFormatEnum::FORMAT_MAP, PixelFormatEnum::INDEXED_TYPES, PixelFormatEnum::WITH_ALPHA

Instance Method Summary collapse

Methods included from PixelFormatEnum

#format_name, #fourcc, #fourcc?, #indexed_color?, #rgb?, #rgba?, to_name, to_num

Constructor Details

#initialize(format: 0, h: 0, height: h, refresh_rate: 0, w: 0, width: w) ⇒ DisplayMode

Returns a new instance of DisplayMode.



3
4
5
6
7
8
9
# File 'lib/rb_sdl2/display_mode.rb', line 3

def initialize(format: 0, h: 0, height: h, refresh_rate: 0, w: 0, width: w)
  @st = ::SDL::DisplayMode.new
  @st[:format] = PixelFormatEnum.to_num(format)
  @st[:w] = width
  @st[:h] = height
  @st[:refresh_rate] = refresh_rate
end

Instance Method Details

#formatObject



11
# File 'lib/rb_sdl2/display_mode.rb', line 11

def format = @st[:format]

#heightObject Also known as: h



25
# File 'lib/rb_sdl2/display_mode.rb', line 25

def height = @st[:h]

#inspectObject



16
17
18
19
# File 'lib/rb_sdl2/display_mode.rb', line 16

def inspect
  "#<#{self.class.name} pixel_format_name=#{pixel_format_name} w=#{w} h=#{h}\
 refresh_rate=#{refresh_rate}>"
end

#refresh_rateObject



29
# File 'lib/rb_sdl2/display_mode.rb', line 29

def refresh_rate = @st[:refresh_rate]

#to_hObject



31
# File 'lib/rb_sdl2/display_mode.rb', line 31

def to_h = {format: format, w: w, h: h, refresh_rate: refresh_rate}

#to_ptrObject



33
# File 'lib/rb_sdl2/display_mode.rb', line 33

def to_ptr = @st.to_ptr

#widthObject Also known as: w



21
# File 'lib/rb_sdl2/display_mode.rb', line 21

def width = @st[:w]