Class: RbSDL2::DisplayMode
- Inherits:
-
Object
- Object
- RbSDL2::DisplayMode
show all
- Includes:
- PixelFormatEnum
- Defined in:
- lib/rb_sdl2/display_mode.rb
Constant Summary
PixelFormatEnum::FORMAT_MAP, PixelFormatEnum::INDEXED_TYPES, PixelFormatEnum::WITH_ALPHA
Instance Method Summary
collapse
#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
11
|
# File 'lib/rb_sdl2/display_mode.rb', line 11
def format = @st[:format]
|
#height ⇒ Object
Also known as:
h
25
|
# File 'lib/rb_sdl2/display_mode.rb', line 25
def height = @st[:h]
|
#inspect ⇒ Object
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_rate ⇒ Object
29
|
# File 'lib/rb_sdl2/display_mode.rb', line 29
def refresh_rate = @st[:refresh_rate]
|
#to_h ⇒ Object
31
|
# File 'lib/rb_sdl2/display_mode.rb', line 31
def to_h = {format: format, w: w, h: h, refresh_rate: refresh_rate}
|
#to_ptr ⇒ Object
33
|
# File 'lib/rb_sdl2/display_mode.rb', line 33
def to_ptr = @st.to_ptr
|
#width ⇒ Object
Also known as:
w
21
|
# File 'lib/rb_sdl2/display_mode.rb', line 21
def width = @st[:w]
|