Skip to content

Sprites artifacts with scaling #220

@scambier

Description

@scambier

I'm trying to add sprites to my game, and there is a texture problem: depending on the sprites' size and/or the window scaling, pixels surrounding the sprite are sometimes drawn on screen.

As an example, here is the "eye" sprite, with its surrounding pixels:

image

But the in-game rendering sometimes trim pixels on a side, and sometimes add pixels from neighbour sprites
image

The BTerm is built like that:

    let context = BTermBuilder::new()
        .with_title("Roguelike Tutorial")
        .with_tile_dimensions(16, 16)
        .with_simple_console(80, 50, "16x16-sb-ascii.png")
        .with_font("16x16-sb-ascii.png", 16, 16)
        .with_sprite_console(16 * 80, 16 * 50, 0)
        .with_sprite_sheet(
            SpriteSheet::new("resources/MRMOTEXT_rexpaintx2.png")
            .add_sprite(Rect::with_size(144, 352, 16, 16))
        )
        .with_vsync(false)
        .build()?;

Both PNGs have 16x16px tiles/sprites. I tried different settings to fix this issue but to no avail.

Edit: same issue when the spritesheet is used as a font file:
image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions