diff --git a/src/init.c b/src/init.c index 4c610311..0b11e7cf 100644 --- a/src/init.c +++ b/src/init.c @@ -50,9 +50,6 @@ #if defined(USE_SDL) #include #endif -#if defined(WIN32) && !defined(USE_SDL) && !defined(USE_SDL2) -#include -#endif #if defined (__MINT__) #include #endif @@ -1585,9 +1582,9 @@ void Set_all_video_modes(void) } #elif defined(WIN32) { - int width = GetSystemMetrics(SM_CXSCREEN); - int height = GetSystemMetrics(SM_CYSCREEN); - if (width > 0 && height > 0) + int width = 0; + int height = 0; + if (GFX2_GetScreenSize(&width, &height)) { Video_mode[Nb_video_modes].Width = width; Video_mode[Nb_video_modes].Height = height; diff --git a/src/screen.h b/src/screen.h index de0dfae6..34f82c27 100644 --- a/src/screen.h +++ b/src/screen.h @@ -89,4 +89,9 @@ void Define_icon(void); /// set (system) mouse cursor position void Set_mouse_position(void); +/** + * Get Screen dimensions + */ +int GFX2_GetScreenSize(int * width, int * height); + #endif // SCREEN_H_INCLUDED diff --git a/src/win32screen.c b/src/win32screen.c index 89ec3ad8..2665ab3a 100644 --- a/src/win32screen.c +++ b/src/win32screen.c @@ -693,3 +693,14 @@ void Set_mouse_position(void) GFX2_Log(GFX2_WARNING, "SetCursorPos(%ld, %ld) failed\n", pt.x, pt.y); } } + +int GFX2_GetScreenSize(int * width, int * height) +{ + if (width == NULL || height == NULL) + return 0; + + *width = GetSystemMetrics(SM_CXSCREEN); + *height = GetSystemMetrics(SM_CYSCREEN); + + return (*width > 0 && *height > 0); +}