CUGL 2.5
Cornell University Game Library
|
#include <CUPhysSyncEvent.h>
Classes | |
class | Parameters |
Public Member Functions | |
std::shared_ptr< NetEvent > | newEvent () override |
const std::vector< Parameters > & | getSyncList () const |
void | addObstacle (Uint64 id, const std::shared_ptr< physics2::Obstacle > &obs) |
std::vector< std::byte > | serialize () override |
void | deserialize (const std::vector< std::byte > &data) override |
Public Member Functions inherited from cugl::physics2::net::NetEvent | |
virtual std::shared_ptr< NetEvent > | newEvent () |
virtual std::vector< std::byte > | serialize () |
virtual void | deserialize (const std::vector< std::byte > &data) |
Uint64 | getEventTimeStamp () const |
Uint64 | getReceiveTimeStamp () const |
const std::string | getSourceId () const |
Static Public Member Functions | |
static std::shared_ptr< PhysSyncEvent > | alloc () |
Protected Attributes | |
std::vector< Parameters > | _syncList |
This class represents a message to synchronize obstacle positions.
This class should only be used internally by the networked physics library. It is not designed to synchronize customs state. For that, you should use GameStateEvent
instead.
void cugl::physics2::net::PhysSyncEvent::addObstacle | ( | Uint64 | id, |
const std::shared_ptr< physics2::Obstacle > & | obs | ||
) |
Snapshots an obstacle's current position and velocity.
This snapshot is then added to the list for serialization.
obs | the obstacle reference to add |
id | the global id of the obstacle |
|
inlinestatic |
Returns a newly allocated event of this type.
This is a static version of newEvent
.
|
overridevirtual |
Unpacks a byte vector into a list of snapshots.
These snapshots can then be used in physics synchronizations.
data | the byte vector to deserialize |
Reimplemented from cugl::physics2::net::NetEvent.
|
inline |
Returns a reference to the obstacle snapshots added so far.
|
inlineoverridevirtual |
Returns a newly allocated event of this type.
This method is used by the NetEventController to create a new event with this type as a reference.
Note that this method is not static, unlike the alloc method present in most of CUGL. That is because we need this factory method to be polymorphic. All custom subclasses must implement this method.
Reimplemented from cugl::physics2::net::NetEvent.
|
overridevirtual |
Returns a byte vector serializing the current list of snapshots.
Reimplemented from cugl::physics2::net::NetEvent.
|
protected |
The vector of added object snapshots.