mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00
Add ToggleFullscreen
Add ToggleFullscreen for Window class.
This commit is contained in:
parent
7cfc30970b
commit
a4164f698e
@ -142,6 +142,14 @@ Window& Window::SetFullscreen(Uint32 flags) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
Window& Window::ToggleFullscreen() {
|
||||
Uint32 const fullscreenFlag = SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||
bool const isFullscreen = SDL_GetWindowFlags(mpWindow) & fullscreenFlag;
|
||||
if (SDL_SetWindowFullscreen(window_, isFullscreen ? SDL_FALSE : SDL_WINDOW_FULLSCREEN_DESKTOP) != 0)
|
||||
throw Exception("SDL_SetWindowFullscreen");
|
||||
return *this;
|
||||
}
|
||||
|
||||
Window& Window::SetSize(int w, int h) {
|
||||
SDL_SetWindowSize(window_, w, h);
|
||||
return *this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user