From ea87491a82a0fc778056d1538d37ec851e8e0fbe Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 25 Sep 2022 00:14:59 +0200 Subject: [PATCH 1/5] ADDED: Support CAPS/NUM lock keys registering if locked --- src/rcore.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rcore.c b/src/rcore.c index 490ac4a10..214b9509b 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -4136,6 +4136,8 @@ static bool InitGraphicsDevice(int width, int height) glfwSetScrollCallback(CORE.Window.handle, MouseScrollCallback); glfwSetCursorEnterCallback(CORE.Window.handle, CursorEnterCallback); + glfwSetInputMode(CORE.Window.handle, GLFW_LOCK_KEY_MODS, GLFW_TRUE); // Enable lock keys modifiers (CAPS, NUM) + glfwMakeContextCurrent(CORE.Window.handle); #if !defined(PLATFORM_WEB) @@ -5267,6 +5269,9 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i if (action == GLFW_RELEASE) CORE.Input.Keyboard.currentKeyState[key] = 0; else CORE.Input.Keyboard.currentKeyState[key] = 1; + // WARNING: Check if CAPS/NUM key modifiers are enabled and force down state for those keys + if (((mods & GLFW_MOD_CAPS_LOCK) > 0) || ((mods & GLFW_MOD_NUM_LOCK) > 0)) CORE.Input.Keyboard.currentKeyState[key] = 1; + // Check if there is space available in the key queue if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS)) { From 2ef0b064e50279f84531fd265990f29327775dbf Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 25 Sep 2022 14:09:28 +0200 Subject: [PATCH 2/5] Fix isssue #2718 --- src/rcore.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index 214b9509b..c7986dfb7 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1952,8 +1952,6 @@ const char *GetClipboardText(void) return NULL; } - - // Show mouse cursor void ShowCursor(void) { @@ -5270,7 +5268,8 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i else CORE.Input.Keyboard.currentKeyState[key] = 1; // WARNING: Check if CAPS/NUM key modifiers are enabled and force down state for those keys - if (((mods & GLFW_MOD_CAPS_LOCK) > 0) || ((mods & GLFW_MOD_NUM_LOCK) > 0)) CORE.Input.Keyboard.currentKeyState[key] = 1; + if (((key == KEY_CAPS_LOCK) && ((mods & GLFW_MOD_CAPS_LOCK) > 0)) || + ((key == KEY_NUM_LOCK) && ((mods & GLFW_MOD_NUM_LOCK) > 0))) CORE.Input.Keyboard.currentKeyState[key] = 1; // Check if there is space available in the key queue if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS)) From 7ab056b6efb0764967c80439c15eed828b6ae1c4 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 25 Sep 2022 15:41:49 +0200 Subject: [PATCH 3/5] REVIEWED: `GeneshHeightmap()`, fix #2716 --- src/rmodels.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rmodels.c b/src/rmodels.c index cb6551eb7..342ba33b6 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -2630,7 +2630,7 @@ Mesh GenMeshKnot(float radius, float size, int radSeg, int sides) // NOTE: Vertex data is uploaded to GPU Mesh GenMeshHeightmap(Image heightmap, Vector3 size) { - #define GRAY_VALUE(c) ((c.r+c.g+c.b)/3.0f) + #define GRAY_VALUE(c) ((float)(c.r + c.g + c.b)/3.0f) Mesh mesh = { 0 }; @@ -2640,7 +2640,7 @@ Mesh GenMeshHeightmap(Image heightmap, Vector3 size) Color *pixels = LoadImageColors(heightmap); // NOTE: One vertex per pixel - mesh.triangleCount = (mapX-1)*(mapZ-1)*2; // One quad every four pixels + mesh.triangleCount = (mapX - 1)*(mapZ - 1)*2; // One quad every four pixels mesh.vertexCount = mesh.triangleCount*3; @@ -2653,7 +2653,7 @@ Mesh GenMeshHeightmap(Image heightmap, Vector3 size) int tcCounter = 0; // Used to count texcoords float by float int nCounter = 0; // Used to count normals float by float - Vector3 scaleFactor = { size.x/mapX, size.y/255.0f, size.z/mapZ }; + Vector3 scaleFactor = { size.x/(mapX - 1), size.y/255.0f, size.z/(mapZ - 1) }; Vector3 vA = { 0 }; Vector3 vB = { 0 }; @@ -2680,7 +2680,7 @@ Mesh GenMeshHeightmap(Image heightmap, Vector3 size) mesh.vertices[vCounter + 7] = GRAY_VALUE(pixels[(x + 1) + z*mapX])*scaleFactor.y; mesh.vertices[vCounter + 8] = (float)z*scaleFactor.z; - // another triangle - 3 vertex + // Another triangle - 3 vertex mesh.vertices[vCounter + 9] = mesh.vertices[vCounter + 6]; mesh.vertices[vCounter + 10] = mesh.vertices[vCounter + 7]; mesh.vertices[vCounter + 11] = mesh.vertices[vCounter + 8]; From e9ca38fafa603cf146e385456e9ccfcb6f15df70 Mon Sep 17 00:00:00 2001 From: bXi Date: Mon, 26 Sep 2022 12:24:10 +0200 Subject: [PATCH 4/5] Clarified working of ImageDrawCircle and ImageDrawCircleV (#2719) --- src/raylib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index 84a18ebe2..df59ffefa 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1285,8 +1285,8 @@ RLAPI void ImageDrawPixel(Image *dst, int posX, int posY, Color color); RLAPI void ImageDrawPixelV(Image *dst, Vector2 position, Color color); // Draw pixel within an image (Vector version) RLAPI void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color); // Draw line within an image RLAPI void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color); // Draw line within an image (Vector version) -RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle within an image -RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw circle within an image (Vector version) +RLAPI void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color); // Draw a filled circle within an image +RLAPI void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color); // Draw a filled circle within an image (Vector version) RLAPI void ImageDrawCircleLines(Image *dst, int centerX, int centerY, int radius, Color color); // Draw circle outline within an image RLAPI void ImageDrawCircleLinesV(Image *dst, Vector2 center, int radius, Color color); // Draw circle outline within an image (Vector version) RLAPI void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color); // Draw rectangle within an image From 8f88c61bdfe1e6e009dd6f182bc7a2f5c8b38f15 Mon Sep 17 00:00:00 2001 From: Michael Scherbakow Date: Tue, 27 Sep 2022 01:27:22 +0200 Subject: [PATCH 5/5] update build.zig (#2720) zig `master` now enforces to use addIncludePath instead of addIncludeDir --- src/build.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build.zig b/src/build.zig index 7834ab249..44a3c1714 100644 --- a/src/build.zig +++ b/src/build.zig @@ -17,7 +17,7 @@ pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build. raylib.setBuildMode(mode); raylib.linkLibC(); - raylib.addIncludeDir(srcdir ++ "/external/glfw/include"); + raylib.addIncludePath(srcdir ++ "/external/glfw/include"); raylib.addCSourceFiles(&.{ srcdir ++ "/raudio.c", @@ -35,7 +35,7 @@ pub fn addRaylib(b: *std.build.Builder, target: std.zig.CrossTarget) *std.build. raylib.linkSystemLibrary("winmm"); raylib.linkSystemLibrary("gdi32"); raylib.linkSystemLibrary("opengl32"); - raylib.addIncludeDir("external/glfw/deps/mingw"); + raylib.addIncludePath("external/glfw/deps/mingw"); }, .linux => { raylib.addCSourceFiles(&.{srcdir ++ "/rglfw.c"}, raylib_flags);