Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

  1. #include "network/Synchronisable.h"
  2. make sure your class inherits from Synchronisable:
    class XYZ : public network::Synchronisable { ... };
    
  3. 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_);
    }
    
  4. make sure registerAllVariables() gets called in the constructor:
    XYZ::XYZ(){
    registerAllVariables();
    // do not work with synchronisable variables in your constructor (except initialisation)
    }
    
  5. 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_);
    }