From 8ebe62b4dd89cf3f6228d6a5c339c35b0ac25c31 Mon Sep 17 00:00:00 2001 From: hkc Date: Tue, 11 Oct 2022 19:45:34 +0300 Subject: [PATCH 1/5] Use RL_QUADS/RL_TRIANGLES for single-pixel drawing (#2750) Addresses problem mentioned in https://github.com/raysan5/raylib/issues/2744#issuecomment-1273568263 (in short: when drawing pixels using DrawPixel{,V} in camera mode, upscaled pixel becomes a line instead of bigger pixel) --- src/rshapes.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/src/rshapes.c b/src/rshapes.c index f8d9db71f..7e4cad74b 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -104,21 +104,50 @@ void SetShapesTexture(Texture2D texture, Rectangle source) // Draw a pixel void DrawPixel(int posX, int posY, Color color) { - rlBegin(RL_LINES); - rlColor4ub(color.r, color.g, color.b, color.a); - rlVertex2f(posX, posY); - rlVertex2f(posX + 1, posY + 1); - rlEnd(); + DrawPixelV((Vector2){ posX, posY }, color); } // Draw a pixel (Vector version) void DrawPixelV(Vector2 position, Color color) { - rlBegin(RL_LINES); +#if defined(SUPPORT_QUADS_DRAW_MODE) + rlSetTexture(texShapes.id); + + rlBegin(RL_QUADS); + + rlNormal3f(0.0f, 0.0f, 1.0f); rlColor4ub(color.r, color.g, color.b, color.a); + + rlTexCoord2f(texShapesRec.x/texShapes.width, texShapesRec.y/texShapes.height); rlVertex2f(position.x, position.y); - rlVertex2f(position.x + 1.0f, position.y + 1.0f); + + rlTexCoord2f(texShapesRec.x/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); + rlVertex2f(position.x, position.y + 1); + + rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, (texShapesRec.y + texShapesRec.height)/texShapes.height); + rlVertex2f(position.x + 1, position.y + 1); + + rlTexCoord2f((texShapesRec.x + texShapesRec.width)/texShapes.width, texShapesRec.y/texShapes.height); + rlVertex2f(position.x + 1, position.y); + rlEnd(); + + rlSetTexture(0); +#else + rlBegin(RL_TRIANGLES); + + rlColor4ub(color.r, color.g, color.b, color.a); + + rlVertex2f(position.x, position.y); + rlVertex2f(position.x, position.y + 1); + rlVertex2f(position.x + 1, position.y); + + rlVertex2f(position.x + 1, position.y); + rlVertex2f(position.x, position.y + 1); + rlVertex2f(position.x + 1, position.y + 1); + + rlEnd(); +#endif } // Draw a line From 07bbfe86b9cb750d224bc185a9ddcefba6d8bedb Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 11 Oct 2022 22:28:40 +0200 Subject: [PATCH 2/5] Update core_basic_window.c --- examples/core/core_basic_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/core/core_basic_window.c b/examples/core/core_basic_window.c index 25937e4c3..be7a449ab 100644 --- a/examples/core/core_basic_window.c +++ b/examples/core/core_basic_window.c @@ -13,7 +13,7 @@ * Enjoy using raylib. :) * * Example originally created with raylib 1.0, last time updated with raylib 1.0 - +* * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * BSD-like license that allows static linking with closed source software * From f080367a0ce1f9f420a7a28b48ed2d01a6cb3827 Mon Sep 17 00:00:00 2001 From: hartmannathan <59230071+hartmannathan@users.noreply.github.com> Date: Wed, 12 Oct 2022 11:12:28 -0400 Subject: [PATCH 3/5] examples/core/core_custom_logging.c: Fix typo (#2751) From aa67f7c39a77b195ffdbd0b9ba9291e65ccf7131 Mon Sep 17 00:00:00 2001 From: CrezyDud <84625713+CrezyDud@users.noreply.github.com> Date: Wed, 12 Oct 2022 17:14:18 +0200 Subject: [PATCH 4/5] Fix & Simplify .vox signature check (#2752) and make version check be only 150 not over 150 --- src/external/vox_loader.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/external/vox_loader.h b/src/external/vox_loader.h index a7a161c7f..c1b26e6f3 100644 --- a/src/external/vox_loader.h +++ b/src/external/vox_loader.h @@ -67,7 +67,7 @@ revision history: #define VOX_SUCCESS (0) #define VOX_ERROR_FILE_NOT_FOUND (-1) #define VOX_ERROR_INVALID_FORMAT (-2) -#define VOX_ERROR_FILE_VERSION_TOO_OLD (-3) +#define VOX_ERROR_FILE_VERSION_NOT_MATCH (-3) // VoxColor, 4 components, R8G8B8A8 (32bit) typedef struct { @@ -538,31 +538,26 @@ int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArr // @raysan5: Reviewed (unsigned long) -> (unsigned int), possible issue with Ubuntu 18.04 64bit // @raysan5: reviewed signature loading - unsigned char signature[4] = { 0 }; unsigned char* fileData = pvoxData; unsigned char* fileDataPtr = fileData; unsigned char* endfileDataPtr = fileData + voxDataSize; - signature[0] = fileDataPtr[0]; - signature[1] = fileDataPtr[1]; - signature[2] = fileDataPtr[2]; - signature[3] = fileDataPtr[3]; - fileDataPtr += 4; - - if ((signature[0] != 'V') && (signature[0] != 'O') && (signature[0] != 'X') && (signature[0] != ' ')) + if (strncmp((char*)fileDataPtr, "VOX ", 4) != 0) { return VOX_ERROR_INVALID_FORMAT; //"Not an MagicaVoxel File format" } + fileDataPtr += 4; + // @raysan5: reviewed version loading unsigned int version = 0; version = ((unsigned int*)fileDataPtr)[0]; fileDataPtr += 4; - if (version < 150) + if (version != 150) { - return VOX_ERROR_FILE_VERSION_TOO_OLD; //"MagicaVoxel version too old" + return VOX_ERROR_FILE_VERSION_NOT_MATCH; //"MagicaVoxel version doesn't match" } From 11fd883ee443d3ea478e750d0116611d72d5708d Mon Sep 17 00:00:00 2001 From: Anut-py <72886192+Anut-py@users.noreply.github.com> Date: Wed, 12 Oct 2022 16:04:11 -0400 Subject: [PATCH 5/5] Add Haskell bindings to BINDINGS.md (#2753) --- BINDINGS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/BINDINGS.md b/BINDINGS.md index 86316aa3c..a783194c0 100644 --- a/BINDINGS.md +++ b/BINDINGS.md @@ -23,6 +23,7 @@ Some people ported raylib to other languages in form of bindings or wrappers to | raylib-go | **4.2** | [Go](https://golang.org/) | Zlib | https://github.com/gen2brain/raylib-go | | raylib-guile | auto | [Guile](https://www.gnu.org/software/guile/) | Zlib | https://github.com/petelliott/raylib-guile | | gforth-raylib | 3.5 | [Gforth](https://gforth.org/) | MIT | https://github.com/ArnautDaniel/gforth-raylib | +| h-raylib | 4.5-dev | [Haskell](https://haskell.org/) | Apache-2.0 | https://github.com/Anut-py/h-raylib | | raylib-hx | 4.0 | [Haxe](https://haxe.org/) | Zlib | https://github.com/foreignsasquatch/raylib-hx | | hb-raylib | 3.5 | [Harbour](https://harbour.github.io) | MIT | https://github.com/MarcosLeonardoMendezGerencir/hb-raylib | | jaylib | **4.2** | [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) | GPLv3+CE | https://github.com/electronstudio/jaylib/ |