1 #ifndef NTA_SCREEN_H_INCLUDED
2 #define NTA_SCREEN_H_INCLUDED
4 #include "nta/Window.h"
5 #include "nta/InputManager.h"
10 enum class ScreenState{NONE, RUNNING, SWITCH, SWITCH_ESC, SWITCH_X};
72 Screen(crstring name =
"UNAMED_SCREEN");
80 int getXIndex()
const;
81 int getNextIndex()
const;
100 virtual void init() = 0;
101 void close() {
m_state = ScreenState::SWITCH_X; }
102 void esc() {
m_state = ScreenState::SWITCH_ESC; }
106 #endif // NTA_SCREEN_H_INCLUDED
std::string getName() const
gets name of screen
Window * m_window
the Window this Screen appears on
void setManager(ScreenManager *manager, SetManagerKey key)
Sets the manager of this screen.
void setWindow(crstring title, SetWindowKey key)
sets the window to associate with this screen
Key unlocking the setManager() "private" function of class Screen.
virtual void render()=0
renders screen
Info passed to Screen::onFocus.
void setIndices(int index, int escIndex, int xIndex, SetIndicesKey key)
sets various screen indices
virtual void offFocus()
called when the screen is no longer active
ScreenState m_state
the state of this screen
Screen(crstring name="UNAMED_SCREEN")
basic constructor and destructor
std::string m_name
the name of the Screen
ScreenManager * m_manager
the ScreenManager that owns this screen
virtual void onFocus(const ScreenSwitchInfo &info)
called when the screen becomes active
void * m_switchData
data to pass to the new screen (via onFocus) when m_state == SWITCH
int m_nextIndex
the index of the screen to go to when m_state == SWITCH
int m_index
the index of this screen in its container
int fromIndex
the index of the screen switched from
ScreenState getState() const
returns state of screen
Key unlocking the setWindow() "private" function of class Screen.
Represents a game screen.
int m_escIndex
the index of the screen to go to when the Esc key is pressed
virtual void init()=0
initializes the screen
Key unlocking the setIndices() "private" function of class Screen.
void * data
arbitrary data to pass along
void * getSwitchData() const
gets the switch data (shoudl this require a key?)
virtual void update()=0
updates screen
int m_xIndex
the index of the screen to go to when the window's X button is pressed
int getEscIndex() const
gets various screen indices