diff options
author | bunnei <bunneidev@gmail.com> | 2018-04-21 19:53:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-21 19:53:55 +0200 |
commit | 62937798a0d298ca463486120d27a752fa798b68 (patch) | |
tree | 42ef6005d66a5c31ab002ceefdfdc1d16391dd67 /src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | |
parent | Merge pull request #376 from bunnei/shader-decoder (diff) | |
parent | SDL2: Implement fullscreen. (Original PR: citra-emu/citra#3607) (diff) | |
download | yuzu-62937798a0d298ca463486120d27a752fa798b68.tar yuzu-62937798a0d298ca463486120d27a752fa798b68.tar.gz yuzu-62937798a0d298ca463486120d27a752fa798b68.tar.bz2 yuzu-62937798a0d298ca463486120d27a752fa798b68.tar.lz yuzu-62937798a0d298ca463486120d27a752fa798b68.tar.xz yuzu-62937798a0d298ca463486120d27a752fa798b68.tar.zst yuzu-62937798a0d298ca463486120d27a752fa798b68.zip |
Diffstat (limited to 'src/yuzu_cmd/emu_window/emu_window_sdl2.cpp')
-rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 3d7cd06a4..36d40a9b5 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -56,7 +56,28 @@ void EmuWindow_SDL2::OnResize() { UpdateCurrentFramebufferLayout(width, height); } -EmuWindow_SDL2::EmuWindow_SDL2() { +void EmuWindow_SDL2::Fullscreen() { + if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN) == 0) { + return; + } + + NGLOG_ERROR(Frontend, "Fullscreening failed: {}", SDL_GetError()); + + // Try a different fullscreening method + NGLOG_INFO(Frontend, "Attempting to use borderless fullscreen..."); + if (SDL_SetWindowFullscreen(render_window, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) { + return; + } + + NGLOG_ERROR(Frontend, "Borderless fullscreening failed: {}", SDL_GetError()); + + // Fallback algorithm: Maximise window. + // Works on all systems (unless something is seriously wrong), so no fallback for this one. + NGLOG_INFO(Frontend, "Falling back on a maximised window..."); + SDL_MaximizeWindow(render_window); +} + +EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) { InputCommon::Init(); SDL_SetMainReady(); @@ -90,6 +111,10 @@ EmuWindow_SDL2::EmuWindow_SDL2() { exit(1); } + if (fullscreen) { + Fullscreen(); + } + gl_context = SDL_GL_CreateContext(render_window); if (gl_context == nullptr) { |