aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay San <raysan5@gmail.com>2015-10-21 18:23:49 +0200
committerRay San <raysan5@gmail.com>2015-10-21 18:23:49 +0200
commitd218534fffd2f163baa64a66cce8b6e5302f7a3b (patch)
treefe8b49027ed79a369bc678aa659b9c8753e245d4 /src
parent333fdf6b90507d3259c45df479fe9fe967f23703 (diff)
downloadraylib-d218534fffd2f163baa64a66cce8b6e5302f7a3b.tar.gz
raylib-d218534fffd2f163baa64a66cce8b6e5302f7a3b.zip
Feature: On desktop, center window on screen
Diffstat (limited to 'src')
-rw-r--r--src/core.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/core.c b/src/core.c
index 235a9637..47bce873 100644
--- a/src/core.c
+++ b/src/core.c
@@ -477,7 +477,7 @@ void BeginDrawing(void)
updateTime = currentTime - previousTime;
previousTime = currentTime;
- if (IsPosproShaderEnabled()) rlEnableFBO();
+ if (IsPosproShaderEnabled()) rlEnablePostproFBO();
rlClearScreenBuffers();
@@ -1050,7 +1050,19 @@ static void InitDisplay(int width, int height)
{
// No-fullscreen window creation
window = glfwCreateWindow(screenWidth, screenHeight, windowTitle, NULL, NULL);
-
+
+#if defined(PLATFORM_DESKTOP)
+ // Center window on screen
+ const GLFWvidmode *mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
+
+ int windowPosX = mode->width/2 - screenWidth/2;
+ int windowPosY = mode->height/2 - screenHeight/2;
+
+ if (windowPosX < 0) windowPosX = 0;
+ if (windowPosY < 0) windowPosY = 0;
+
+ glfwSetWindowPos(window, windowPosX, windowPosY);
+#endif
renderWidth = screenWidth;
renderHeight = screenHeight;
}