Struct amethyst::Application [] [src]

pub struct Application<'a, 'b> {
    pub world: World,
    // some fields omitted
}

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.

Since Application functions as the root of the game, Amethyst does not need to use any global variables. Within this object is everything that your game needs to run.

Fields

The world

Methods

impl<'a, 'b> Application<'a, 'b>
[src]

[src]

Creates a new Application with the given initial game state. This will create and allocate all the needed resources for the event loop of the game engine. It is a shortcut for convenience if you need more control over how the engine is configured you should be using build instead.

Parameters

  • path: The default path for asset loading.

  • initial_state: The initial State handler of your game See State for more information on what this is.

Returns

Returns a Result type wrapping the Application type. See errors for a full list of possible errors that can happen in the creation of a Application object.

Type Parameters

  • P: The path type for your standard asset path.

  • S: A type that implements the State trait. e.g. Your initial game logic.

Lifetimes

  • a: The lifetime of the State objects.
  • b: This lifetime is inherited from specs and shred, it is the minimum lifetime of the systems used by Application

Errors

Application will return an error if the internal thread pool fails to initialize correctly because of systems resource limitations

Examples

use amethyst::prelude::*;

struct NullState;
impl State for NullState {}

let mut game = Application::new("assets/", NullState).expect("Failed to initialize");
game.run();

[src]

Creates a new ApplicationBuilder with the given initial game state.

This is identical in function to ApplicationBuilder::new.

[src]

Run the gameloop until the game state indicates that the game is no longer running. This is done via the State returning Trans::Quit or Trans::Pop on the last state in from the stack. See full documentation on this in State documentation.

Examples

See the example supplied in the new method.

Trait Implementations

impl<'a, 'b> Debug for Application<'a, 'b>
[src]

[src]

Formats the value using the given formatter.