Class: SDL2::Display::Mode
- Inherits:
-
Object
- Object
- SDL2::Display::Mode
- Defined in:
- ext/sdl2_ext/video.c,
ext/sdl2_ext/video.c
Overview
This class represents the display mode.
An object of this class has information about color depth, refresh rate, and resolution of a display.
Instance Method Summary collapse
-
#format ⇒ SDL2::PixelFormat
The pixel format of the display mode.
-
#h ⇒ Integer
The height of the screen of the display mode.
-
#initialize(format, w, h, refresh_rate) ⇒ Object
constructor
Create a new Display::Mode object.
-
#inspect ⇒ String
Inspection string.
-
#refresh_rate ⇒ Integer
The refresh rate of the display mode.
-
#w ⇒ Integer
The width of the screen of the display mode.
Constructor Details
#initialize(format, w, h, refresh_rate) ⇒ Object
1127 1128 1129 1130 1131 1132 1133 1134 1135 |
# File 'ext/sdl2_ext/video.c', line 1127
static VALUE DisplayMode_initialize(VALUE self, VALUE format, VALUE w, VALUE h,
VALUE refresh_rate)
{
SDL_DisplayMode* mode = Get_SDL_DisplayMode(self);
mode->format = uint32_for_format(format);
mode->w = NUM2INT(w); mode->h = NUM2INT(h);
mode->refresh_rate = NUM2INT(refresh_rate);
return Qnil;
}
|
Instance Method Details
#format ⇒ SDL2::PixelFormat
Returns the pixel format of the display mode.
1148 1149 1150 1151 |
# File 'ext/sdl2_ext/video.c', line 1148
static VALUE DisplayMode_format(VALUE self)
{
return PixelFormat_new(Get_SDL_DisplayMode(self)->format);
}
|
#h ⇒ Integer
Returns the height of the screen of the display mode.
1160 1161 1162 1163 |
# File 'ext/sdl2_ext/video.c', line 1160
static VALUE DisplayMode_h(VALUE self)
{
return INT2NUM(Get_SDL_DisplayMode(self)->h);
}
|
#inspect ⇒ String
Returns inspection string.
1138 1139 1140 1141 1142 1143 1144 1145 |
# File 'ext/sdl2_ext/video.c', line 1138
static VALUE DisplayMode_inspect(VALUE self)
{
SDL_DisplayMode* mode = Get_SDL_DisplayMode(self);
return rb_sprintf("<%s: format=%s w=%d h=%d refresh_rate=%d>",
rb_obj_classname(self), SDL_GetPixelFormatName(mode->format),
mode->w, mode->h, mode->refresh_rate);
}
|
#refresh_rate ⇒ Integer
Returns the refresh rate of the display mode.
1166 1167 1168 1169 |
# File 'ext/sdl2_ext/video.c', line 1166
static VALUE DisplayMode_refresh_rate(VALUE self)
{
return INT2NUM(Get_SDL_DisplayMode(self)->refresh_rate);
}
|
#w ⇒ Integer
Returns the width of the screen of the display mode.
1154 1155 1156 1157 |
# File 'ext/sdl2_ext/video.c', line 1154
static VALUE DisplayMode_w(VALUE self)
{
return INT2NUM(Get_SDL_DisplayMode(self)->w);
}
|