Skip to content

Weird *1.5 scale on rendered images #289

@m4ntis

Description

@m4ntis

Hi there,

I'm using the latest version of piston_window (0.117.0) on linux (updated arch), and I'm having this weird issue where images I render using the code below are all *1.5 zoomed. I can get it to kinda work with something hacky along the lines of c.transform.zoom(0.667) but it's weird + the scaling isn't perfect and I get bad aliasing.

use piston_window::*;
use std::path::Path;

fn main() {
    let mut window: PistonWindow = WindowSettings::new("foo", (640, 480))
        .exit_on_esc(true)
        .build()
        .unwrap();

    let mut ctx = window.create_texture_context();
    let mask = Texture::from_path(
        &mut ctx,
        Path::new("assets/foo.png"),
        Flip::None,
        &TextureSettings::new(),
    )
    .unwrap();

    while let Some(e) = window.next() {
        match e {
            Event::Loop(Loop::Render(_)) => {
                window.draw_2d(&e, |c, g, d| {
                    clear(color::hex("4d4d4d"), g);
                    image(&mask, c.transform, g);
                    ctx.encoder.flush(d);
                });
            }
            _ => {}
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions