Nymph Game Engine
Chaiscript based Game Engine
|
Interface to be notified of an item's changes. More...
#include <observer.h>
Public Member Functions | |
virtual | ~Observer () |
void | onNotify (std::shared_ptr< Event > event) |
When receiving an event that is non-immediate, onNotify is used. The event is added to the event queue that is processed when processEventQueue is called. More... | |
virtual void | onNotifyNow (std::shared_ptr< Event > event)=0 |
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure the object is notified before another engine loop. This is pure virtual and is implemented on a case by case basis in derived classes. More... | |
virtual void | handleQueuedEvent (std::shared_ptr< Event > event)=0 |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received. More... | |
void | processEventQueue () |
This should be called once ever loop for every Observer to properly use queued events. More... | |
Protected Member Functions | |
std::shared_ptr< Event > | getEvent () |
bool | eventsWaiting () const noexcept |
Interface to be notified of an item's changes.
|
inlinevirtual |
|
inlineprotectednoexcept |
|
inlineprotected |
References eventsWaiting().
Referenced by Graphics::TileAnimator< StateType >::onUpdate(), Game::SpriteMovement::onUpdate(), and processEventQueue().
|
pure virtual |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received.
[in] | event | The event |
Implemented in Game::SpriteMovement, Graphics::Renderable, Graphics::TileAnimator< StateType >, Graphics::Camera, Graphics::UI::Element, Component, Script::ScriptObject, Graphics::UI::Text, Graphics::UI::WrappableText, Graphics::UI::TextArea, Graphics::UI::TextField, Input::InputSystem, Graphics::UI::Area, Graphics::UI::Button, Sound::SoundInstance, and Utility::DebugParser.
Referenced by processEventQueue().
|
inline |
When receiving an event that is non-immediate, onNotify is used. The event is added to the event queue that is processed when processEventQueue is called.
[in] | event | The event |
|
pure virtual |
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure the object is notified before another engine loop. This is pure virtual and is implemented on a case by case basis in derived classes.
[in] | event | The event |
Implemented in Game::SpriteMovement, Graphics::Renderable, Graphics::TileAnimator< StateType >, Graphics::Camera, Graphics::UI::Element, Component, Script::ScriptObject, Graphics::UI::Text, Graphics::UI::WrappableText, Graphics::UI::TextArea, Graphics::UI::TextField, Graphics::UI::Area, Input::InputSystem, Graphics::UI::Button, Sound::SoundInstance, and Utility::DebugParser.
|
inline |
This should be called once ever loop for every Observer to properly use queued events.
References eventsWaiting(), getEvent(), and handleQueuedEvent().
Referenced by Utility::DebugParser::handleEvents(), and Script::ScriptObject::onUpdate().