BARE2D
BARE2D::App Class Reference

#include <App.hpp>

+ Collaboration diagram for BARE2D::App:

Public Member Functions

 App ()
 
 ~App ()
 
void run ()
 Runs the program! Starts the update-draw loop. More...
 
ScreenListgetScreenList ()
 Returns the screen list, where the program can add more screens, set entry points, etc. More...
 
WindowgetWindow ()
 
InputManagergetInputManager ()
 

Private Member Functions

void init ()
 Initializes the applet and engine. Creates a window, held within this App. Only for internal use. More...
 
void update (double dt)
 Updates input, output, etc. Only for internal use. More...
 
void draw ()
 Draws the current screen, based on that screen's drawing protocol. More...
 
void updateInput ()
 Updates any input, and throws it down the pipeline! More...
 
void pollSDLInput ()
 Polls inputs from SDL and updates the inputmanager as appropriate. More...
 
void exitApp ()
 Calls the screen's exit function, and then cleans this class up for destruction. More...
 

Private Attributes

bool m_isGameRunning = false
 
bool m_isInited = false
 
std::unique_ptr< ScreenListm_screenList
 
InputManagerm_inputManager = nullptr
 
Timerm_timer = nullptr
 
Windowm_window = nullptr
 

Detailed Description

Definition at line 19 of file App.hpp.

Constructor & Destructor Documentation

◆ App()

BARE2D::App::App ( )

Definition at line 15 of file App.cpp.

References init().

+ Here is the call graph for this function:

◆ ~App()

BARE2D::App::~App ( )

Definition at line 19 of file App.cpp.

References exitApp(), m_inputManager, m_isGameRunning, m_screenList, m_timer, and m_window.

+ Here is the call graph for this function:

Member Function Documentation

◆ draw()

void BARE2D::App::draw ( )
private

Draws the current screen, based on that screen's drawing protocol.

Definition at line 130 of file App.cpp.

References BARE2D::Window::getHeight(), BARE2D::Window::getWidth(), m_screenList, m_window, and BARE2D::RUNNING.

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exitApp()

void BARE2D::App::exitApp ( )
private

Calls the screen's exit function, and then cleans this class up for destruction.

Definition at line 179 of file App.cpp.

References m_isGameRunning.

Referenced by pollSDLInput(), update(), and ~App().

+ Here is the caller graph for this function:

◆ getInputManager()

InputManager * BARE2D::App::getInputManager ( )
Returns
The input manager pointer.

Definition at line 76 of file App.cpp.

References m_inputManager.

◆ getScreenList()

ScreenList * BARE2D::App::getScreenList ( )

Returns the screen list, where the program can add more screens, set entry points, etc.

Definition at line 68 of file App.cpp.

References m_screenList.

◆ getWindow()

Window * BARE2D::App::getWindow ( )
Returns
Returns a pointer to the window, so that the client can change its size, title, etc.

Definition at line 72 of file App.cpp.

References m_window.

◆ init()

void BARE2D::App::init ( )
private

Initializes the applet and engine. Creates a window, held within this App. Only for internal use.

Definition at line 80 of file App.cpp.

References BARE2D::Window::create(), BARE2D::DOUBLE_INIT, BARE2D::init(), m_inputManager, m_isInited, m_screenList, m_timer, m_window, BARE2D::Timer::setDeltaTimeLimit(), and BARE2D::throwFatalError().

Referenced by App(), and run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pollSDLInput()

void BARE2D::App::pollSDLInput ( )
private

Polls inputs from SDL and updates the inputmanager as appropriate.

Definition at line 145 of file App.cpp.

References exitApp(), BARE2D::BARECEGUI::getContext(), BARE2D::BARECEGUI::getInstance(), BARE2D::BARECEGUI::handleSDLEvent(), m_inputManager, BARE2D::InputManager::pressKey(), BARE2D::InputManager::releaseKey(), BARE2D::InputManager::setMousePosition(), and BARE2D::InputManager::setMouseScrollwheelPosition().

Referenced by updateInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

void BARE2D::App::run ( )

◆ update()

void BARE2D::App::update ( double  dt)
private

Updates input, output, etc. Only for internal use.

Definition at line 109 of file App.cpp.

References BARE2D::CHANGE_NEXT, BARE2D::CHANGE_PREV, BARE2D::EXIT_APPLICATION, exitApp(), m_screenList, BARE2D::RUNNING, and updateInput().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateInput()

void BARE2D::App::updateInput ( )
private

Updates any input, and throws it down the pipeline!

Definition at line 139 of file App.cpp.

References m_inputManager, pollSDLInput(), and BARE2D::InputManager::update().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ m_inputManager

InputManager* BARE2D::App::m_inputManager = nullptr
private

Definition at line 51 of file App.hpp.

Referenced by getInputManager(), init(), pollSDLInput(), updateInput(), and ~App().

◆ m_isGameRunning

bool BARE2D::App::m_isGameRunning = false
private

Definition at line 46 of file App.hpp.

Referenced by exitApp(), run(), and ~App().

◆ m_isInited

bool BARE2D::App::m_isInited = false
private

Definition at line 47 of file App.hpp.

Referenced by init(), and run().

◆ m_screenList

std::unique_ptr<ScreenList> BARE2D::App::m_screenList
private

Definition at line 49 of file App.hpp.

Referenced by draw(), getScreenList(), init(), run(), update(), and ~App().

◆ m_timer

Timer* BARE2D::App::m_timer = nullptr
private

Definition at line 53 of file App.hpp.

Referenced by init(), run(), and ~App().

◆ m_window

Window* BARE2D::App::m_window = nullptr
private

Definition at line 55 of file App.hpp.

Referenced by draw(), getWindow(), init(), run(), and ~App().


The documentation for this class was generated from the following files: