Crate amethyst [] [src]

Amethyst is a free and open source game engine written in idiomatic Rust for building video games and interactive multimedia applications. The source code is available for download on GitHub. See the online book for a complete guide to using Amethyst.

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

Example

extern crate amethyst;

use amethyst::prelude::*;

struct GameState;

impl State for GameState {
    fn on_start(&mut self, _: &mut Engine) {
        println!("Starting game!");
    }

    fn handle_event(&mut self, _: &mut Engine, event: &Event) -> Trans {
        match event {
            Event::Window(e) => match e {
                WindowEvent::KeyboardInput(_, _, Some(Key::Escape), _) |
                WindowEvent::Closed => Trans::Quit,
                _ => Trans::None,
            }
            _ => Trans::None,
        }
    }

    fn update(&mut self, _: &mut Engine) -> Trans {
        println!("Computing some more whoop-ass...");
    }
}

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

Reexports

pub extern crate amethyst_config as config;
pub extern crate amethyst_renderer as renderer;
pub extern crate amethyst_input as input;

Modules

assets

Re-exports amethyst_assets and provides formats specific to the engine.

audio

Loading and playing of audio files.

ecs

amethyst engine built-in types for specs.

event

This module contains the WindowEvent type and re-exports glutin event types.

prelude

Contains common types that can be glob-imported (*) for convenience.

timing

Utilities for working with time.

Structs

Application

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

ApplicationBuilder

Helper builder for Applications.

Engine

User-facing engine handle.

StateMachine

A simple stack-based state machine (pushdown automaton).

Enums

Error

Common error type.

Trans

Types of state transitions.

Traits

State

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

Type Definitions

Result

Engine result type.