VideoMode defines a video mode (width, height, bpp) More...
#include <VideoMode.hpp>
Public Member Functions | |
VideoMode () | |
Default constructor. More... | |
VideoMode (unsigned int modeWidth, unsigned int modeHeight, unsigned int modeBitsPerPixel=32) | |
Construct the video mode with its attributes. More... | |
bool | isValid () const |
Tell whether or not the video mode is valid. More... | |
Static Public Member Functions | |
static VideoMode | getDesktopMode () |
Get the current desktop video mode. More... | |
static const std::vector < VideoMode > & | getFullscreenModes () |
Retrieve all the video modes supported in fullscreen mode. More... | |
Public Attributes | |
unsigned int | width |
Video mode width, in pixels. More... | |
unsigned int | height |
Video mode height, in pixels. More... | |
unsigned int | bitsPerPixel |
Video mode pixel depth, in bits per pixels. More... | |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const VideoMode &left, const VideoMode &right) |
Overload of == operator to compare two video modes. More... | |
bool | operator!= (const VideoMode &left, const VideoMode &right) |
Overload of != operator to compare two video modes. More... | |
bool | operator< (const VideoMode &left, const VideoMode &right) |
Overload of < operator to compare video modes. More... | |
bool | operator> (const VideoMode &left, const VideoMode &right) |
Overload of > operator to compare video modes. More... | |
bool | operator<= (const VideoMode &left, const VideoMode &right) |
Overload of <= operator to compare video modes. More... | |
bool | operator>= (const VideoMode &left, const VideoMode &right) |
Overload of >= operator to compare video modes. More... | |
VideoMode defines a video mode (width, height, bpp)
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 (sf::Window) 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 just fail.
sf::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.
Additionally, sf::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.
Usage example:
Definition at line 41 of file VideoMode.hpp.
sf::VideoMode::VideoMode | ( | ) |
Default constructor.
This constructors initializes all members to 0.
sf::VideoMode::VideoMode | ( | unsigned int | modeWidth, |
unsigned int | modeHeight, | ||
unsigned int | modeBitsPerPixel = 32 |
||
) |
Construct the video mode with its attributes.
modeWidth | Width in pixels |
modeHeight | Height in pixels |
modeBitsPerPixel | Pixel depths in bits per pixel |
|
static |
Get the current desktop video mode.
|
static |
Retrieve all the video modes supported in fullscreen mode.
When creating a fullscreen window, the video mode is restricted to be compatible with what the graphics driver and monitor support. This function returns the complete list of all video modes that can be used in fullscreen mode. The returned array is sorted from best to worst, so that the first element will always give the best mode (higher width, height and bits-per-pixel).
bool sf::VideoMode::isValid | ( | ) | const |
Tell whether or not the video mode is valid.
The validity of video modes is only relevant when using fullscreen windows; otherwise any video mode can be used with no restriction.
Overload of != operator to compare two video modes.
left | Left operand (a video mode) |
right | Right operand (a video mode) |
Overload of < operator to compare video modes.
left | Left operand (a video mode) |
right | Right operand (a video mode) |
Overload of <= operator to compare video modes.
left | Left operand (a video mode) |
right | Right operand (a video mode) |
Overload of == operator to compare two video modes.
left | Left operand (a video mode) |
right | Right operand (a video mode) |
Overload of > operator to compare video modes.
left | Left operand (a video mode) |
right | Right operand (a video mode) |
Overload of >= operator to compare video modes.
left | Left operand (a video mode) |
right | Right operand (a video mode) |
unsigned int sf::VideoMode::bitsPerPixel |
Video mode pixel depth, in bits per pixels.
Definition at line 104 of file VideoMode.hpp.
unsigned int sf::VideoMode::height |
Video mode height, in pixels.
Definition at line 103 of file VideoMode.hpp.
unsigned int sf::VideoMode::width |
Video mode width, in pixels.
Definition at line 102 of file VideoMode.hpp.