spottedcat 1.0.3

Rusty SpottedCat simple game engine
Documentation

Spottedcat

A lightweight cross-platform 2D/3D game engine for Rust.

Crates.io docs.rs Example Checks License

Spottedcat provides a small Spot lifecycle, 2D images and text, optional 3D models and effects, input, audio, and desktop/Web/iOS/Android targets.

Install

[dependencies]
spottedcat = "1.0.3"

Enable optional capabilities as needed:

spottedcat = { version = "1.0.3", features = ["model-3d", "utils", "gltf", "effects", "sensors"] }

See the feature guide for details.

Quick start

use spottedcat::{Context, DrawOption, Image, Pt, Spot, WindowConfig};
use std::time::Duration;

struct Game {
    tile: Image,
}

impl Spot for Game {
    fn initialize(ctx: &mut Context) -> Self {
        let pixels = vec![255; 64 * 64 * 4];
        Self {
            tile: Image::new(ctx, Pt(64.0), Pt(64.0), &pixels).unwrap(),
        }
    }

    fn update(&mut self, _ctx: &mut Context, _dt: Duration) {}

    fn draw(&mut self, ctx: &mut Context, screen: Image) {
        let (width, height) = spottedcat::window_size(ctx);
        screen.draw(
            ctx,
            &self.tile,
            DrawOption::default().with_position([width / 2.0, height / 2.0]),
        );
    }

    fn remove(&mut self, _ctx: &mut Context) {}
}

fn main() {
    spottedcat::run::<Game>(WindowConfig::default());
}

update uses a configurable fixed step (60 Hz by default), while rendering follows the display refresh rate. See Core Concepts for lifecycle and timing details.

Development

cargo test --all-features
make check-examples

License

Licensed under either Apache-2.0 or MIT, at your option.