Updated fullscreen issue comment
This commit is contained in:
parent
ed19064405
commit
30fafb77db
1 changed files with 23 additions and 6 deletions
29
src/core.c
29
src/core.c
|
@ -470,6 +470,7 @@ bool IsWindowMinimized(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fullscreen toggle
|
// Fullscreen toggle
|
||||||
|
// TODO: When destroying window context is lost and resources too, take care!
|
||||||
void ToggleFullscreen(void)
|
void ToggleFullscreen(void)
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
@ -1379,10 +1380,24 @@ static void InitDisplay(int width, int height)
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
{
|
{
|
||||||
// At this point we need to manage render size vs screen size
|
// 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);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -1391,10 +1406,8 @@ static void InitDisplay(int width, int height)
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
// Center window on screen
|
// Center window on screen
|
||||||
const GLFWvidmode *mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
int windowPosX = displayWidth/2 - screenWidth/2;
|
||||||
|
int windowPosY = displayHeight/2 - screenHeight/2;
|
||||||
int windowPosX = mode->width/2 - screenWidth/2;
|
|
||||||
int windowPosY = mode->height/2 - screenHeight/2;
|
|
||||||
|
|
||||||
if (windowPosX < 0) windowPosX = 0;
|
if (windowPosX < 0) windowPosX = 0;
|
||||||
if (windowPosY < 0) windowPosY = 0;
|
if (windowPosY < 0) windowPosY = 0;
|
||||||
|
@ -2402,6 +2415,10 @@ static void SwapBuffers(void)
|
||||||
// NOTE: Global variables renderWidth/renderHeight can be modified
|
// NOTE: Global variables renderWidth/renderHeight can be modified
|
||||||
static void SetupFramebufferSize(int displayWidth, int displayHeight)
|
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)
|
// Calculate renderWidth and renderHeight, we have the display size (input params) and the desired screen size (global var)
|
||||||
if ((screenWidth > displayWidth) || (screenHeight > displayHeight))
|
if ((screenWidth > displayWidth) || (screenHeight > displayHeight))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue