Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
|
An object responsible for tracking action listeners for a given project. More...
#include <input_system.hpp>
Public Member Functions | |
void | registerActionHandler (const QualifiedActionName &contextActionPair, ::std::weak_ptr< IActionHandler > actionHandler) |
Registers a handler for an action. | |
void | unregisterActionHandler (const QualifiedActionName &contextActionPair, ::std::weak_ptr< IActionHandler > actionHandler) |
Removes a handler for a particular action. | |
void | unregisterActionHandler (::std::weak_ptr< IActionHandler > actionHandler) |
Removes an action handler from all its subscribed actions. | |
bool | dispatchAction (const ::std::pair< ActionDefinition, ActionData > &pendingAction) |
Sends data for an action to all of that action's registered handlers. | |
Private Attributes | |
::std::map< QualifiedActionName, ::std::set<::std::weak_ptr< IActionHandler >, ::std::owner_less<::std::weak_ptr< IActionHandler > > >, ::std::less< QualifiedActionName > > | mActionHandlers {} |
Pointers to all action handler instances waiting for a particular action. | |
An object responsible for tracking action listeners for a given project.
Triggered actions created by ActionContext do not actually reach their intended listeners until they have been (manually) sent via an ActionDispatch object. This affords developers some control over when and where actions are received.
In the engine's scene system, for example, while every ViewportNode has an associated ActionDispatch object, descendant viewports do not see triggered actions unless their parent viewports allow actions to propagate to them.
bool ActionDispatch::dispatchAction | ( | const ::std::pair< ActionDefinition, ActionData > & | pendingAction | ) |
Sends data for an action to all of that action's registered handlers.
pendingAction | The full action, including its definition and data. |
true | The action was handled by one of this ActionDispatch's subscribers. |
false | The action was not handled by any of this ActionDispatch's subscribers. |
void ActionDispatch::registerActionHandler | ( | const QualifiedActionName & | contextActionPair, |
::std::weak_ptr< IActionHandler > | actionHandler ) |
Registers a handler for an action.
contextActionPair | The full name of the action. |
actionHandler | A pointer to the action handler. |
void ToyMaker::ActionDispatch::unregisterActionHandler | ( | ::std::weak_ptr< IActionHandler > | actionHandler | ) |
Removes an action handler from all its subscribed actions.
actionHandler | A pointer to the action handler. |
void ToyMaker::ActionDispatch::unregisterActionHandler | ( | const QualifiedActionName & | contextActionPair, |
::std::weak_ptr< IActionHandler > | actionHandler ) |
Removes a handler for a particular action.
contextActionPair | The full name of the action. |
actionHandler | A pointer to the action handler. |