pixels/README.md

33 lines
1.7 KiB
Markdown
Raw Normal View History

[![Build Status](https://travis-ci.org/parasyte/pixels.svg?branch=master)](https://travis-ci.org/parasyte/pixels)
2019-09-28 21:09:06 +10:00
![Pixels Logo](img/pixels.png)
2019-09-30 07:31:31 +10:00
A tiny hardware-accelerated pixel frame buffer. :crab:
2019-09-28 21:09:06 +10:00
## But why?
2019-10-16 12:43:01 +11:00
Rapidly prototype a simple 2D game, pixel-based animations, software renderers, or an emulator for your favorite platform. Then add shaders to simulate a CRT or just to spice it up with some nice VFX.
2019-09-28 21:09:06 +10:00
`pixels` is more than just a library to push pixels to a screen, but less than a full framework. You're in charge of managing a window environment, event loop, and input handling.
## Features
2019-10-16 12:43:01 +11:00
- Built on modern graphics APIs powered by [`wgpu`](https://crates.io/crates/wgpu): DirectX 12, Vulkan, Metal, OpenGL.
2019-10-14 12:35:47 +11:00
- Use your own custom shaders for special effects. (WIP)
2019-09-28 21:09:06 +10:00
- Hardware accelerated scaling on perfect pixel boundaries.
2019-10-14 12:35:47 +11:00
- Supports non-square pixel aspect ratios. (WIP)
## Examples
To demonstrate `pixels`, I've written a Space Invaders clone. The game logic can be found in the `simple-invaders` crate. The included example uses `simple-invaders` to rasterize the image, and `pixels` to display it. `winit` provides the windowing and event handling.
```bash
2019-10-16 12:43:01 +11:00
cargo run --release --example invaders
2019-10-14 12:35:47 +11:00
```
See the [example's README](./examples/invaders) for more information.
2019-09-28 21:09:06 +10:00
## Comparison with `minifb`
2019-10-07 19:17:36 +11:00
The [`minifb`](https://crates.io/crates/minifb) crate shares some similarities with `pixels`; it also allows rapid prototyping of 2D games and emulators. But it requires the use of its own window/GUI management, event loop, and input handling. One of the disadvantages with the `minifb` approach is the lack of hardware acceleration (except on macOS, which uses Metal but is not configurable). An advantage is that it relies on fewer dependencies.