Fixed some more fullscreen
There is still a slight offset. I need to practice maths I think
This commit is contained in:
parent
a75a0d9331
commit
5dc25c1e79
|
@ -558,16 +558,19 @@ toggle_fullscreen(void)
|
||||||
settings->fullscreen_enabled = false;
|
settings->fullscreen_enabled = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int w, h;
|
int w, h, lw, lh;
|
||||||
|
SDL_RenderGetLogicalSize(gRenderer, &lw, &lh);
|
||||||
SDL_GetWindowSize(gWindow, &w, &h);
|
SDL_GetWindowSize(gWindow, &w, &h);
|
||||||
|
|
||||||
|
double lratio = w / lw;
|
||||||
|
|
||||||
SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
|
||||||
SDL_DisplayMode dMode;
|
SDL_DisplayMode dMode;
|
||||||
SDL_GetWindowDisplayMode(gWindow, &dMode);
|
SDL_GetWindowDisplayMode(gWindow, &dMode);
|
||||||
double ratio = (double) (dMode.w) / w;
|
double ratio = (double) (dMode.w) / w;
|
||||||
double offset = ((dMode.w - w) / 2);
|
double offset = ((dMode.w - w) / 2);
|
||||||
initViewports((Uint32)((offset)/(ratio*2)));
|
initViewports((Uint32)((offset)/(ratio*lratio)));
|
||||||
settings->fullscreen_enabled = true;
|
settings->fullscreen_enabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,16 @@ endif ()
|
||||||
|
|
||||||
include_directories(${STEAMWORKS_INCLUDE_DIR})
|
include_directories(${STEAMWORKS_INCLUDE_DIR})
|
||||||
|
|
||||||
add_library(steamworks_c_wrapper
|
if (WIN32)
|
||||||
|
add_library(steamworks_c_wrapper
|
||||||
|
src/steamworks_c_wrapper
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
add_library(steamworks_c_wrapper
|
||||||
SHARED
|
SHARED
|
||||||
src/steamworks_c_wrapper
|
src/steamworks_c_wrapper
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(steamworks_c_wrapper ${STEAMWORKS_LIBRARY})
|
target_link_libraries(steamworks_c_wrapper ${STEAMWORKS_LIBRARY})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue