Fix texture bleeding
This commit is contained in:
11
game/main.c
11
game/main.c
@@ -212,6 +212,10 @@ bool init(void *userData) {
|
|||||||
.path="assets/game.tsj",
|
.path="assets/game.tsj",
|
||||||
.texturePath="assets/game.png"
|
.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();
|
setupSystems();
|
||||||
loadMap(game, "assets/maps/main_menu_01.tmj");
|
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.x += origin.x - dst.width * 0.5f;
|
||||||
dst.y += origin.y - dst.height * 0.5f;
|
dst.y += origin.y - dst.height * 0.5f;
|
||||||
Rectangle src = t[i].rec;
|
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].flipX) src.width *= -1.0f;
|
||||||
if (t[i].flipY) src.height *= -1.0f;
|
if (t[i].flipY) src.height *= -1.0f;
|
||||||
bzArrayPush(game->drawData, (DrawData) {
|
bzArrayPush(game->drawData, (DrawData) {
|
||||||
@@ -399,8 +408,6 @@ static void renderPauseMenu(Game *game, float dt) {
|
|||||||
i32 width = GetScreenWidth();
|
i32 width = GetScreenWidth();
|
||||||
i32 height = GetScreenHeight();
|
i32 height = GetScreenHeight();
|
||||||
|
|
||||||
game->camera.zoom = 3 * uiGetScale();
|
|
||||||
|
|
||||||
bzUIBegin(UI, width, height);
|
bzUIBegin(UI, width, height);
|
||||||
bzUISetParentLayout(UI, (BzUILayout) {
|
bzUISetParentLayout(UI, (BzUILayout) {
|
||||||
.type = BZ_UI_LAYOUT_FLEX_BOX,
|
.type = BZ_UI_LAYOUT_FLEX_BOX,
|
||||||
|
|||||||
Reference in New Issue
Block a user