Feature: On desktop, center window on screen

This commit is contained in:
Ray San 2015-10-21 18:23:49 +02:00
parent 333fdf6b90
commit d218534fff

View file

@ -477,7 +477,7 @@ void BeginDrawing(void)
updateTime = currentTime - previousTime; updateTime = currentTime - previousTime;
previousTime = currentTime; previousTime = currentTime;
if (IsPosproShaderEnabled()) rlEnableFBO(); if (IsPosproShaderEnabled()) rlEnablePostproFBO();
rlClearScreenBuffers(); rlClearScreenBuffers();
@ -1050,7 +1050,19 @@ static void InitDisplay(int width, int height)
{ {
// No-fullscreen window creation // No-fullscreen window creation
window = glfwCreateWindow(screenWidth, screenHeight, windowTitle, NULL, NULL); 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; renderWidth = screenWidth;
renderHeight = screenHeight; renderHeight = screenHeight;
} }