Terminus
|
The AbstractCommand class defines the interface that every command has to implement. More...
#include <abstractcommand.h>
Public Member Functions | |
AbstractCommand (Timer::TimerMSec timeStamp) | |
virtual | ~AbstractCommand () |
void | setGame (Game *game) |
set the game instance this command should operate on More... | |
Timer::TimerMSec | timeStamp () const |
get the time as counted by the sending game that this command was created and sent More... | |
virtual Commands | commandType () const =0 |
Every Command must specify its type. More... | |
virtual QJsonObject | toJson () const =0 |
Every command must define how its members can be serialized. More... | |
virtual void | doWork ()=0 |
Every Commands must define its effects on the receiving game. More... | |
Static Protected Member Functions | |
static QJsonObject | VectorToJsonObject (QVector3D vector) |
static QVector3D | VectorFromJsonObject (QJsonObject jsonObject) |
Protected Attributes | |
Game * | m_game |
Timer::TimerMSec | m_timeStamp |
The AbstractCommand class defines the interface that every command has to implement.
It also provides some convenience methods for JSON conversion and members commonly used by all commands.
terminus::AbstractCommand::AbstractCommand | ( | Timer::TimerMSec | timeStamp | ) |
|
virtual |
|
pure virtual |
Every Command must specify its type.
Implemented in terminus::ProjectileFiredCommand, terminus::SyncCommand, terminus::ProjectileHitCommand, terminus::ClientReadyCommand, terminus::GameEndedCommand, terminus::PrepareNewGameCommand, and terminus::PauseCommand.
|
pure virtual |
Every Commands must define its effects on the receiving game.
This Method is guaranteed to be executed in the receiving game's frame update context with a valid Game instance in m_game
Implemented in terminus::ProjectileFiredCommand, terminus::SyncCommand, terminus::ProjectileHitCommand, terminus::ClientReadyCommand, terminus::GameEndedCommand, terminus::PrepareNewGameCommand, and terminus::PauseCommand.
void terminus::AbstractCommand::setGame | ( | Game * | game | ) |
set the game instance this command should operate on
game | - ownership not taken |
Timer::TimerMSec terminus::AbstractCommand::timeStamp | ( | ) | const |
get the time as counted by the sending game that this command was created and sent
|
pure virtual |
Every command must define how its members can be serialized.
Implemented in terminus::ProjectileFiredCommand, terminus::SyncCommand, terminus::ProjectileHitCommand, terminus::ClientReadyCommand, terminus::GameEndedCommand, terminus::PrepareNewGameCommand, and terminus::PauseCommand.
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |