#pixel #graphics #renderer #opinionated #focusing #simplicity #mouse

pixelated

一个注重简单的有观点的像素渲染器

3个不稳定版本

0.2.0 2024年4月12日
0.1.1 2024年3月15日
0.1.0 2024年3月9日

130渲染 中排名

Download history 1/week @ 2024-04-19 3/week @ 2024-05-17 2/week @ 2024-05-24 1/week @ 2024-07-05

每月下载量 179

MIT 许可证

51KB
1K SLoC

Pixelated

一个注重简单的有观点的像素渲染器

功能

  • 像素渲染器
  • 键盘和鼠标输入
  • 截图功能

最小示例

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);
}

输出
Example

更多示例请见 示例

依赖项

~10–50MB
~757K SLoC