43 releases

Uses old Rust 2015

new 0.12.3 Oct 15, 2020
0.12.1 Sep 25, 2020
0.12.0 May 6, 2020
0.11.2 Mar 3, 2019
0.0.1 May 17, 2016
Download history 46/week @ 2020-06-30 42/week @ 2020-07-07 85/week @ 2020-07-14 7/week @ 2020-07-21 7/week @ 2020-07-28 3/week @ 2020-08-04 132/week @ 2020-08-11 50/week @ 2020-08-18 53/week @ 2020-08-25 90/week @ 2020-09-01 87/week @ 2020-09-08 10/week @ 2020-09-15 18/week @ 2020-09-22 68/week @ 2020-09-29 15/week @ 2020-10-06 30/week @ 2020-10-13

182 downloads per month

MIT license

680KB
2.5K SLoC

Caper

crates.io version Build status Documentation

Minimalist game framework using rust. Currently has systems for:

Documentation

Setup

Linux

Due to the crate alsa-sys being use for linux the following packages are required:

Debian/Ubuntu etc

apt install libasound2-dev pkg-config

Fedora/RHEL/CentOS

dnf install alsa-lib-devel

Usage

Example of a basis for a game:

extern crate caper;

use caper::game::*;
use caper::imgui::Ui;
use caper::input::Key;
use caper::mesh::gen_cube;
use caper::types::{DefaultTag, RenderItemBuilder, TransformBuilder};
use caper::utils::handle_fp_inputs;

fn main() {
    // crate an instance of the game struct
    let (mut game, event_loop) = Game::<DefaultTag>::new();

    // define some items to be rendered
    game.add_render_item(
        RenderItemBuilder::default()
            .vertices(gen_cube())
            .instance_transforms(vec![TransformBuilder::default()
                .pos((-0.5, 0.0, -5.0))
                .build()
                .unwrap()])
            .build()
            .unwrap(),
    );

    // run the engine update
    start_loop(event_loop, move |events| {
        game.update(
            |_: &Ui| {},
            |g: &mut Game<DefaultTag>| -> UpdateStatus {
                // update the first person inputs
                handle_fp_inputs(&mut g.input, &mut g.cams[0]);

                // quit
                if g.input.keys_down.contains(&Key::Escape) {
                    return UpdateStatus::Finish;
                }

                UpdateStatus::Continue
            },
            events,
        )
    });
}

Check out the examples and run with:

cargo run --example transforms

License

Dependencies

~30MB
~442K SLoC