[][src]Struct amethyst_test::AmethystApplication

pub struct AmethystApplication<T, E, R> where
    E: Send + Sync + 'static, 
{ /* fields omitted */ }

Builder for an Amethyst application.

This provides varying levels of setup so that users do not have to register common bundles.

Type Parameters

Implementations

impl AmethystApplication<GameData<'static, 'static>, StateEvent, StateEventReader>[src]

pub fn blank(
) -> AmethystApplication<GameData<'static, 'static>, StateEvent, StateEventReader>
[src]

Returns an Amethyst application without any bundles.

pub fn ui_base<B: BindingTypes>(
) -> AmethystApplication<GameData<'static, 'static>, StateEvent, StateEventReader>
[src]

Returns an application with the Transform, Input, and UI bundles.

This also adds a ScreenDimensions resource to the World so that UI calculations can be done.

pub fn assets_dir() -> Result<PathBuf, Error>[src]

Returns a PathBuf to <crate_dir>/assets.

impl<E, R> AmethystApplication<GameData<'static, 'static>, E, R> where
    E: Clone + Send + Sync + 'static,
    R: Default
[src]

pub fn build(
    self
) -> Result<CoreApplication<'static, GameData<'static, 'static>, E, R>, Error> where
    R: EventReader<'b, Event = E>, 
[src]

Returns the built Application.

If you are intending to run the Application, you can use the run() or run_isolated() methods instead.

pub fn run(self) -> Result<(), Error> where
    R: EventReader<'b, Event = E>, 
[src]

Runs the application and returns Ok(()) if nothing went wrong.

pub fn run_isolated(self) -> Result<(), Error> where
    R: EventReader<'b, Event = E>, 
[src]

Run the application in a sub thread.

Historically this has been used for the following reasons:

  • To avoid segmentation faults using X and mesa.
  • To avoid multiple threads sharing the same memory in Vulkan.

This must NOT be used when including the AudioBundle on Windows, as it causes a segfault.

impl<T, E, R> AmethystApplication<T, E, R> where
    T: GameUpdate + 'static,
    E: Send + Sync + 'static,
    R: 'static, 
[src]

pub fn with_custom_event_type<Evt, Rdr>(
    self
) -> AmethystApplication<T, Evt, Rdr> where
    Evt: Send + Sync + 'static,
    Rdr: EventReader<'b, Event = Evt>, 
[src]

Use the specified custom event type instead of ().

This must be invoked before any of the .with_*() function calls as the custom event type parameter is changed, so we are unable to bring any of the existing parameters across.

Type Parameters

  • Evt: Type used for state events.
  • Rdr: Event reader of the state events.

pub fn with_bundle<B>(self, bundle: B) -> Self where
    B: SystemBundle<'static, 'static> + Send + 'static, 
[src]

Adds a bundle to the list of bundles.

Parameters

  • bundle: Bundle to add.

pub fn with_bundle_fn<FnBundle, B>(self, bundle_function: FnBundle) -> Self where
    FnBundle: FnOnce() -> B + Send + 'static,
    B: SystemBundle<'static, 'static> + 'static, 
[src]

Adds a bundle to the list of bundles.

This provides an alternative to .with_bundle(B) where B is !Send. The function that instantiates the bundle must be Send.

Parameters

  • bundle_function: Function to instantiate the Bundle.

pub fn with_ui_bundles<B: BindingTypes>(self) -> Self[src]

Registers InputBundle and UiBundle with this application.

This method is provided to avoid [stringly-typed][stringly] parameters for the Input and UI bundles. We recommended that you use strong types instead of <StringBindings>.

Type Parameters

  • B: Type representing the input binding types.

pub fn with_resource<Res>(self, resource: Res) -> Self where
    Res: Resource, 
[src]

Adds a resource to the World.

Parameters

  • resource: Bundle to add.

pub fn with_state<S, FnStateLocal>(self, state_fn: FnStateLocal) -> Self where
    S: State<T, E> + 'static,
    FnStateLocal: FnOnce() -> S + Send + Sync + 'static, 
[src]

Adds a state to run in the Amethyst application.

Parameters

  • state_fn: State to use.

pub fn with_system<S, N>(self, system: S, name: N, deps: &[N]) -> Self where
    S: for<'sys_local> System<'sys_local> + Send + 'static,
    N: Into<String> + Clone
[src]

Registers a System into this application's GameData.

Parameters

  • system: System to run.
  • name: Name to register the system with, used for dependency ordering.
  • deps: Names of systems that must run before this system.

pub fn with_system_desc<SD, S, N>(
    self,
    system_desc: SD,
    name: N,
    deps: &[N]
) -> Self where
    SD: SystemDesc<'static, 'static, S> + Send + Sync + 'static,
    S: for<'sys_local> System<'sys_local> + Send + 'static,
    N: Into<String> + Clone
[src]

Registers a System into this application's GameData.

Parameters

  • system_desc: Descriptor to instantiate the System.
  • name: Name to register the system with, used for dependency ordering.
  • deps: Names of systems that must run before this system.

pub fn with_thread_local<RNDesc, RN>(self, run_now_desc: RNDesc) -> Self where
    RNDesc: RunNowDesc<'static, 'static, RN> + Send + Sync + 'static,
    RN: for<'sys_local> RunNow<'sys_local> + Send + 'static, 
[src]

Registers a thread local System into this application's GameData.

Parameters

  • run_now_desc: Descriptor to instantiate the thread local system.

pub fn with_system_single<S, N>(self, system: S, name: N, deps: &[N]) -> Self where
    S: for<'sys_local> System<'sys_local> + Send + Sync + 'static,
    N: Into<String> + Clone
[src]

Registers a System to run in a CustomDispatcherState.

This will run the system once in a dedicated State, allowing you to inspect the effects of the system after setting up the world to a desired state.

Parameters

  • system: System to run.
  • name: Name to register the system with, used for dependency ordering.
  • deps: Names of systems that must run before this system.

pub fn with_system_desc_single<SD, S, N>(
    self,
    system_desc: SD,
    name: N,
    deps: &[N]
) -> Self where
    SD: SystemDesc<'static, 'static, S> + Send + Sync + 'static,
    S: for<'sys_local> System<'sys_local> + Send + Sync + 'static,
    N: Into<String> + Clone
[src]

Registers a System to run in a CustomDispatcherState.

This will run the system once in a dedicated State, allowing you to inspect the effects of the system after setting up the world to a desired state.

Parameters

  • system_desc: Descriptor to instantiate the System.
  • name: Name to register the system with, used for dependency ordering.
  • deps: Names of systems that must run before this system.

pub fn with_fn<F>(self, func: F) -> Self where
    F: FnOnce(&mut World) + Send + Sync + 'static, 
[src]

Registers a function to run in the World.

Parameters

  • func: Function to execute.

pub fn with_setup<F>(self, setup_fn: F) -> Self where
    F: FnOnce(&mut World) + Send + 'static, 
[src]

Registers a function that sets up the World.

This is an alias to .with_fn(F).

Parameters

  • setup_fn: Function to execute.

pub fn with_effect<F>(self, effect_fn: F) -> Self where
    F: FnOnce(&mut World) + Send + Sync + 'static, 
[src]

Registers a function that executes a desired effect.

This is an alias to .with_fn(F).

Parameters

  • effect_fn: Function that executes an effect.

pub fn with_assertion<F>(self, assertion_fn: F) -> Self where
    F: FnOnce(&mut World) + Send + Sync + 'static, 
[src]

Registers a function to assert an expected outcome.

This is an alias to .with_fn(F).

Parameters

  • assertion_fn: Function that asserts the expected state.

Trait Implementations

impl<T, E, R> Debug for AmethystApplication<T, E, R> where
    E: Send + Sync + 'static, 
[src]

impl<T: Default, E: Default, R: Default> Default for AmethystApplication<T, E, R> where
    E: Send + Sync + 'static, 
[src]

Auto Trait Implementations

impl<T, E, R> !RefUnwindSafe for AmethystApplication<T, E, R>

impl<T, E, R> !Send for AmethystApplication<T, E, R>

impl<T, E, R> !Sync for AmethystApplication<T, E, R>

impl<T, E, R> Unpin for AmethystApplication<T, E, R> where
    E: Unpin,
    R: Unpin,
    T: Unpin

impl<T, E, R> !UnwindSafe for AmethystApplication<T, E, R>

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[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> 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> TryDefault for T where
    T: Default

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