Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status of WinAPI backend and querying capabilities #1615

Open
falbrechtskirchinger opened this issue Jul 26, 2023 · 2 comments · May be fixed by #1602
Open

Status of WinAPI backend and querying capabilities #1615

falbrechtskirchinger opened this issue Jul 26, 2023 · 2 comments · May be fixed by #1602
Assignees

Comments

@falbrechtskirchinger
Copy link
Contributor

falbrechtskirchinger commented Jul 26, 2023

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.

@Flow86
Copy link
Member

Flow86 commented Jul 28, 2023

What is the official status of the WinAPI video backend?

Should be supported, since for a some people its working better than SDL

@falbrechtskirchinger
Copy link
Contributor Author

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.

@falbrechtskirchinger falbrechtskirchinger linked a pull request Jul 29, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants