From 1d8b8c686167aed0bffa6cd35df590da70e6de6a Mon Sep 17 00:00:00 2001 From: Antonis Geralis Date: Tue, 21 May 2024 19:13:42 +0300 Subject: [PATCH] update --- src/raylib.nim | 4 ++-- src/raylib/rmodels.c | 2 +- src/raylib/rtextures.c | 4 +--- tools/raylib_wrap.nim | 2 +- update_bindings.nims | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/raylib.nim b/src/raylib.nim index ce77105..1d55ce6 100644 --- a/src/raylib.nim +++ b/src/raylib.nim @@ -2,7 +2,7 @@ from std/strutils import addf, toHex from std/unicode import Rune from std/syncio import writeFile import std/[assertions, paths] -const raylibDir = currentSourcePath().Path.parentDir / Path"raylib" +const raylibDir = Path"/home/antonisg/Code/raydev/naylib/src/raylib" {.passC: "-I" & raylibDir.string.} {.passC: "-I" & string(raylibDir / Path"external/glfw/include").} @@ -2339,7 +2339,7 @@ proc fade*(color: Color, alpha: float32): Color = proc colorToInt*(color: Color): int32 = ## Get hexadecimal value for a Color - (color.r.int32 shl 24) or (color.g.int32 shl 16) or (color.b.int32 shl 8) or color.a.int32 + int32((color.r.uint32 shl 24) or (color.g.uint32 shl 16) or (color.b.uint32 shl 8) or color.a.uint32) proc getColor*(hexValue: uint32): Color = ## Get Color structure from hexadecimal value diff --git a/src/raylib/rmodels.c b/src/raylib/rmodels.c index 69178de..47cfecb 100644 --- a/src/raylib/rmodels.c +++ b/src/raylib/rmodels.c @@ -3431,7 +3431,7 @@ void GenMeshTangents(Mesh *mesh) Vector3 *tan1 = (Vector3 *)RL_MALLOC(mesh->vertexCount*sizeof(Vector3)); Vector3 *tan2 = (Vector3 *)RL_MALLOC(mesh->vertexCount*sizeof(Vector3)); - for (int i = 0; i < mesh->vertexCount; i += 3) + for (int i = 0; i < mesh->vertexCount - 3; i += 3) { // Get triangle vertices Vector3 v1 = { mesh->vertices[(i + 0)*3 + 0], mesh->vertices[(i + 0)*3 + 1], mesh->vertices[(i + 0)*3 + 2] }; diff --git a/src/raylib/rtextures.c b/src/raylib/rtextures.c index 4ef33b9..9d3bcfc 100644 --- a/src/raylib/rtextures.c +++ b/src/raylib/rtextures.c @@ -4510,9 +4510,7 @@ Color Fade(Color color, float alpha) // Get hexadecimal value for a Color int ColorToInt(Color color) { - int result = (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a); - - return result; + return (int)(((unsigned)color.r << 24) | ((unsigned)color.g << 16) | ((unsigned)color.b << 8) | color.a); } // Get color normalized as float [0..1] diff --git a/tools/raylib_wrap.nim b/tools/raylib_wrap.nim index db453d1..63f77ff 100644 --- a/tools/raylib_wrap.nim +++ b/tools/raylib_wrap.nim @@ -454,7 +454,7 @@ proc fade*(color: Color, alpha: float32): Color = proc colorToInt*(color: Color): int32 = ## Get hexadecimal value for a Color - (color.r.int32 shl 24) or (color.g.int32 shl 16) or (color.b.int32 shl 8) or color.a.int32 + int32((color.r.uint32 shl 24) or (color.g.uint32 shl 16) or (color.b.uint32 shl 8) or color.a.uint32) proc getColor*(hexValue: uint32): Color = ## Get Color structure from hexadecimal value diff --git a/update_bindings.nims b/update_bindings.nims index afc6d92..300fcee 100644 --- a/update_bindings.nims +++ b/update_bindings.nims @@ -5,7 +5,7 @@ const PkgDir = thisDir().quoteShell RaylibDir = PkgDir / "raylib" RaylibGit = "https://github.com/raysan5/raylib.git" - RayLatestCommit = "272a142ee5b830ff6742c2df6a7b3abe7399cfde" + RayLatestCommit = "9ef29aff9aa08e64ac2d25048829de7459ee7d25" ApiDir = PkgDir / "api" DocsDir = PkgDir / "docs"