use graphicility::{Color, MouseButton, KeyCode};
fn main() {
let mut points: Vec<(i32, i32)> = vec![];
graphicility::run( move |ctx| {
let (g, input) = ctx.split();
g.clear(Color::rgb(20, 20, 20));
if input.mouse_down(MouseButton::Left) {
if let Some((mx, my)) = input.mouse_pos() {
points.push((mx as i32, my as i32));
}
}
if input.key_down(KeyCode::Space) {
points.clear();
}
for p in &points {
g.pixel(*p, Color::YELLOW);
}
g.text((10, 10), "Left Click to Draw | Space to Clear", Color::WHITE);
});
}