Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches

A class representing the connection between an Action generated by the InputManager, and a BaseSimObjectAspect method that is interested in handling the action. More...

#include <sim_system.hpp>

Private Member Functions

bool call (const ActionData &actionData, const ActionDefinition &actionDefinition)
 Calls the handler this binding holds a reference to with some newly received action data generated by the input system.
 
 FixedActionBinding (const std::string &context, const std::string &name, std::function< bool(const ActionData &, const ActionDefinition &)> handler)
 Constructs a new binding object with the given action name and context, and a reference to the function interested in handling that action.
 

Private Attributes

std::string mContext
 The name of the context owning the action.
 
std::string mName
 The name of the action itself.
 
std::function< bool(const ActionData &, const ActionDefinition &)> mHandler
 A reference to the handler interested in receiving the action.
 

Friends

class BaseSimObjectAspect
 

Detailed Description

A class representing the connection between an Action generated by the InputManager, and a BaseSimObjectAspect method that is interested in handling the action.

See also
BaseSimObjectAspect::declareFixedActionBinding()
ActionDefinition
ActionData

Constructor & Destructor Documentation

◆ FixedActionBinding()

ToyMaker::FixedActionBinding::FixedActionBinding ( const std::string & context,
const std::string & name,
std::function< bool(const ActionData &, const ActionDefinition &)> handler )
inlineprivate

Constructs a new binding object with the given action name and context, and a reference to the function interested in handling that action.

Parameters
contextThe context name of the action.
nameThe name of the action itself.
handlerThe handler interested in receiving the action.

Member Function Documentation

◆ call()

bool ToyMaker::FixedActionBinding::call ( const ActionData & actionData,
const ActionDefinition & actionDefinition )
inlineprivate

Calls the handler this binding holds a reference to with some newly received action data generated by the input system.

Parameters
actionDataThe data of the generated action event.
actionDefinitionThe definition of the action.
Return values
trueThe action was handled by this aspect;
falseThe action was not handled by this aspect.

Member Data Documentation

◆ mHandler

std::function<bool(const ActionData&, const ActionDefinition&)> ToyMaker::FixedActionBinding::mHandler
private

A reference to the handler interested in receiving the action.

Such a handler must return a boolean value. true indicates that the handler was able to do something with the action, while false indicates that nothing was done with the action.


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