jubilant-funicular
|
#include <ScreenManager.h>
Public Member Functions | |
ScreenManager (crstring title, float maxFPS, int width=640, int height=480) | |
sets the max fps and the window to use | |
~ScreenManager () | |
basic destructor | |
Screen * | getCurrScreen () const |
returns the active screen More... | |
const Window * | getWindow () const |
returns the window | |
const InputManager & | getInput () const |
returns the InputManager | |
ContextData & | getContextData () |
returns the ContextData | |
float | getFPS () const |
returns the current fps | |
bool | owns_event (const SDL_Event &event) const |
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. | |
void | addScreen (Screen *newScreen, int escIndex=-1, int xIndex=-1, crstring title="") |
adds a screen and sets some of its properties | |
void | switchScreen (int newIndex) |
switches the to a new screen | |
void | destroy () |
destroys screens | |
void | run (void *initFocusData=nullptr) |
Private Member Functions | |
void | update_input () |
Updates the state of m_input. | |
Private Attributes | |
std::vector< Screen * > | m_screens |
the screens | |
ContextData | m_context_data |
GLTextures and GLSLPrograms and whatnot. | |
InputManager | m_input |
Keeps track of all input received in this window. | |
FPSLimiter | m_limiter |
used to cap the FPS | |
Window * | m_window |
the main window used by the manager | |
int | m_currScreen = -1 |
the index of the currently active screen | |
Static Private Attributes | |
static std::mutex | m_window_creation_lock |
static std::mutex | m_event_lock |
Lock for access the event queue. | |
Manages a collection of screens
Definition at line 16 of file ScreenManager.h.
Screen * nta::ScreenManager::getCurrScreen | ( | ) | const |
returns the active screen
Definition at line 28 of file ScreenManager.cpp.
Referenced by run(), switchScreen(), and update_input().
bool nta::ScreenManager::owns_event | ( | const SDL_Event & | event | ) | const |
returns true if this manager is responsible for handling the event
Definition at line 79 of file ScreenManager.cpp.
Referenced by update_input().
void nta::ScreenManager::run | ( | void * | initFocusData = nullptr | ) |
runs screen logic (render, update, handleInput, etc.)
initFocusData is the input to onFocus for the first screen
Definition at line 141 of file ScreenManager.cpp.