Class: SDL2::Display::Mode
- Inherits:
-
Object
- Object
- SDL2::Display::Mode
- Defined in:
- video.c,
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.
-
#initialze(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
#initialze(format, w, h, refresh_rate) ⇒ Object
1112 1113 1114 1115 1116 1117 1118 1119 1120 |
# File 'video.c', line 1112
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
1133 1134 1135 1136 |
# File 'video.c', line 1133
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
1145 1146 1147 1148 |
# File 'video.c', line 1145
static VALUE DisplayMode_h(VALUE self)
{
return INT2NUM(Get_SDL_DisplayMode(self)->h);
}
|
#inspect ⇒ String
Returns inspection string
1123 1124 1125 1126 1127 1128 1129 1130 |
# File 'video.c', line 1123
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
1151 1152 1153 1154 |
# File 'video.c', line 1151
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
1139 1140 1141 1142 |
# File 'video.c', line 1139
static VALUE DisplayMode_w(VALUE self)
{
return INT2NUM(Get_SDL_DisplayMode(self)->w);
}
|