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); 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 diff --git a/src/rcore.c b/src/rcore.c index 068e79dc3..0d049685e 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1989,8 +1989,6 @@ const char *GetClipboardText(void) return NULL; } - - // Show mouse cursor void ShowCursor(void) { @@ -4173,6 +4171,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) @@ -5520,6 +5520,10 @@ 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 (((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)) { 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];