VideoMode defines a video mode (width, height, bpp).
1 // Display the list of all the video modes available for fullscreen 2 auto modes = VideoMode.getFullscreenModes(); 3 for (size_t i = 0; i < modes.length; ++i) 4 { 5 VideoMode mode = modes[i]; 6 writeln("Mode #", i, ": ", 7 mode.width, "x", mode.height, " - ", 8 mode.bitsPerPixel, " bpp"); 9 } 10 * 11 // Create a window with the same pixel depth as the desktop 12 VideoMode desktop = VideoMode.getDesktopMode(); 13 window.create(VideoMode(1024, 768, desktop.bitsPerPixel), "DSFML window");
A video mode is defined by a width and a height (in pixels) and a depth (in bits per pixel). Video modes are used to setup windows ($(WINDOW_LINK)) at creation time. * The main usage of video modes is for fullscreen mode: indeed you must use one of the valid video modes allowed by the OS (which are defined by what the monitor and the graphics card support), otherwise your window creation will * $(U VideoMode) provides a static function for retrieving the list of all the video modes supported by the system: getFullscreenModes(). * A custom video mode can also be checked directly for fullscreen compatibility with its isValid() function. * Additionnally, $(U VideoMode) provides a static function to get the mode currently used by the desktop: getDesktopMode(). This allows to build windows with the same size or pixel depth as the current resolution. *