Struct amethyst::prelude::CoreApplication [−][src]
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:
T
:State
E
:Event
type that should be sent to the statesR
:EventReader
implementation for the given event typeE
Implementations
impl<'a, T, E, R> CoreApplication<'a, T, E, R> where
T: DataDispose + 'static,
E: Clone + Send + Sync + 'static,
[src]
T: DataDispose + 'static,
E: Clone + Send + Sync + 'static,
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]
P: AsRef<Path>,
S: State<T, E> + 'a,
I: DataInit<T>,
R: EventReader<'b, Event = E>,
R: Default,
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 theState
trait. e.g. Your initial game logic.
Lifetimes
a
: The lifetime of theState
objects.b
: This lifetime is inherited fromspecs
andshred
, it is the minimum lifetime of the systems used byCoreApplication
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]
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>,
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]
R: EventReader<'b, Event = E>,
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]
T: DataDispose + 'static,
E: 'static,
T: Debug,
E: Debug,
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]
E: Unpin,
R: Unpin,
T: Unpin,
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]
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
pub fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
pub fn adapt_into(self) -> D
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
T: Any,
pub fn get_type_id(&self) -> TypeId
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SetParameter for T
pub fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub unsafe fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> Supports<T> for T
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,