Skip to content

Instantly share code, notes, and snippets.

@NakedMoleRatScientist
Created February 4, 2019 00:14
Show Gist options
  • Save NakedMoleRatScientist/f7d42106eef7c13d1514f0204c2f9a24 to your computer and use it in GitHub Desktop.
Save NakedMoleRatScientist/f7d42106eef7c13d1514f0204c2f9a24 to your computer and use it in GitHub Desktop.
extern crate piston_window;
extern crate piston;
use piston_window::*;
use piston::input::*;
use piston::event_loop::*;
fn main() {
let mut window: PistonWindow = WindowSettings::new("Hello Piston!", [640, 480]).exit_on_esc(true).build().unwrap();;
while let Some(e) = window.next() {
window.draw_2d(&e, |_c, g| {
clear([0.5, 1.0, 0.5, 1.0], g);
});
}
let mut events = Events::new(EventSettings::new().lazy(true));
while let Some(e) = events.next(&mut window)
{
if let Some(button) = e.release_args() {
match Button {
Button::Keyboard(key) => println!("Released keyboard key '{:?}'", key),
}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment