#pixel #graphics #mouse-input

pixelated

An opinionated pixel renderer focusing on simplicity

3 unstable releases

0.2.0 Apr 12, 2024
0.1.1 Mar 15, 2024
0.1.0 Mar 9, 2024

#109 in Rendering

Download history 87/week @ 2024-03-03 143/week @ 2024-03-10 33/week @ 2024-03-17 1/week @ 2024-03-24 31/week @ 2024-03-31 3/week @ 2024-04-07

88 downloads per month

MIT license

51KB
1K SLoC

Pixelated

An opinionated pixel renderer focusing on simplicity

Features

  • Pixel renderer
  • Keyboard and mouse input
  • Ability to screenshot

Minimal example

use pixelated::{canvas, input, media, window, Callbacks, Context};

const WIDTH: u32 = 256;
const HEIGHT: u32 = 256;

struct Game {}

impl Callbacks for Game {
    fn init(&self, ctx: &mut Context) {
        canvas::resize(ctx, WIDTH, HEIGHT);
        window::window_ref(ctx).set_resizable(true);
    }

    fn update(&mut self, ctx: &mut Context) -> bool {
        canvas::clear_screen(ctx, &[0, 0, 0]);

        let (px, py) = (75, 75);
        let (wx, wy) = (100, 100);
        for y in 0..wx {
            for x in 0..wy {
                canvas::write_pixel_rgb(ctx, x + px, y + py, &[0, 255, 255]);
            }
        }

        false
    }
}

fn main() {
    let app = Game {};
    pixelated::run(app);
}

Output
Example

More examples can be seen in examples.

Dependencies

~18–58MB
~783K SLoC