Make sure window position always inits in the middle of the current monitor

This commit is contained in:
Ray 2023-02-15 12:53:41 +01:00
parent 5dedb27ce0
commit 903d85e323

View file

@ -849,6 +849,7 @@ void InitWindow(int width, int height, const char *title)
TRACELOG(LOG_FATAL, "Failed to initialize Graphic Device"); TRACELOG(LOG_FATAL, "Failed to initialize Graphic Device");
return; return;
} }
else SetWindowPosition(GetMonitorWidth(GetCurrentMonitor())/2 - CORE.Window.screen.width/2, GetMonitorHeight(GetCurrentMonitor())/2 - CORE.Window.screen.height/2);
// Initialize hi-res timer // Initialize hi-res timer
InitTimer(); InitTimer();
@ -923,10 +924,7 @@ void InitWindow(int width, int height, const char *title)
emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback); emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback);
#endif #endif
CORE.Input.Mouse.currentPosition.x = (float)CORE.Window.screen.width/2.0f; SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
CORE.Input.Mouse.currentPosition.y = (float)CORE.Window.screen.height/2.0f;
SetMousePosition((int)CORE.Input.Mouse.currentPosition.x, (int)CORE.Input.Mouse.currentPosition.x);
#if defined(SUPPORT_EVENTS_AUTOMATION) #if defined(SUPPORT_EVENTS_AUTOMATION)
events = (AutomationEvent *)malloc(MAX_CODE_AUTOMATION_EVENTS*sizeof(AutomationEvent)); events = (AutomationEvent *)malloc(MAX_CODE_AUTOMATION_EVENTS*sizeof(AutomationEvent));