Created
January 18, 2016 21:14
-
-
Save andrewcsmith/55124112d67f84e18258 to your computer and use it in GitHub Desktop.
See lines 19-22
This file contains 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; | |
extern crate piston_window; | |
extern crate graphics; | |
extern crate gfx_graphics; | |
use piston::input::*; | |
use piston::window::{Window as Win, AdvancedWindow, WindowSettings}; | |
use piston_window::{PistonWindow as Window}; | |
fn main() { | |
let mut window: Window = WindowSettings::new("Hello Piston!", [640, 480]) | |
.exit_on_esc(true).fullscreen(true).build().unwrap(); | |
for w in window { | |
while let Some(e) = w.events.borrow_mut().next() { | |
match e { | |
Event::Render(RenderArgs { ext_dt, width, height, .. } ) => { | |
w.draw_2d(|c, g| { | |
// This one works... | |
let rectangle = piston_window::Rectangle::new([0.5; 4]); | |
// but this one breaks! It's just a reexported module. | |
// let rectangle = graphics::Rectangle::new([0.5; 4]); | |
piston_window::clear(graphics::color::WHITE, g); | |
rectangle.draw([width as f64 / 2 as f64, height as f64 / 2 as f64, 10., 10.], &c.draw_state, c.transform, g); | |
}); | |
}, | |
_ => { } | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment