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, _: &mut World) {
        println!("Starting game!");
    }

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

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

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

Reexports

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_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 shred;
pub extern crate shrev;
pub extern crate specs as ecs;
pub extern crate winit;

Modules

prelude

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

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.

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.