| Crates.io | rust_pixel |
| lib.rs | rust_pixel |
| version | 1.0.7 |
| created_at | 2024-06-20 01:18:52.631793+00 |
| updated_at | 2025-08-11 06:32:55.225565+00 |
| description | 2d pixel-art game engine & rapid prototype tools support terminal, wgpu, sdl2 and web... |
| homepage | |
| repository | https://github.com/zipxing/rust_pixel |
| max_upload_size | |
| id | 1277477 |
| size | 1,066,563 |

Change Log | Principle | Coding | FAQ | TODO | Art Center Roadmap
RustPixel is a 2D game engine & rapid prototyping tools, supporting both text and graphics rendering modes.
It is suitable for creating 2D pixel-style games and developing terminal applications.
It can be compiled into FFI for front-end and back-end use, and into WASM for web projects.
Here is a petscii art painting browser made with rust_pixel. Special thanks to x.com/PETSCIIWORLD for the character painting and the transition shader provided by gltransition. Click here for online demo。
https://github.com/user-attachments/assets/4758f2b6-66c2-47ed-997d-a9066be449aa
The main steps of the installation process are as follows:
The detailed steps for each operating system: MacOS | Linux | Windows (WSL) | Windows (Native)
Starting from version 0.5.3, you can deploy cargo-pixel directly from crates.io:
cargo install rust_pixel # use crates.io rust_pixel crate deploy cargo-pixel
cargo pixel # first run cargo-pixel will clone rust_pixel to <homedir>/rust_pixel_work automatic
cd ~/rust_pixel_work # cd to workspace
cargo pixel r petview s # run demo game...
To use the newest code, you should clone RustPixel and deploy cargo-pixel tool:
git clone https://github.com/zipxing/rust_pixel
cd rust_pixel
cargo install --path . --force
If you have installed an old version of cargo-pixel, you may get an error when running it. git update is required and the new version of cargo-pixel is deployed manually:
cd rust_pixel
git pull
cargo install --path . --force
cd rust_pixel
cargo pixel run snake term #Run the snake game in terminal mode
cargo pixel r snake t #Run the snake game in terminal mode - shorthand
cargo pixel r tetris s #Run the Tetris game in SDL window mode
cargo pixel r tower w #Run tower in web,visit http://localhost:8080/ in your browser
cargo pixel r tower w --webport 8081 #Change web server port
cargo pixel r tower w -r #Run with release mode
cargo pixel r petview g -r #Run the petview game in winit+glow mode
cargo pixel r petview wg -r #Run the petview game in winit+wgpu mode
You can also use cargo pixel to create your own game or app:
cargo pixel c mygame #Create mygame in ./apps using apps/template as a template
Creat a standalone app in some directory:
cargo pixel c myapp .. #Create a standalone crate in ../myapp
cd ../myapp
cargo pixel r myapp t
cargo pixel r myapp s
RustPixel also includes several tools:
cargo pixel r palette t -r

#term mode
cargo pixel edit term . assets/logo.txt
or
cargo pixel e t . assets/logo.txt
#graphics mode
cargo pixel edit sdl . assets/logo.pix
or
cargo pixel e s . assets/logo.pix

cargo pixel p assets/a.png > a.pix
cargo pixel e g . assets/a.pix
cargo pixel p assets/lion.png 40 40 > assets/lion.pix
cargo pixel e g . assets/lion.pix

cargo pixel cg assets/sdq/fire.gif assets/sdq/fire.ssf 40 25
cargo pixel ssf . assets/sdq/fire.ssf # preview ssf
#graphics mode
cargo pixel r snake s -r

#term mode
cargo pixel r snake t -r
#web mode
cargo pixel r snake w -r
#and visit http://localhost:8080/ in your browser
#term mode
cargo pixel r tetris t -r

#graphics mode
cargo pixel r tetris s -r

#web mode
cargo pixel r tetris w -r
#and visit http://localhost:8080/ in your browser

cargo pixel r poker t -r
cargo pixel r gin_rummy t -r

The poker/ffi directory demo how to wrap Rust algorithms into CFFI for use with other languages, showcasing C++ and Python calling poker_ffi
cd apps/poker/ffi
make run
The poker/wasm directory demo how to wrap Rust algorithms into wasm for JS calling
cd apps/poker/wasm
make run
#graphics mode
cargo pixel r tower s -r
#web mode
cargo pixel r tower w -r
#and visit http://localhost:8080/ in your browser

and so on ... ...