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::*;
use amethyst::renderer::{Event, KeyboardInput, VirtualKeyCode, WindowEvent};

struct GameState;

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

    fn handle_event(&mut self, _: StateData<()>, event: Event) -> Trans<()> {
        match event {
            Event::WindowEvent { event, .. } => match event {
                WindowEvent::KeyboardInput {
                    input: KeyboardInput { virtual_keycode: Some(VirtualKeyCode::Escape), .. }, ..
                } |
                WindowEvent::CloseRequested => Trans::Quit,
                _ => Trans::None,
            },
            _ => Trans::None,
        }
    }

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

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

Re-exports

pub extern crate amethyst_animation as animation;
pub extern crate amethyst_assets as assets;
pub extern crate amethyst_audio as audio;
pub extern crate amethyst_config as config;
pub extern crate amethyst_controls as controls;
pub extern crate amethyst_core as core;
pub extern crate amethyst_input as input;
pub extern crate amethyst_renderer as renderer;
pub extern crate amethyst_ui as ui;
pub extern crate amethyst_utils as utils;
pub extern crate winit;

Modules

ecs

SPECS Parallel ECS

prelude

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

shred

Shared resource dispatcher

shrev

Event channel, pull based, that use a ringbuffer for internal storage, to make it possible to do immutable reads.

Structs

Application

An Application is the root object of the game engine. It binds the OS event loop, state machines, timers and other core components in a central place.

ApplicationBuilder

ApplicationBuilder is an interface that allows for creation of an Application using a custom set of configuration. This is the normal way an Application object is created.

GameData

Default game data

GameDataBuilder

Builder for default game data

StateData

State data encapsulates the data sent to all state functions from the application main loop.

StateMachine

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

Enums

Error

Common error type.

Trans

Types of state transitions.

Traits

DataInit

Initialise trait for game data

State

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

Type Definitions

Result

Engine result type.