diff --git a/Core/Host.h b/Core/Host.h index fd15d74d68..45010d60c5 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -45,6 +45,7 @@ public: virtual void InitSound(PMixer *mixer) = 0; virtual void UpdateSound() {} virtual void UpdateScreen() {} + virtual void GoFullscreen(bool) {} virtual void ShutdownSound() = 0; virtual void PollControllers(InputState &input_state) {} diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 997f600686..14ef6e0415 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -136,7 +136,7 @@ void GameSettingsScreen::CreateViews() { // graphicsSettings->Add(new CheckBox(&g_Config.bTrueColor, gs->T("True Color"))); #ifdef _WIN32 graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gs->T("VSync"))); - graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen"))); + graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gs->T("FullScreen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange); #endif graphicsSettings->Add(new ItemHeader(gs->T("Antialiasing and postprocessing"))); @@ -305,6 +305,11 @@ UI::EventReturn GameSettingsScreen::OnRenderingMode(UI::EventParams &e) { return UI::EVENT_DONE; } +UI::EventReturn GameSettingsScreen::OnFullscreenChange(UI::EventParams &e) { + host->GoFullscreen(g_Config.bFullScreen); + return UI::EVENT_DONE; +} + UI::EventReturn GameSettingsScreen::OnResolutionChange(UI::EventParams &e) { if (gpu) { gpu->Resized(); diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 1e451cda08..75b71ab77d 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -63,6 +63,7 @@ private: UI::EventReturn OnChangeNickname(UI::EventParams &e); UI::EventReturn OnClearRecents(UI::EventParams &e); UI::EventReturn OnRenderingMode(UI::EventParams &e); + UI::EventReturn OnFullscreenChange(UI::EventParams &e); UI::EventReturn OnResolutionChange(UI::EventParams &e); UI::EventReturn OnRestoreDefaultSettings(UI::EventParams &e); diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index d5804858c3..201a59cb74 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -369,3 +369,10 @@ bool WindowsHost::CreateDesktopShortcut(std::string argumentPath, std::string ga delete [] pathbuf; return false; } + +void WindowsHost::GoFullscreen(bool viewFullscreen) { + if (viewFullscreen) + MainWindow::_ViewFullScreen(MainWindow::GetHWND()); + else + MainWindow::_ViewNormal(MainWindow::GetHWND()); +} diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h index 4cc0513bfb..a68f270038 100644 --- a/Windows/WindowsHost.h +++ b/Windows/WindowsHost.h @@ -66,6 +66,8 @@ public: virtual bool CanCreateShortcut() {return false;} // Turn on when fixed virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title); + virtual void GoFullscreen(bool); + bool InputBoxGetString(char *title, const char *defaultValue, char *outValue, size_t outlength); bool InputBoxGetWString(const wchar_t *title, const std::wstring &defaultvalue, std::wstring &outvalue); std::shared_ptr keyboard;