Struct amethyst::prelude::Application [−][src]
pub struct Application<'a, T> { /* 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.
Methods
impl<'a, T> Application<'a, T>[src]
impl<'a, T> Application<'a, T>pub fn new<P, S, I>(
path: P,
initial_state: S,
init: I
) -> Result<Application<'a, T>> where
P: AsRef<Path>,
S: State<T> + 'a,
I: DataInit<T>, [src]
pub fn new<P, S, I>(
path: P,
initial_state: S,
init: I
) -> Result<Application<'a, T>> where
P: AsRef<Path>,
S: State<T> + 'a,
I: DataInit<T>, 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 theStatetrait. e.g. Your initial game logic.
Lifetimes
a: The lifetime of theStateobjects.b: This lifetime is inherited fromspecsandshred, it is the minimum lifetime of the systems used byApplication
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();
pub fn build<P, S>(path: P, initial_state: S) -> Result<ApplicationBuilder<S>> where
P: AsRef<Path>,
S: State<T>, [src]
pub fn build<P, S>(path: P, initial_state: S) -> Result<ApplicationBuilder<S>> where
P: AsRef<Path>,
S: State<T>, Creates a new ApplicationBuilder with the given initial game state.
This is identical in function to ApplicationBuilder::new.
pub fn run(&mut self)[src]
pub fn run(&mut self)Trait Implementations
impl<'a, T> Debug for Application<'a, T> where
T: Debug, [src]
impl<'a, T> Debug for Application<'a, T> where
T: Debug, Auto Trait Implementations
impl<'a, T> !Send for Application<'a, T>
impl<'a, T> !Send for Application<'a, T>impl<'a, T> !Sync for Application<'a, T>
impl<'a, T> !Sync for Application<'a, T>