Browse Source

Minor tweaks

pull/4850/head
Ray 1 week ago
parent
commit
266fba1111
3 changed files with 12 additions and 8 deletions
  1. +8
    -4
      src/platforms/rcore_desktop_glfw.c
  2. +1
    -1
      src/rcore.c
  3. +3
    -3
      src/rshapes.c

+ 8
- 4
src/platforms/rcore_desktop_glfw.c View File

@ -1741,7 +1741,7 @@ static void ErrorCallback(int error, const char *description)
}
// 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)
{
// 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 (IsWindowState(FLAG_WINDOW_HIGHDPI))
{
width = (int)(width / GetWindowScaleDPI().x);
height = (int)(height / GetWindowScaleDPI().y);
width = (int)(width/GetWindowScaleDPI().x);
height = (int)(height/GetWindowScaleDPI().y);
}
// Set render size
CORE.Window.render.width = width;
CORE.Window.render.height = height;
// Set current screen size
CORE.Window.screen.width = width;
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)
{

+ 1
- 1
src/rcore.c View File

@ -1119,7 +1119,7 @@ void BeginTextureMode(RenderTexture2D target)
//rlScalef(0.0f, -1.0f, 0.0f); // Flip Y-drawing (?)
// 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.height = target.texture.height;
CORE.Window.usingFbo = true;

+ 3
- 3
src/rshapes.c 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
bool CheckCollisionPointPoly(Vector2 point, const Vector2 *points, int pointCount)
{
bool inside = false;
bool collision = false;
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) &&
(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

Loading…
Cancel
Save