aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-02-13 17:39:38 +0100
committerraysan5 <raysan5@gmail.com>2016-02-13 17:39:38 +0100
commit30fafb77db920f165253cbd0c3a9e688fa5b93f3 (patch)
treedf33a438a4dc085ff31a7ed21985b97dd66732c5 /src
parented1906440560d5b6b6e2cb1c1927e53b28e302db (diff)
downloadraylib-30fafb77db920f165253cbd0c3a9e688fa5b93f3.tar.gz
raylib-30fafb77db920f165253cbd0c3a9e688fa5b93f3.zip
Updated fullscreen issue comment
Diffstat (limited to 'src')
-rw-r--r--src/core.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/core.c b/src/core.c
index cff90ba9..7ecedee0 100644
--- a/src/core.c
+++ b/src/core.c
@@ -470,6 +470,7 @@ bool IsWindowMinimized(void)
}
// Fullscreen toggle
+// TODO: When destroying window context is lost and resources too, take care!
void ToggleFullscreen(void)
{
#if defined(PLATFORM_DESKTOP)
@@ -1379,10 +1380,24 @@ static void InitDisplay(int width, int height)
if (fullscreen)
{
// At this point we need to manage render size vs screen size
- // NOTE: This function uses and modifies global module variables: screenWidth/screenHeight and renderWidth/renderHeight and downscaleView
+ // NOTE: This function uses and modifies global module variables:
+ // screenWidth/screenHeight - renderWidth/renderHeight - downscaleView
SetupFramebufferSize(displayWidth, displayHeight);
+
+ // TODO: SetupFramebufferSize() does not consider properly display video modes.
+ // It setups a renderWidth/renderHeight with black bars that could not match a valid video mode,
+ // and so, framebuffer is not scaled properly to some monitors.
+
+ int count;
+ const GLFWvidmode *modes = glfwGetVideoModes(glfwGetPrimaryMonitor(), &count);
+
+ for (int i = 0; i < count; i++)
+ {
+ // TODO: Check modes[i]->width;
+ // TODO: Check modes[i]->height;
+ }
- window = glfwCreateWindow(renderWidth, renderHeight, windowTitle, glfwGetPrimaryMonitor(), NULL);
+ window = glfwCreateWindow(screenWidth, screenHeight, windowTitle, glfwGetPrimaryMonitor(), NULL);
}
else
{
@@ -1391,10 +1406,8 @@ static void InitDisplay(int width, int height)
#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;
+ int windowPosX = displayWidth/2 - screenWidth/2;
+ int windowPosY = displayHeight/2 - screenHeight/2;
if (windowPosX < 0) windowPosX = 0;
if (windowPosY < 0) windowPosY = 0;
@@ -2402,6 +2415,10 @@ static void SwapBuffers(void)
// NOTE: Global variables renderWidth/renderHeight can be modified
static void SetupFramebufferSize(int displayWidth, int displayHeight)
{
+ // TODO: SetupFramebufferSize() does not consider properly display video modes.
+ // It setups a renderWidth/renderHeight with black bars that could not match a valid video mode,
+ // and so, framebuffer is not scaled properly to some monitors.
+
// Calculate renderWidth and renderHeight, we have the display size (input params) and the desired screen size (global var)
if ((screenWidth > displayWidth) || (screenHeight > displayHeight))
{