From 561031b42185cff56fee8c7a59fea5654bac7bb7 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 20 Mar 2022 13:27:11 -0400 Subject: fixed fullscreen mode on windows --- src/renderer.cpp | 19 ++++++++++++++----- src/renderer.h | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/renderer.cpp b/src/renderer.cpp index 09bddc9..5d6ac08 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -33,6 +33,15 @@ Renderer::Renderer() throw sdl_error(); } + loadAllTextures(); + + font_ = font_ptr(TTF_OpenFont(Runtime::getResourcePath("softsquare.ttf").c_str(), 45)); + if (!font_) { + throw ttf_error(); + } +} + +void Renderer::loadAllTextures() { texture_ptr origFade; loadTextureFromFile("lighting.png", origFade); @@ -120,11 +129,6 @@ Renderer::Renderer() loadTextureFromFile("title3.png", titles_[2]); SDL_QueryTexture(titles_[2].get(), nullptr, nullptr, &titleWidths_[2], &titleHeights_[2]); - - font_ = font_ptr(TTF_OpenFont(Runtime::getResourcePath("softsquare.ttf").c_str(), 45)); - if (!font_) { - throw ttf_error(); - } } void Renderer::renderGame( @@ -689,4 +693,9 @@ void Renderer::toggleFullscreen() { } else { SDL_SetWindowFullscreen(win_.get(), 0); } + +#ifdef MSVC + loadAllTextures(); + menu_.reset(); +#endif } diff --git a/src/renderer.h b/src/renderer.h index 8a74c3c..f650736 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -170,6 +170,7 @@ public: private: void loadTextureFromFile(std::string_view path, texture_ptr& texture); + void loadAllTextures(); sdl_wrapper sdl_; img_wrapper img_; -- cgit 1.4.1