📅  最后修改于: 2023-12-03 14:47:25.862000             🧑  作者: Mango
sfVideoMode is a class in the CSFML Graphics module that represents a video mode, characterized by a width, a height and a depth (in bits per pixel). This class is used to define the resolution and bit-depth of the window in which the graphics will be rendered.
The constructor has three parameters: width, height, and depth. All of them are unsigned integers.
sfVideoMode mode = sfVideoMode(width, height, depth);
The sfVideoMode class also has three static functions which are used to retrieve the available video modes of a given computer.
This function returns a sfVideoMode object that represents the desktop video mode of the computer.
sfVideoMode desktopMode = sfVideoMode_getDesktopMode();
This function returns a pointer to an array of sfVideoMode objects that represent the available fullscreen video modes of the computer.
unsigned int count;
const sfVideoMode* fullscreenModes = sfVideoMode_getFullscreenModes(&count);
This function returns a sfVideoMode object that represents the best matching video mode for the given parameters. If no video mode matches those parameters, the function returns a default video mode.
sfVideoMode bestMode = sfVideoMode_getMode(width, height, depth);
The sfVideoMode class provides three accessors for the width, height and depth of the video mode:
unsigned int width = mode.width;
unsigned int height = mode.height;
unsigned int depth = mode.bitsPerPixel;
The sfVideoMode class is a simple but useful class for setting up the resolution and bit depth of your window/graphics context when using CSFML. The static methods for retrieving available video modes are particularly handy for creating fullscreen applications that adapt to the best matching video mode of the user's computer.