Improved windows resizing system...
...despite not being enabled on GLFW3
This commit is contained in:
parent
5e45c3c824
commit
ebc2b9a286
2 changed files with 19 additions and 13 deletions
17
src/core.c
17
src/core.c
|
@ -1488,11 +1488,11 @@ static void InitDisplay(int width, int height)
|
|||
TraceLog(INFO, "Viewport offsets: %i, %i", renderOffsetX, renderOffsetY);
|
||||
}
|
||||
|
||||
glfwSetWindowSizeCallback(window, WindowSizeCallback);
|
||||
glfwSetWindowSizeCallback(window, WindowSizeCallback); // NOTE: Resizing not allowed by default!
|
||||
glfwSetCursorEnterCallback(window, CursorEnterCallback);
|
||||
glfwSetKeyCallback(window, KeyCallback);
|
||||
glfwSetMouseButtonCallback(window, MouseButtonCallback);
|
||||
glfwSetCursorPosCallback(window, MouseCursorPosCallback); // Track mouse position changes
|
||||
glfwSetCursorPosCallback(window, MouseCursorPosCallback); // Track mouse position changes
|
||||
glfwSetCharCallback(window, CharCallback);
|
||||
glfwSetScrollCallback(window, ScrollCallback);
|
||||
glfwSetWindowIconifyCallback(window, WindowIconifyCallback);
|
||||
|
@ -1818,16 +1818,19 @@ static void CursorEnterCallback(GLFWwindow *window, int enter)
|
|||
}
|
||||
|
||||
// GLFW3 WindowSize Callback, runs when window is resized
|
||||
// NOTE: Window resizing not allowed by default
|
||||
static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
||||
{
|
||||
// If window is resized, graphics device is re-initialized (but only ortho mode)
|
||||
rlglInitGraphics(renderOffsetX, renderOffsetY, renderWidth, renderHeight);
|
||||
rlglInitGraphics(0, 0, width, height);
|
||||
|
||||
// Window size must be updated to be used on 3D mode to get new aspect ratio (Begin3dMode())
|
||||
//screenWidth = width;
|
||||
//screenHeight = height;
|
||||
|
||||
// TODO: Update render size?
|
||||
screenWidth = width;
|
||||
screenHeight = height;
|
||||
renderWidth = width;
|
||||
renderHeight = height;
|
||||
|
||||
// NOTE: Postprocessing texture is not scaled to new size
|
||||
|
||||
// Background must be also re-cleared
|
||||
ClearBackground(RAYWHITE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue