Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendered window bigger than specified size #1200

Open
Ironmaggot opened this issue Aug 28, 2017 · 6 comments

Comments

@Ironmaggot
Copy link

commented Aug 28, 2017

When using WindowSettings::new() to create a window, the displayed window size is bigger than the size entered into the WindowSettings::new() size argument.

In other words. My monitor resolution is 1920x1080. Creating a window with the same size will result in a window which is larger than my screen. For example, if I create a window the size of 900x900, then the displayed window does not fit on the screen with its height. Displayed 900x900 window is taller than my 1080 tall monitor.

@bvssvni

This comment has been minimized.

Copy link
Member

commented Aug 28, 2017

Which OS and window backend?

@Ironmaggot

This comment has been minimized.

Copy link
Author

commented Aug 29, 2017

Oh, yes, forgot to mention it. It's Win 10.

@Ironmaggot

This comment has been minimized.

Copy link
Author

commented Aug 29, 2017

About the backend I am not sure - its the default backend, I guess.

Here's the entirety of the code.

extern crate piston_window;

use piston_window::*;

fn main() {
    let mut window: PistonWindow =
        WindowSettings::new("Hello Piston!", [900, 900])
        .decorated(false).exit_on_esc(true).build().unwrap();
    while let Some(event) = window.next() {
        window.draw_2d(&event, |context, graphics| {
            clear([1.0; 4], graphics);
            rectangle([1.0, 0.0, 0.0, 1.0], // red
                      [400.0, 700.0, 100.0, 100.0],
                      context.transform,
                      graphics);
        });
    }
}
@varomix

This comment has been minimized.

Copy link

commented Dec 2, 2018

Hi, was this solved
I have the same issue on Linux
image
I measured it with the screen tool and is WAY bigger that specified, I noticed the same with other peoples Piston projects, the windows are bigger.

thanks

@lwiklendt

This comment has been minimized.

Copy link

commented Dec 3, 2018

I think the issue might be due to lack of HDPI support in the default backend. Try using the GLFW backend:

extern crate piston_window;
extern crate glfw_window;
use glfw_window::GlfwWindow;
use piston_window::*;

fn main() {
    let mut window: PistonWindow<GlfwWindow> =
        WindowSettings::new("Hello Piston!", [900, 900])
            .decorated(false).exit_on_esc(true).build().unwrap();
    while let Some(event) = window.next() {
        window.draw_2d(&event, |context, graphics| {
            clear([1.0; 4], graphics);
            rectangle([1.0, 0.0, 0.0, 1.0], // red
                      [400.0, 700.0, 100.0, 100.0],
                      context.transform,
                      graphics);
        });
    }
}
@varomix

This comment has been minimized.

Copy link

commented Dec 3, 2018

I found out the issue is Glutin so I did change that GLFW and that works

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.