peach 0.1.0

Processing-esque graphical framework.
docs.rs failed to build peach-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: peach-0.4.0

Peach

A processing-esque graphical programming framework implemented in Rust.

What is this, really?

Really, this is an opportunity for me to test my skills at graphical programming and Rust. I thoroughly enjoy both graphics and Rust, however I've never had a real project in either, so I'm a complete newbie.

Why not kill two birds with one stone?

What it will look like (eventually).

extern crate peach;

struct Handler {
    degrees: f32,
}

impl Handler {
    fn new() -> Self {
        Self {
            degrees: 0.0,
        }
    }
}

impl peach::Handler for Handler {
    fn update(&mut self, dt: f64, m: &mut peach::Peach) -> peach::Control {
        self.degrees += 30.0 * dt;

        peach::Control::Continue
    }

    fn draw(&mut self, m: &mut peach::Peach) -> peach::Control {
        // Set the rotation for drawing.
        m.rotation(self.degrees);

        // Get the center of the view port.
        let (x, y) = m.center();

        // Draw a 16x24 rectangle at the center of the screen.
        m.rect(x, y, 16.0, 24.0);

        peach::Control::Continue
    }
}

fn main() {
    // Config passed to peach::run.
    let mut config = peach::Config::default();
    // Set the window size to 512x512.
    config.size = (512, 512);
    // Make peach process angles as degrees.
    config.angle_mode = peach::AngleMode::Degrees;
    // Draw rectangles from the center.
    config.rect_mode = peach::RectMode::Center;
    // Tell peach to clear every frame with color "#282a36".
    config.clear_color = peach::Color::hex(0x282a36ff);

    let mut handler = Handler::new();

    peach::run(&mut handler, config);
}

Of course, this example is currently non-functional, but this is what a basic sketch, programmed in the end product will eventually look like.