From 2e2628bd8f7fcb673e665a4626b2f9ba1c51ab78 Mon Sep 17 00:00:00 2001 From: Klemen Plestenjak Date: Thu, 4 Jan 2024 22:16:29 +0100 Subject: [PATCH] Fix texture bleeding --- game/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/game/main.c b/game/main.c index d1ead4b..c8a831b 100644 --- a/game/main.c +++ b/game/main.c @@ -212,6 +212,10 @@ bool init(void *userData) { .path="assets/game.tsj", .texturePath="assets/game.png" }); + // Fixes texture bleeding + GenTextureMipmaps(&game->tileset.tiles); + SetTextureWrap(game->tileset.tiles, TEXTURE_WRAP_MIRROR_REPEAT); + SetTextureFilter(game->tileset.tiles, TEXTURE_FILTER_POINT); setupSystems(); loadMap(game, "assets/maps/main_menu_01.tmj"); @@ -321,6 +325,11 @@ static void renderGame(Game *game, float dt) { dst.x += origin.x - dst.width * 0.5f; dst.y += origin.y - dst.height * 0.5f; Rectangle src = t[i].rec; + // Fixes texture bleeding issue + src.x += 0.01f; + src.y += 0.01f; + src.width -= 0.01f; + src.height -= 0.01f; if (t[i].flipX) src.width *= -1.0f; if (t[i].flipY) src.height *= -1.0f; bzArrayPush(game->drawData, (DrawData) { @@ -399,8 +408,6 @@ static void renderPauseMenu(Game *game, float dt) { i32 width = GetScreenWidth(); i32 height = GetScreenHeight(); - game->camera.zoom = 3 * uiGetScale(); - bzUIBegin(UI, width, height); bzUISetParentLayout(UI, (BzUILayout) { .type = BZ_UI_LAYOUT_FLEX_BOX,