summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2023-02-15 12:53:41 +0100
committerRay <[email protected]>2023-02-15 12:53:41 +0100
commit903d85e3233c9a8b1908bc2b9322e1251d100bbe (patch)
tree8754108b38abc0422de93992fb2177707f4c1510 /src
parent5dedb27ce01fc649b4b81b582418b31f4435da98 (diff)
downloadraylib-903d85e3233c9a8b1908bc2b9322e1251d100bbe.tar.gz
raylib-903d85e3233c9a8b1908bc2b9322e1251d100bbe.zip
Make sure window position always inits in the middle of the current monitor
Diffstat (limited to 'src')
-rw-r--r--src/rcore.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/rcore.c b/src/rcore.c
index d47aaab0..0c4691eb 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -849,6 +849,7 @@ void InitWindow(int width, int height, const char *title)
TRACELOG(LOG_FATAL, "Failed to initialize Graphic Device");
return;
}
+ else SetWindowPosition(GetMonitorWidth(GetCurrentMonitor())/2 - CORE.Window.screen.width/2, GetMonitorHeight(GetCurrentMonitor())/2 - CORE.Window.screen.height/2);
// Initialize hi-res timer
InitTimer();
@@ -923,10 +924,7 @@ void InitWindow(int width, int height, const char *title)
emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback);
#endif
- CORE.Input.Mouse.currentPosition.x = (float)CORE.Window.screen.width/2.0f;
- 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);
+ SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
#if defined(SUPPORT_EVENTS_AUTOMATION)
events = (AutomationEvent *)malloc(MAX_CODE_AUTOMATION_EVENTS*sizeof(AutomationEvent));