Minor tweaks

This commit is contained in:
Ray 2025-03-21 17:07:55 +01:00
parent add4da8fb3
commit 266fba1111
3 changed files with 12 additions and 8 deletions

View file

@ -1741,7 +1741,7 @@ static void ErrorCallback(int error, const char *description)
} }
// GLFW3 WindowSize Callback, runs when window is resizedLastFrame // GLFW3 WindowSize Callback, runs when window is resizedLastFrame
// NOTE: Window resizing not allowed by default // NOTE: Window resizing not enabled by default, use SetConfigFlags()
static void WindowSizeCallback(GLFWwindow *window, int width, int height) static void WindowSizeCallback(GLFWwindow *window, int width, int height)
{ {
// Reset viewport and projection matrix for new size // Reset viewport and projection matrix for new size
@ -1756,15 +1756,19 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
// if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale // if we are doing automatic DPI scaling, then the "screen" size is divided by the window scale
if (IsWindowState(FLAG_WINDOW_HIGHDPI)) if (IsWindowState(FLAG_WINDOW_HIGHDPI))
{ {
width = (int)(width / GetWindowScaleDPI().x); width = (int)(width/GetWindowScaleDPI().x);
height = (int)(height / GetWindowScaleDPI().y); height = (int)(height/GetWindowScaleDPI().y);
} }
// Set render size
CORE.Window.render.width = width;
CORE.Window.render.height = height;
// Set current screen size // Set current screen size
CORE.Window.screen.width = width; CORE.Window.screen.width = width;
CORE.Window.screen.height = height; CORE.Window.screen.height = height;
// NOTE: Postprocessing texture is not scaled to new size // WARNING: If using a render texture, it is not scaled to new size
} }
static void WindowPosCallback(GLFWwindow* window, int x, int y) static void WindowPosCallback(GLFWwindow* window, int x, int y)
{ {

View file

@ -1119,7 +1119,7 @@ void BeginTextureMode(RenderTexture2D target)
//rlScalef(0.0f, -1.0f, 0.0f); // Flip Y-drawing (?) //rlScalef(0.0f, -1.0f, 0.0f); // Flip Y-drawing (?)
// Setup current width/height for proper aspect ratio // Setup current width/height for proper aspect ratio
// calculation when using BeginMode3D() // calculation when using BeginTextureMode()
CORE.Window.currentFbo.width = target.texture.width; CORE.Window.currentFbo.width = target.texture.width;
CORE.Window.currentFbo.height = target.texture.height; CORE.Window.currentFbo.height = target.texture.height;
CORE.Window.usingFbo = true; CORE.Window.usingFbo = true;

View file

@ -2239,7 +2239,7 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2
// NOTE: Based on http://jeffreythompson.org/collision-detection/poly-point.php // NOTE: Based on http://jeffreythompson.org/collision-detection/poly-point.php
bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount) bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount)
{ {
bool inside = false; bool collision = false;
if (pointCount > 2) if (pointCount > 2)
{ {
@ -2248,12 +2248,12 @@ bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCoun
if ((points[i].y > point.y) != (points[j].y > point.y) && if ((points[i].y > point.y) != (points[j].y > point.y) &&
(point.x < (points[j].x - points[i].x)*(point.y - points[i].y)/(points[j].y - points[i].y) + points[i].x)) (point.x < (points[j].x - points[i].x)*(point.y - points[i].y)/(points[j].y - points[i].y) + points[i].x))
{ {
inside = !inside; collision = !collision;
} }
} }
} }
return inside; return collision;
} }
// Check collision between two rectangles // Check collision between two rectangles