Expand description
§fbdraw
Provides a simple interface for creating a “surface” and a single primitive
put_pixel
for drawing on it.
The aim is allow playing around with graphics algorithms like curve drawing, without the burden of setting up a window (with an event loop), setting up GPU pipeline, etc.
This crate wraps the minifb library,
and provides a simpler Surface
based interface.
The coordinate system has origin at the top-left, with X and Y axis running left-to-right and top-to-bottom, respectively.
§Example
use fbdraw::{Color, Surface};
let mut surface = Surface::new(1920, 1200);
surface.begin_draw(my_draw_frame);
// Draw a frame on the surface. This callback function is
// called at a fixed rate of 60 fps.
fn my_draw_frame(surface: &mut Surface) {
let (width, height) = surface.size();
surface.put_pixel(width / 2, height / 2, Color::rgb(255, 0, 0));
}