Last active
January 25, 2017 22:39
-
-
Save saik0/4d0ceb2e338d2c6249016adb962b4ff0 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
fn on_render(&mut self, window: &mut PistonWindow, ren: RenderArgs, e: Event) { | |
let fps = self.fps_counter.tick(); | |
let ref front = self.front; | |
window.draw_2d(&e, |c, g| { | |
let rect = Rectangle::new(color::BLACK); | |
clear(color::WHITE, g); | |
let mut i = 0; | |
let mut bounds = [0.0, 0.0, SIZE, SIZE]; | |
for y in 0..self.height { | |
for x in 0..self.width { | |
if front.get(i).unwrap() { | |
bounds[0] = x as f64 * SIZE; | |
bounds[1] = y as f64 * SIZE; | |
rect.draw(bounds, &c.draw_state, c.transform, g); | |
} | |
i += 1; | |
} | |
} | |
// disabled to bench rect drawing | |
//GRID.draw(&LINE, &c.draw_state, c.transform, g) | |
}); | |
println!("fps: {}", fps); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment