Status of WinAPI backend and querying capabilities
What is the official status of the WinAPI video backend?
I've mostly ignored it in my PRs and the feature set continues to diverge. When new features are exposed in the options screen, users should be informed if selected options are ineffective or not able to select them in the first place.
Is it worth adding a GetCapabilities() function to IVideoDriver?
It could look something like this:
// Bitset details to be figured out separately
enum class DisplayMode : unsigned {
None,
Window = …,
NonResizableWindow = …,
Fullscreen = ...,
WindowedFullscreen = …
};
struct VideoDriverCapabilities {
DisplayMode displayMode{};
bool guiScale = false;
// someday maybe?
// bool copy;
// bool paste;
};
class IVideoDriver {
virtual VideoDriverCapabilities GetCapabilities() const = 0;
};
class VideoSDL2 {
VideoDriverCapabilities GetCapabilities() const override {
VideoDriverCapabilities cap{};
cap.displayMode = DisplayMode::Window | DisplayMode::NonResizableWindow | DisplayMode::Fullscreen | DisplayMode::WindowedFullscreen;
cap.guiScale = true;
return cap;
}
};
class VideoWinAPI {
VideoDriverCapabilities GetCapabilities() const override {
VideoDriverCapabilities cap{};
cap.displayMode = DisplayMode::Window | DisplayMode::Fullscreen;
return cap;
}
};
Further, to reduce duplication between dskOptions and iwSettings:
struct DisplayModeItem {
std::string text;
DisplayMode value;
};
std::vector<DisplayModeItem> displayModeItemsFromCapabilities(const VideoDriverCapabilities& cap);
The DisplayModeItems would then be used to populate a ComboBox and map the selection index to a DisplayMode value.
What is the official status of the WinAPI video backend?
Should be supported, since for a some people its working better than SDL
What is the official status of the WinAPI video backend?
Should be supported, since for a some people its working better than SDL
Ok, thanks! I've already looked into adding non-resizable windows, which is trivial. That leaves windowed fullscreen and GUI scaling. Support for GUI scaling can be detected without the proposed API and is already implemented in #1594. Maybe I'll just implement windowed fullscreen by copying it from Chromium (BSD-3-licensed, so that'll work).
We won't need a capability API for the time being.