Convenience template class for video games.
More...
#include <SDLApp.hpp>
|
| | SDLApp (void) |
| | Default constructor; initialize with the default set of hints.
|
| | SDLApp (uint32 flags) |
|
bool | app_state (void) const |
|
virtual bool | on_init (void) |
| virtual sint | Run (void) |
| virtual void | on_update (float) |
| | The application-level handler for logic.
|
| virtual void | on_draw (RenderWindow &) |
| | The application-level handler for rendering.
|
| virtual bool | running (void) |
| | Query status of the application state.
|
| uint32 | ticks (void) |
| | Obtain the current timestamp.
|
| virtual void | quit (void) |
| | End program execution.
|
|
void | set_app_state (bool state) |
|
bool | show_fps (void) const |
|
void | set_show_fps (bool toggle) |
| bool | toggle_fps (void) |
|
StateMachine * | state (void) const |
|
void | set_state_machine (StateMachine *mech) |
| void | set_event_handler (EventHandler &evt_handler) |
| | Install the event handler used by the interface.
|
|
|
virtual void | on_input_event (const Event &ev) |
| | Default event handler for input events.
|
| virtual void | on_app_quit (const Event &ev) |
| | The event handler for when a request for halting program execution occurs.
|
|
virtual void | on_window_shown (const Event &ev) |
|
virtual void | on_window_hidden (const Event &ev) |
|
virtual void | on_window_exposed (const Event &ev) |
|
virtual void | on_window_moved (const Event &ev) |
|
virtual void | on_window_resized (const Event &ev) |
|
virtual void | on_window_size_changed (const Event &ev) |
|
virtual void | on_window_minimized (const Event &ev) |
|
virtual void | on_window_maximized (const Event &ev) |
|
virtual void | on_window_restored (const Event &ev) |
|
virtual void | on_window_mouse_focus (const Event &ev) |
|
virtual void | on_window_mouse_focus_lost (const Event &ev) |
|
virtual void | on_window_keyboard_focus (const Event &ev) |
|
virtual void | on_window_keyboard_focus_lost (const Event &ev) |
| virtual void | on_window_close (const Event &ev) |
| | The event handler for when a request for closing a window occurs.
|
| virtual void | on_drag_drop (const Event &ev) |
| virtual void | on_render_targets_reset (const Event &ev) |
| virtual void | on_user_event (const Event &ev) |
| | The default event handler for user-defined events.
|
|
|
bool | initialize (uint32 flags) |
|
void | on_app_event (const Event &ev) |
|
void | process_event (const Event &ev) |
◆ raw_ptr
| typedef self_type* nom::SDLApp::raw_ptr |
◆ self_type
| typedef SDLApp nom::SDLApp::self_type |
◆ shared_ptr
| typedef std::shared_ptr<self_type> nom::SDLApp::shared_ptr |
◆ Hints
An enumeration of platform or application scope features available for explicit request of enabling or disabling.
| Enumerator |
|---|
| OSX_DISABLE_MINIMIZE_ON_LOSS_FOCUS | SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS.
|
| OSX_DISABLE_FULLSCREEN_SPACES | SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES.
|
Definition at line 61 of file SDLApp.hpp.
◆ SDLApp() [1/2]
| nom::SDLApp::SDLApp |
( |
void | | ) |
|
Default constructor; initialize with the default set of hints.
◆ SDLApp() [2/2]
| nom::SDLApp::SDLApp |
( |
uint32 | flags | ) |
|
◆ on_app_quit()
| virtual void nom::SDLApp::on_app_quit |
( |
const Event & | ev | ) |
|
|
protectedvirtual |
The event handler for when a request for halting program execution occurs.
- Note
- This event handles the system's default quit handler, i.e.: COMMAND + Q on Mac OS X and ALT + F4 on Windows.
◆ on_drag_drop()
| virtual void nom::SDLApp::on_drag_drop |
( |
const Event & | ev | ) |
|
|
protectedvirtual |
Drag 'N' Drop events
<key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleTypeName</key> <string>TTcards</string> <key>CFBundleTypeExtensions</key> <array> <string>json</string> </array> <key>CFBundleTypeIconFile</key> <string>TTcards</string> </dict> </array>
◆ on_draw()
The application-level handler for rendering.
- Todo
- Consider removing RenderTarget argument; I think we can get away with this!
◆ on_render_targets_reset()
| virtual void nom::SDLApp::on_render_targets_reset |
( |
const Event & | ev | ) |
|
|
protectedvirtual |
◆ on_update()
| virtual void nom::SDLApp::on_update |
( |
float | | ) |
|
|
virtual |
The application-level handler for logic.
◆ on_user_event()
| virtual void nom::SDLApp::on_user_event |
( |
const Event & | ev | ) |
|
|
protectedvirtual |
The default event handler for user-defined events.
◆ on_window_close()
| virtual void nom::SDLApp::on_window_close |
( |
const Event & | ev | ) |
|
|
protectedvirtual |
The event handler for when a request for closing a window occurs.
◆ quit()
| virtual void nom::SDLApp::quit |
( |
void | | ) |
|
|
virtual |
End program execution.
- Note
- Sets the internal class variable app_state_ to false.
◆ Run()
| virtual sint nom::SDLApp::Run |
( |
void | | ) |
|
|
virtual |
◆ running()
| virtual bool nom::SDLApp::running |
( |
void | | ) |
|
|
virtual |
Query status of the application state.
- Returns
- Boolean true or false.
◆ set_event_handler()
| void nom::SDLApp::set_event_handler |
( |
EventHandler & | evt_handler | ) |
|
Install the event handler used by the interface.
- Note
- The installed event handler must outlive the destruction of this interface!
◆ ticks()
| uint32 nom::SDLApp::ticks |
( |
void | | ) |
|
Obtain the current timestamp.
- Returns
- Number of ticks from the start of class construction.
◆ toggle_fps()
| bool nom::SDLApp::toggle_fps |
( |
void | | ) |
|
Helper method for toggling the state of nom::SDLApp::show_fps
- Returns
- State of nom::SDLApp::show_fps_ after call to nom::SDLApp::set_show_fps
◆ app_state_
| bool nom::SDLApp::app_state_ |
|
private |
Global application state.
Definition at line 250 of file SDLApp.hpp.
◆ app_timer_
| Timer nom::SDLApp::app_timer_ |
|
private |
Global application timer.
Definition at line 256 of file SDLApp.hpp.
◆ event_handler_
◆ show_fps_
| bool nom::SDLApp::show_fps_ |
|
private |
◆ state_
State machine manager.
- See also
- SDLApp::set_state_machine
Definition at line 247 of file SDLApp.hpp.
The documentation for this class was generated from the following file:
- /home/jeff/Projects/nomlib.git/include/nomlib/system/SDLApp.hpp