Fixed some more fullscreen

There is still a slight offset. I need to practice maths I think
This commit is contained in:
Linus Probert 2018-08-30 09:12:05 +02:00
parent f9556cbf59
commit 5a8c1ece14
2 changed files with 15 additions and 6 deletions

View File

@ -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;
}
}

View File

@ -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})