OngoingCommandDispatcher Class Referencefinal

The OngoingCommandDispatcher class. More...

Inheritance diagram for OngoingCommandDispatcher:
ICommandDispatcher

Detailed Description

The OngoingCommandDispatcher class.

A basic, type-unsafe dispatcher for a commands that have continuous edition capabilities.

That is, it is useful when you want to have a command that has a long initialization but a very fast update. For instance, moving an object : initializing the command is (relatively) long so we don't want to create a new one at every mouse movement.
Instead, such commands have an update() function with the same arguments than the used constructor.
This dispatcher will call the correct method of the given command whether we're initializing it for the first time, or modifying the existing command.

Public Member Functions

 OngoingCommandDispatcher (const score::CommandStackFacade &stack)
 
template<typename TheCommand , typename... Args>
void submit (Args &&... args)
 
void commit ()
 
void rollback ()
 If the command has to be reverted, for instance when pressing escape.
 
- Public Member Functions inherited from ICommandDispatcher
 ICommandDispatcher (const score::CommandStack &stack)=delete
 
 ICommandDispatcher (const score::CommandStackFacade &stack)
 
const score::CommandStackFacadestack () const
 

Member Function Documentation

◆ commit()

void OngoingCommandDispatcher::commit ( )
inline

When the command is finished and can be sent to the undo - redo stack. For instance on mouse release.

◆ submit()

template<typename TheCommand , typename... Args>
void OngoingCommandDispatcher::submit ( Args &&...  args)
inline

Call this repeatedly to make the command, for instance on click and when the mouse moves.


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