11 releases (6 breaking)

✓ Uses Rust 2018 edition

new 0.7.1 Apr 6, 2020
0.7.0 Mar 30, 2020
0.6.0 Mar 19, 2020
0.5.0 Mar 11, 2020
0.1.0 Jan 31, 2020

#4 in Rendering engine

Download history 14/week @ 2020-01-28 57/week @ 2020-02-04 82/week @ 2020-02-11 103/week @ 2020-02-18 61/week @ 2020-02-25 23/week @ 2020-03-03 67/week @ 2020-03-10 87/week @ 2020-03-17 42/week @ 2020-03-24 36/week @ 2020-03-31

189 downloads per month

MIT license

93KB
2K SLoC

Crow

Documentation Crates.io License: MIT

A simple and fairly efficient pixel based 2D graphics library. crow is designed to be easy to use and should allow users to do nearly everything they want without requiring custom renderers or unsafe code.

The most recent documentation can be found here.

The latest release can be viewed at the 0.5.0 tag.

You may also want to consider looking at akari, a WIP showcase project.

This crate requires a GPU supporting OpenGL Version 3.3.

Examples

use crow::{
    glutin::{
        event::{Event, WindowEvent},
        event_loop::{ControlFlow, EventLoop},
        window::WindowBuilder,
    },
    Context, DrawConfig, Texture,
};

fn main() -> Result<(), crow::Error> {
    let event_loop = EventLoop::new();
    let mut ctx = Context::new(WindowBuilder::new(), &event_loop)?;

    let texture = Texture::load(&mut ctx, "./textures/player.png")?;

    event_loop.run(
        move |event: Event<()>, _window_target: _, control_flow: &mut ControlFlow| match event {
            Event::WindowEvent {
                event: WindowEvent::CloseRequested,
                ..
            } => *control_flow = ControlFlow::Exit,
            Event::MainEventsCleared => ctx.window().request_redraw(),
            Event::RedrawRequested(_) => {
                let mut surface = ctx.surface();
                ctx.clear_color(&mut surface, (0.4, 0.4, 0.8, 1.0));
                ctx.draw(&mut surface, &texture, (100, 150), &DrawConfig::default());
                ctx.present(surface).unwrap();
            }
            _ => (),
        },
    )
}

Dependencies

~3.5–5MB
~96K SLoC