Created
February 4, 2019 00:14
-
-
Save NakedMoleRatScientist/f7d42106eef7c13d1514f0204c2f9a24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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