@@ -1067,20 +1067,12 @@ void XINTERFACE::LoadIni()
10671067 if (!ini)
10681068 throw std::runtime_error (" ini file not found!" );
10691069
1070- int sdlScreenWidth, sdlScreenHeight;
1071- #ifdef _WIN32 // FIX_LINUX GetWindowRect
1072- RECT Screen_Rect;
1073- GetWindowRect (static_cast <HWND>(core.GetWindow ()->OSHandle ()), &Screen_Rect);
1074- sdlScreenWidth = Screen_Rect.right - Screen_Rect.left ;
1075- sdlScreenHeight = Screen_Rect.bottom - Screen_Rect.top ;
1076- #else
1077- SDL_GetWindowSize (reinterpret_cast <SDL_Window *>(core.GetWindow ()->OSHandle ()), &sdlScreenWidth, &sdlScreenHeight);
1078- #endif
1070+ auto windowSize = core.GetWindow ()->GetWindowSize ();
10791071
10801072 fScale = 1 .0f ;
10811073 const auto screenSize = core.GetScreenSize ();
10821074 dwScreenHeight = screenSize.height ;
1083- dwScreenWidth = sdlScreenWidth * dwScreenHeight / sdlScreenHeight ;
1075+ dwScreenWidth = windowSize. width * dwScreenHeight / windowSize. height ;
10841076 if (dwScreenWidth < screenSize.width )
10851077 dwScreenWidth = screenSize.width ;
10861078 GlobalScreenRect.top = 0 ;
@@ -1092,7 +1084,7 @@ void XINTERFACE::LoadIni()
10921084 bool sectionFound = false ;
10931085 if (ini->GetSectionName (platform, sizeof (platform) - 1 ))
10941086 {
1095- float windowRatio = (float )sdlScreenWidth / (float )sdlScreenHeight ;
1087+ float windowRatio = (float )windowSize. width / (float )windowSize. height ;
10961088 float iniRatio;
10971089 char splitPlatform[23 ], *platformW, *platformH;
10981090 do
@@ -1163,13 +1155,7 @@ void XINTERFACE::LoadIni()
11631155 sscanf (param, " %[^,],%d,size:(%d,%d),pos:(%d,%d)" , param2, &m_lMouseSensitive, &MouseSize.x , &MouseSize.y ,
11641156 &m_lXMouse, &m_lYMouse);
11651157 m_idTex = pRenderService->TextureCreate (param2);
1166- // RECT Screen_Rect;
1167- // GetWindowRect(core.GetAppHWND(), &Screen_Rect);
1168- #ifdef _WIN32 // FIX_LINUX Cursor
1169- lock_x = Screen_Rect.left + (Screen_Rect.right - Screen_Rect.left ) / 2 ;
1170- lock_y = Screen_Rect.top + (Screen_Rect.bottom - Screen_Rect.top ) / 2 ;
1171- SetCursorPos (lock_x, lock_y);
1172- #endif
1158+ core.GetWindow ()->WarpMouseInWindow (windowSize.width / 2 , windowSize.height / 2 );
11731159 fXMousePos = static_cast <float >(dwScreenWidth / 2 );
11741160 fYMousePos = static_cast <float >(dwScreenHeight / 2 );
11751161 for (int i = 0 ; i < 4 ; i++)
0 commit comments