| 60 | == Example class == |
| 61 | {{{ |
| 62 | #include "network/Synchronisable.h" |
| 63 | |
| 64 | class myFancyObject : public network::Synchronisable |
| 65 | { |
| 66 | private: |
| 67 | //Membervariables |
| 68 | std::string myString_; |
| 69 | Ogre::SceneNode* node_; |
| 70 | |
| 71 | //Memberfunctions |
| 72 | void registerAllVariables(){ |
| 73 | REGISTERDATA_WITHDIR(node_->getPosition().x, network::direction::bidirectional); |
| 74 | REGISTERDATA_WITHDIR(node_->getPosition().y, network::direction::bidirectional); |
| 75 | REGISTERDATA_WITHDIR(node_->getPosition().z, network::direction::bidirectional); |
| 76 | REGISTERSTRING(myString_); |
| 77 | } |
| 78 | public: |
| 79 | myFancyObject(){ |
| 80 | node_ = new Ogre::SceneNode; |
| 81 | registerAllVariables(); |
| 82 | setObjectMode(network::direction::bidirectional); |
| 83 | } |
| 84 | ~myFancyObject(){} |
| 85 | bool create(){ |
| 86 | // do some stuff here |
| 87 | } |
| 88 | void XYZ::XMLPort(...){ |
| 89 | ... |
| 90 | XYZ::create(); |
| 91 | } |
| 92 | |
| 93 | |
| 94 | } |
| 95 | |
| 96 | }}} |