Struct amethyst::CoreApplication[][src]

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:

Implementations

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 CoreApplication 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 CoreApplication 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 CoreApplication

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 assets_dir = "assets/";
let mut game = Application::new(assets_dir, NullState, ())?;
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>> !RefUnwindSafe for CoreApplication<'a, T, E, R>[src]

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

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

impl<'a, T, E, R> Unpin for CoreApplication<'a, T, E, R> where
    E: Unpin,
    R: Unpin,
    T: Unpin
[src]

impl<'a, T, E = StateEvent<StringBindings>, R = StateEventReader<StringBindings>> !UnwindSafe for CoreApplication<'a, T, E, R>[src]

Blanket Implementations

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

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

impl<T> Any for T where
    T: Any

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

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

impl<T> From<T> for T[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SetParameter for T

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

impl<T> Supports<T> for T

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>,