axle 0.1.1

A graphics library influenced by Processing
Documentation
extern crate axle;

use axle::{Axle, Color, Event, Key, MouseButton, Point};

fn main() {
    let mut a = Axle::default();
    let (mut old_x, mut old_y) = a.mouse_pos();

    let (width, height) = a.size();
    println!("{}x{}", width, height);

    a.circle(Point::new(100, 100), 100);

    let center = Point::new(width as i32 / 2, height as i32 / 2);

    let fps = a.fps(60.0);

    loop {
        let (x, y) = a.mouse_pos();
        a.line(Point::new(old_x, old_y), Point::new(x, y));
        old_x = x;
        old_y = y;

        if a.mouse_pressed(MouseButton::Left) {
            a.pen_down();
        } else {
            a.pen_up();
        }

        if a.keyboard_pressed(Key::L) {
            a.line(Point::new(x, y), center);
        }

        if a.keyboard_pressed(Key::C) {
            a.clear();
        }

        let events = a.events();
        for e in &events {
            if let Event::Quit { .. } = *e {
                return;
            }
        }

        a.background(Color::RGB(255, 128, 0));
        a.set_draw_color(Color::RGB(0, 0, 0));
        a.draw();
        a.sleep(fps);
    }
}