From 5dc25c1e7997dad37a08930bf2c2f578c40ed8f1 Mon Sep 17 00:00:00 2001 From: Linus Probert Date: Thu, 30 Aug 2018 09:12:05 +0200 Subject: [PATCH] Fixed some more fullscreen There is still a slight offset. I need to practice maths I think --- src/main.c | 7 +++++-- steamworks_c_wrapper/CMakeLists.txt | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index 0f682e8..3aeda2d 100644 --- a/src/main.c +++ b/src/main.c @@ -558,16 +558,19 @@ toggle_fullscreen(void) settings->fullscreen_enabled = false; } else { - int w, h; + int w, h, lw, lh; + SDL_RenderGetLogicalSize(gRenderer, &lw, &lh); SDL_GetWindowSize(gWindow, &w, &h); + double lratio = w / lw; + SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_FULLSCREEN_DESKTOP); SDL_DisplayMode dMode; SDL_GetWindowDisplayMode(gWindow, &dMode); double ratio = (double) (dMode.w) / w; double offset = ((dMode.w - w) / 2); - initViewports((Uint32)((offset)/(ratio*2))); + initViewports((Uint32)((offset)/(ratio*lratio))); settings->fullscreen_enabled = true; } } diff --git a/steamworks_c_wrapper/CMakeLists.txt b/steamworks_c_wrapper/CMakeLists.txt index acf2d8a..4199e59 100644 --- a/steamworks_c_wrapper/CMakeLists.txt +++ b/steamworks_c_wrapper/CMakeLists.txt @@ -25,10 +25,16 @@ endif () include_directories(${STEAMWORKS_INCLUDE_DIR}) -add_library(steamworks_c_wrapper - SHARED - src/steamworks_c_wrapper - ) +if (WIN32) + add_library(steamworks_c_wrapper + src/steamworks_c_wrapper + ) +else () + add_library(steamworks_c_wrapper + SHARED + src/steamworks_c_wrapper + ) +endif() target_link_libraries(steamworks_c_wrapper ${STEAMWORKS_LIBRARY})