1 #ifndef NTA_SCREENMANAGER_H_INCLUDED
2 #define NTA_SCREENMANAGER_H_INCLUDED
7 #include "nta/Screen.h"
8 #include "nta/FPSLimiter.h"
9 #include "nta/Window.h"
10 #include "nta/InputManager.h"
11 #include "nta/ContextData.h"
21 static std::mutex m_window_creation_lock;
39 ScreenManager(crstring title,
float maxFPS,
int width = 640,
int height = 480);
60 void addScreen(
Screen* newScreen,
int escIndex = -1,
int xIndex = -1, crstring title =
"");
68 void run(
void* initFocusData =
nullptr);
72 #endif // NTA_SCREENMANAGER_H_INCLUDED
void run(void *initFocusData=nullptr)
void addScreen(Screen *newScreen, int escIndex=-1, int xIndex=-1, crstring title="")
adds a screen and sets some of its properties
int m_currScreen
the index of the currently active screen
~ScreenManager()
basic destructor
void setResourceFolders(const utils::Path &tex_fldr, const utils::Path &glsl_fldr, const utils::Path &font_fldr)
Sets the location of textures, shaders, and fonts.
static std::mutex m_event_lock
Lock for access the event queue.
FPSLimiter m_limiter
used to cap the FPS
const InputManager & getInput() const
returns the InputManager
void destroy()
destroys screens
A (case-sensitive) Path in a file system.
ScreenManager(crstring title, float maxFPS, int width=640, int height=480)
sets the max fps and the window to use
std::vector< Screen * > m_screens
the screens
Screen * getCurrScreen() const
returns the active screen
bool owns_event(const SDL_Event &event) const
void update_input()
Updates the state of m_input.
Represents a game screen.
ContextData m_context_data
GLTextures and GLSLPrograms and whatnot.
Window * m_window
the main window used by the manager
InputManager m_input
Keeps track of all input received in this window.
used to cap the fps of the program at a specific value
const Window * getWindow() const
returns the window
void switchScreen(int newIndex)
switches the to a new screen
ContextData & getContextData()
returns the ContextData
float getFPS() const
returns the current fps