QcDisplayOptions Struct
How the game window shows and how often it draws (decision E-835): the window mode, the screen it covers, the window's place in windowed mode, VSync and the frame rate limits for playing and for menus, a paused game or a window in the background. More...
| Header: | #include <clientcore/settings/QcDisplayOptions.h> |
Public Types
| enum class | WindowMode { Windowed, Borderless, Fullscreen } |
Public Functions
| int | activeFrameLimit(bool foreground) const |
| void | save(QSettings &file) const |
| QcDisplayOptions::WindowMode | toggledFullscreen() const |
Public Variables
| int | backgroundFrameLimit |
| int | frameLimit |
| QcDisplayOptions::WindowMode | previousMode |
| QString | screen |
| bool | vsync |
| QRect | windowGeometry |
| QcDisplayOptions::WindowMode | windowMode |
Static Public Members
| const int | defaultBackgroundFrameLimit |
| const int | defaultFrameLimit |
| const std::array<int, 6> | frameLimits |
| bool | isFrameLimit(int framesPerSecond) |
| QcDisplayOptions | load(const QSettings &file) |
| QcDisplayOptions | load(const QString &path) |
| std::optional<QcDisplayOptions::WindowMode> | modeFromName(QStringView name) |
| QString | modeName(QcDisplayOptions::WindowMode mode) |
| std::optional<qsizetype> | screenIndex(const QStringList &names, const QString &name) |
| QRect | windowedFrame(QRect stored, QRect available, QSize defaultSize, QMargins frameMargins = {}) |
Detailed Description
Stored in settings.ini as display/<key> and read before the window opens. Values that make no sense give the default, with a warning.
Member Type Documentation
enum class QcDisplayOptions::WindowMode
A window with frame, a frameless window covering its screen, or the platform's fullscreen (on macOS a fullscreen space of its own).
| Constant | Value | Description |
|---|---|---|
QcDisplayOptions::WindowMode::Windowed | 0 | a window with frame |
QcDisplayOptions::WindowMode::Borderless | 1 | a frameless window covering its screen |
QcDisplayOptions::WindowMode::Fullscreen | 2 | the platform's fullscreen |
Member Function Documentation
int QcDisplayOptions::activeFrameLimit(bool foreground) const
Returns the limit in force: frameLimit while playing in the foreground, else the lower of both (0 counts as no limit).
[static] bool QcDisplayOptions::isFrameLimit(int framesPerSecond)
Returns whether framesPerSecond is one of frameLimits.
[static] QcDisplayOptions QcDisplayOptions::load(const QSettings &file)
Returns the options stored in file; defaults for values that make no sense.
[static] QcDisplayOptions QcDisplayOptions::load(const QString &path)
Returns the file at path; missing or unreadable: the defaults.
[static] std::optional<QcDisplayOptions::WindowMode> QcDisplayOptions::modeFromName(QStringView name)
Returns the mode named name (modeName()); nothing for an unknown name.
[static] QString QcDisplayOptions::modeName(QcDisplayOptions::WindowMode mode)
Returns the name of mode in settings.ini: "windowed", "borderless" or "fullscreen".
void QcDisplayOptions::save(QSettings &file) const
Stores the options in file.
[static] std::optional<qsizetype> QcDisplayOptions::screenIndex(const QStringList &names, const QString &name)
Returns the index of the screen called name among names; empty name: std::nullopt (the caller takes the primary screen), unknown names too.
QcDisplayOptions::WindowMode QcDisplayOptions::toggledFullscreen() const
Returns the mode F11 switches to: fullscreen, or back to the mode before it (F11).
[static] QRect QcDisplayOptions::windowedFrame(QRect stored, QRect available, QSize defaultSize, QMargins frameMargins = {})
Returns where a windowed window goes on a screen with the available area: the stored frame when its centre lies on the screen, else defaultSize centred. The frames are client areas; frameMargins (title bar and border, QWindow::frameMargins) stay inside the available area too, so the title bar can still be grabbed: the frame is shrunk and moved to fit.
Member Variable Documentation
int QcDisplayOptions::backgroundFrameLimit
Most frames per second in the menus, while paused and while the window is in the background; never more than frameLimit. 0 is no limit beyond frameLimit.
const int QcDisplayOptions::defaultBackgroundFrameLimit
The limit in the menus and in the background of new settings.
const int QcDisplayOptions::defaultFrameLimit
The limit while playing of new settings: none.
int QcDisplayOptions::frameLimit
Most frames per second while playing; 0 is no limit (with VSync: the display's rate).
const std::array<int, 6> QcDisplayOptions::frameLimits
Frame rate limits on offer, frames per second; 0 is no limit.
QcDisplayOptions::WindowMode QcDisplayOptions::previousMode
The mode F11 returns to from fullscreen (windowed or borderless).
QString QcDisplayOptions::screen
Name of the screen (QScreen::name); empty: the primary screen.
bool QcDisplayOptions::vsync
Swap interval 1; takes effect when the window is made (the next start).
QRect QcDisplayOptions::windowGeometry
The window's frame in windowed mode, in virtual desktop coordinates; empty: centred on the screen in its default size.
QcDisplayOptions::WindowMode QcDisplayOptions::windowMode
Windowed, borderless or fullscreen.