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 · 7 comments
Open

Rendered window bigger than specified size #1200

Ironmaggot opened this issue Aug 28, 2017 · 7 comments

Comments

@Ironmaggot
Copy link

@Ironmaggot Ironmaggot 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
Copy link
Member

@bvssvni bvssvni commented Aug 28, 2017

Which OS and window backend?

Loading

@Ironmaggot
Copy link
Author

@Ironmaggot Ironmaggot commented Aug 29, 2017

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

Loading

@Ironmaggot
Copy link
Author

@Ironmaggot Ironmaggot 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);
        });
    }
}

Loading

@varomix
Copy link

@varomix varomix 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

Loading

@lwiklendt
Copy link

@lwiklendt lwiklendt 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);
        });
    }
}

Loading

@varomix
Copy link

@varomix varomix commented Dec 3, 2018

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

thanks

Loading

@vwood
Copy link

@vwood vwood commented Mar 10, 2020

It's "cargo add pistoncore-glfw_window" for anyone coming to this party.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants