add is_empty method to States
this is intended to allow a game loop to determine if the state manager is actually doing anything or not, allowing the game loop to exit out when it determines if there are no states and no more pending states.
This commit is contained in:
parent
4e291f33dc
commit
2f23bc5ce1
|
@ -164,6 +164,11 @@ impl<ContextType> States<ContextType> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.states.is_empty() && self.pending_state.is_none() && self.command.is_none()
|
||||
}
|
||||
|
||||
fn can_push_or_pop(&self) -> bool {
|
||||
if let Some(state) = self.states.front() {
|
||||
if state.current_state != State::Active {
|
||||
|
|
Loading…
Reference in a new issue