Version 1 (modified by scheusso, 16 years ago) (diff) |
---|
Howt to make an object class Synchronisable
See also network/Synchronisable? for more information.
Basic steps
- #include "network/Synchronisable.h"
- make sure your class inherits from Synchronisable:
class XYZ : public network::Synchronisable { ... };
- create the function void registerAllVariables() and call REGISTERDATA or REGISTERSTRING functions in order to register these variables for synchronisation:
void XYZ::registerAllVariables(){ REGISTERDATA(somevariable); REGISTERSTRING(meshSrcName_); }
- make sure registerAllVariables() gets called in the constructor:
XYZ::XYZ(){ registerAllVariables(); // do not work with synchronisable variables in your constructor (except initialisation) }
- implement the create() function and put all the code that needs some synchronisable variables to be set inside it:
bool XYZ::create(){ this->ogreMesh_.setMesh(meshSrcName_); }