I'd like to change the resolution of a PistonWindow
after it has been created. This would allow a user to change the resolution of the window while playing the game.
WindowSettings
has a set_size
method, but it doesn't seem to be accessible after the PistonWindow
type is created.
A simplified example:
extern crate piston_window;
use piston_window::*;
fn main() {
let mut window: PistonWindow = WindowSettings::new("Game Title", [200, 200])
.exit_on_esc(true)
.build()
.unwrap();
// Do some logic here, and change resolution to 400 x 400.
while let Some(e) = window.next() {
window.draw_2d(&e, |c, g| {
ellipse([1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 100.0, 100.0], c.transform, g)
});
}
}