Game Development Reference
In-Depth Information
VideoMode
The VideoMode class contains information about the video mode of the window, such as
width, height, and bits per pixel. This last parameter is the number of bits used to represent
the color of a single pixel. It has a default value of 32, which is unlikely to change on re-
cent hardware. For example, a value of 8 would produce a monochrome result. If we want
to create a fullscreen window, the supplied values have to be supported by the machine's
monitor and graphics card. If we choose invalid arguments for a fullscreen window, the
window creation will simply fail. The validity of the VideoMode class can can be
checked with the VideoMode::isValid() method, which returns a boolean as the res-
ult.
If we need to create a window according to the size (or the pixel depth) of the desktop
mode, VideoMode::getDesktopMode() is available as a static method. On the other
hand, if we were to create a window in fullscreen mode, we might want to check the avail-
able resolutions with VideoMode::getFullScreenModes() . This returns
std::vector of video modes, and we can choose one of the modes ourselves, or let the
user decide which suits them best.
However, merely specifying fullscreen video mode is not enough to create a fullscreen win-
dow. We need to set a style as well.
Search WWH ::




Custom Search