[][src]Struct amethyst::CoreApplication

pub struct CoreApplication<'a, T, E = StateEvent, R = StateEventReader> where
    T: DataDispose + 'static,
    E: 'static, 
{ /* fields omitted */ }

CoreApplication is the application implementation for the game engine. This is fully generic over the state type and event type.

When starting out with Amethyst, use the type alias Application, which have sensible defaults for the Event and EventReader generic types.

Type parameters:

Methods

impl<'a, T, E, R> CoreApplication<'a, T, E, R> where
    T: DataDispose + 'static,
    E: Clone + Send + Sync + 'static, 
[src]

pub fn new<P, S, I>(path: P, initial_state: S, init: I) -> Result<Self, Error> where
    P: AsRef<Path>,
    S: State<T, E> + 'a,
    I: DataInit<T>,
    R: EventReader<'b, Event = E>,
    R: Default
[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 EmptyState 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, T, E, R>, Error> where
    P: AsRef<Path>,
    S: State<T, E> + 'a,
    R: EventReader<'b, Event = E>, 
[src]

Creates a new ApplicationBuilder with the given initial game state.

This is identical in function to ApplicationBuilder::new.

pub fn run(&mut self) where
    R: EventReader<'b, Event = E>, 
[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, T, E, R> Debug for CoreApplication<'a, T, E, R> where
    T: DataDispose + 'static,
    E: 'static,
    T: Debug,
    E: Debug
[src]

Auto Trait Implementations

impl<'a, T, E = StateEvent<StringBindings>, R = StateEventReader<StringBindings>> !Send for CoreApplication<'a, T, E, R>

impl<'a, T, E = StateEvent<StringBindings>, R = StateEventReader<StringBindings>> !Sync for CoreApplication<'a, T, E, R>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Any for T where
    T: Any

impl<T> Erased for T

impl<T> Supports for T

impl<S, D, Swp, Dwp, T> AdaptInto for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

fn adapt_into(self) -> D[src]

Convert the source color to the destination color using the bradford method by default Read more

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err