pub enum GameState {
Loading,
Menu,
Playing,
Paused,
GameOver,
}Expand description
Game state machine for managing game modes
Variants§
Loading
Initial loading state
Menu
Main menu
Playing
Active gameplay
Paused
Game paused
GameOver
Game over screen
Implementations§
Source§impl GameState
impl GameState
Sourcepub const fn should_render_world(&self) -> bool
pub const fn should_render_world(&self) -> bool
Checks if this state should render the game world
Sourcepub const fn can_transition_to(&self, target: &Self) -> bool
pub const fn can_transition_to(&self, target: &Self) -> bool
Attempts to transition to a new state
Returns true if the transition is valid.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GameState
impl<'de> Deserialize<'de> for GameState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for GameState
impl StructuralPartialEq for GameState
Auto Trait Implementations§
impl Freeze for GameState
impl RefUnwindSafe for GameState
impl Send for GameState
impl Sync for GameState
impl Unpin for GameState
impl UnwindSafe for GameState
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
Mutably borrows from an owned value. Read more