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::{Application, Event, State, Trans, VirtualKeyCode, WindowEvent}; use amethyst::asset_manager::AssetManager; use amethyst::config::Element; use amethyst::ecs::World; use amethyst::gfx_device::DisplayConfig; use amethyst::renderer::Pipeline; struct GameState; impl State for GameState { fn on_start(&mut self, _: &mut World, _: &mut AssetManager, pipe: &mut Pipeline) { use amethyst::renderer::pass::Clear; use amethyst::renderer::Layer; let clear_layer = Layer::new("main", vec![ Clear::new([0.0, 0.0, 0.0, 1.0]), ]); pipe.layers.push(clear_layer); } fn handle_events(&mut self, events: &[WindowEvent], _: &mut World, _: &mut AssetManager, _: &mut Pipeline) -> Trans { for e in events { match e.payload { Event::KeyboardInput(_, _, Some(VirtualKeyCode::Escape)) => return Trans::Quit, Event::Closed => return Trans::Quit, _ => (), } } Trans::None } } fn main() { let path = format!("{}/examples/01_window/resources/config.yml", env!("CARGO_MANIFEST_DIR")); let cfg = DisplayConfig::from_file(path).expect("Could not find config!"); let mut game = Application::build(GameState, cfg).done(); game.run(); }
Reexports
pub extern crate amethyst_config as config; |
pub extern crate amethyst_renderer as renderer; |
Modules
asset_manager |
Asset manager used to load assets (like |
ecs |
|
gfx_device |
Structs and enums holding graphics resources like |
Structs
Application |
User-friendly facade for building games. Manages main loop. |
ApplicationBuilder |
Helper builder for Applications. |
StateMachine |
A simple stack-based state machine (pushdown automaton). |
Touch |
Represents touch event |
WindowEvent |
A window-generated event. |
Enums
ElementState | |
Event | |
MouseButton | |
MouseScrollDelta | |
Stopwatch |
A stopwatch which accurately measures elapsed time. |
TouchPhase | |
Trans |
Types of state transitions. |
VirtualKeyCode |
Traits
State |
A trait which defines game states that can be used by the state machine. |
Type Definitions
ScanCode |