5 unstable releases

✓ Uses Rust 2018 edition

new 0.3.0 Feb 12, 2020
0.2.2 Feb 9, 2020
0.2.1 Feb 8, 2020
0.2.0 Feb 4, 2020
0.1.0 Jan 31, 2020

#10 in Rendering engine

25 downloads per month

MIT license

72KB
2K SLoC

Crow

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.

Examples

use crow::{
    glutin::{Event, EventsLoop, WindowBuilder, WindowEvent},
    Context, DrawConfig, Texture,
};

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

    let texture = Texture::load(&mut ctx, "./textures/player.png").expect("Unable to load texture");
    let mut surface = ctx.window_surface();

    let mut fin = false;
    loop {
        ctx.events_loop().poll_events(|event| match event {
            Event::WindowEvent {
                event: WindowEvent::CloseRequested,
                ..
            } => fin = true,
            _ => (),
        });

        ctx.clear_color(&mut surface, (0.4, 0.4, 0.8, 1.0))?;
        ctx.draw(&mut surface, &texture, (100, 150), &DrawConfig::default())?;

        ctx.finalize_frame()?;

        if fin {
            break;
        }
    }

    Ok(())
}

Features

  • basic pixel perfect rendering
  • image scaling
  • depth
  • color modulation
    • gray scale
    • invert colors
  • implement screenshots + getting texture data
  • flip textures
  • subtextures (spritesheets)
  • flip textures diagonally
  • different drawing modes
  • change draw to accept a generic target (allows for easy cameras/scaling etc etc)
  • debug lines
  • actual error handling
  • custom renderer support

Dependencies

~5MB
~106K SLoC