piston
piston copied to clipboard
Rendered window bigger than specified size
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.
Which OS and window backend?
Oh, yes, forgot to mention it. It's Win 10.
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);
});
}
}
Hi, was this solved
I have the same issue on Linux
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
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);
});
}
}
I found out the issue is Glutin so I did change that GLFW and that works
thanks
It's "cargo add pistoncore-glfw_window" for anyone coming to this party.