| Crates.io | pixelated |
| lib.rs | pixelated |
| version | 0.2.0 |
| created_at | 2024-03-09 13:59:26.35635+00 |
| updated_at | 2024-04-12 11:11:06.649576+00 |
| description | An opinionated pixel renderer focusing on simplicity. |
| homepage | https://github.com/stofffe/pixelated |
| repository | https://github.com/stofffe/pixelated |
| max_upload_size | |
| id | 1167851 |
| size | 111,832 |
An opinionated pixel renderer focusing on simplicity
Features
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

More examples can be seen in examples.