pub struct Game {
pub sessions: Sessions,
pub systems: GameSystems,
pub sorted_session_keys: Vec<Ustr>,
pub shared_resources: Vec<AtomicUntypedResource>,
}Expand description
The Game encompasses a complete bones game’s logic, independent of the renderer and IO
implementations.
Games are made up of one or more Sessions, each of which contains it’s own World and
SystemStages. These different sessions can be used for parts of the game with independent
states, such as the main menu and the gameplay.
Fields§
§sessions: SessionsThe sessions that make up the game.
systems: GameSystemsThe collection of systems that are associated to the game itself, and not a specific session.
sorted_session_keys: Vec<Ustr>List of sorted session keys.
These are only guaranteed to be sorted and up-to-date immediately after calling
Game::step().
Collection of resources that will have a shared instance of each be inserted into each session automatically.
Implementations§
source§impl Game
impl Game
sourcepub fn install_plugin<P: GamePlugin>(&mut self, plugin: P) -> &mut Self
pub fn install_plugin<P: GamePlugin>(&mut self, plugin: P) -> &mut Self
Install a GamePlugin.
Get the shared resource of a given type out of this Games shared resources.
Get the shared resource of a given type out of this Games shared resources.
Get the shared resource cell of a given type out of this Games shared resources.
Initialize a resource that will be shared across game sessions using it’s Default value
if it is not already initialized, and borrow it for modification.
Insert a resource that will be shared across all game sessions.
Note: This resource will only be visible in sessions that have not already initialized or access a resource of the same type locally.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Game
impl !RefUnwindSafe for Game
impl Send for Game
impl Sync for Game
impl Unpin for Game
impl !UnwindSafe for Game
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &World) -> T
fn from_world(_world: &World) -> T
Self using data from the given World.