Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Initial Version and Version 1 of code/howto/Synchronisable


Ignore:
Timestamp:
Sep 25, 2008, 9:03:55 PM (16 years ago)
Author:
scheusso
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/howto/Synchronisable

    v1 v1  
     1= Howt to make an object class Synchronisable =
     2See also [wiki:network/Synchronisable] for more information.
     3== Basic steps ==
     4 1. {{{ #include "network/Synchronisable.h" }}}
     5 2. make sure your class inherits from Synchronisable:
     6{{{
     7class XYZ : public network::Synchronisable { ... };
     8}}}
     9 3. create the function void registerAllVariables() and call REGISTERDATA or REGISTERSTRING functions in order to register these variables for synchronisation:
     10{{{
     11void XYZ::registerAllVariables(){
     12REGISTERDATA(somevariable);
     13REGISTERSTRING(meshSrcName_);
     14}
     15}}}
     16 4. make sure registerAllVariables() gets called in the constructor:
     17{{{
     18XYZ::XYZ(){
     19registerAllVariables();
     20// do not work with synchronisable variables in your constructor (except initialisation)
     21}
     22}}}
     23 5. implement the create() function and put all the code that needs some synchronisable variables to be set inside it:
     24{{{
     25bool XYZ::create(){
     26this->ogreMesh_.setMesh(meshSrcName_);
     27}
     28}}}