Skip to content

pufferfish-rs/pufferfish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🐡 pufferfish

An opinionated 2D game framework for Rust

Docs Crates.io License

⚠️ DISCLAIMER: pufferfish is in very early stages of development. APIs can and will change, many basic features are missing, and parts of this README may not reflect the current state of the crate. I would recommend against using this in your projects just yet, but for those brave enough, now is the time for suggestions and feature requests!

Features

  • Minimal and opinionated API
  • Simple but flexible callback system
  • Easy input handling via polling
  • Efficient 2D renderer with sprite batching, powered by fugu
  • Asset loader with support for custom formats

Getting Started

To add pufferfish to your project, add the following to the dependencies section of your Cargo.toml:

pufferfish = "0.1"

See the examples/ directory in the source to get a feel of how pufferfish's API works.

A basic pufferfish program looks something like this:

use pufferfish::graphics::{Color, Graphics};
use pufferfish::App;

struct State {
    // Your game state...
}

fn main() {
    App::new()
        .with_title("Hello World")
        .add_state(State::new()) // Add your state
        .add_init_callback(init) // Add your callbacks
        .add_frame_callback(update)
        .add_frame_callback(draw)
        .run();
}

fn init(state: &mut State) {
    // Initialization code here...
}

fn update(state: &mut State) {
    // Update code here...
}

// Request arbitrary state through the callback's type signature
fn draw(state: &State, g: &Graphics) {
    g.clear(Color::BLACK);
    g.begin();
    // Draw code here...
    g.end();
}

Acknowledgements

  • raylib, an awesome single-header C library to "enjoy videogames programming"
  • bevy, a beautifully designed data-driven game engine built in Rust
  • Kha, a portable multimedia framework for the Haxe programming language

About

An opinionated 2D game framework for Rust

Resources

License

Apache-2.0 and 2 other licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Zlib
LICENSE-ZLIB

Stars

Watchers

Forks

Packages

No packages published

Languages