Crate amethyst [] [src]

Amethyst is a free and open source SDK (software development kit) written in idiomatic Rust for building video games and interactive multimedia applications.

This project is a work in progress and is very incomplete. Pardon the dust!

Example

extern crate amethyst;

use amethyst::*;

struct GameState;

impl State for GameState {
    fn new() -> GameState {
        GameState
    }

    fn handle_events(&mut self, game: &Game, events: &Vec<Event>) {
        for e in events {
            match e {
                Event::Closed => game.quit(),
                Event::Resized(x, y) => println!("x: {}, y: {}", x, y),
                Event::KeyPressed(k) => if k == Key::Esc { game.quit() },
            }
        }
    }

    fn update(&mut self, game: &Game, delta: Duration) {
        println!("Computing some more whoop-ass...");
    }
}

fn main() {
    let mut game = Application::new(GameState::new());
    game.run();
}

Modules

renderer

High level rendering engine with multiple backends.

Structs

Application

User-friendly facade for building games. Manages main loop.

Duration

ISO 8601 time duration with nanosecond precision. This also allows for the negative duration; see individual methods for details.

StateMachine

A simple stack-based state machine.

Stopwatch

Useful utility for accurately measuring elapsed time.

Enums

Trans

Types of state transitions.

Traits

State

A trait which defines game states that can be used by the state machine.