GameKit  0.0.1a
C++ gamedev tools
ApplicationStateStack.cpp
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: ApplicationStateStack.cpp
5  *
6  * Description:
7  *
8  * Created: 14/06/2018 01:58:34
9  *
10  * Author: Quentin Bazin, <quent42340@gmail.com>
11  *
12  * =====================================================================================
13  */
15 
16 namespace gk {
17 
18 ApplicationStateStack *ApplicationStateStack::s_instance = nullptr;
19 
21  m_trash.push(m_states.top());
22  m_states.pop();
23 }
24 
26  while (!m_trash.empty())
27  m_trash.pop();
28 }
29 
30 } // namespace gk
31 
std::stack< std::shared_ptr< ApplicationState > > m_trash
Removed states waiting to be deleted.
void pop()
Remove the top ApplicationState in the stack.
void clearDeletedStates()
Clear the removed states of the stack.
static ApplicationStateStack * s_instance
Current singleton instance.
std::stack< std::shared_ptr< ApplicationState > > m_states
Stack containing the states.