[1958] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
| 23 | * Oli Scheuss |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #include "OrxonoxStableHeaders.h" |
---|
| 30 | #include "core/CoreIncludes.h" |
---|
| 31 | #include "core/ConfigValueIncludes.h" |
---|
| 32 | #include "Test.h" |
---|
| 33 | |
---|
| 34 | namespace orxonox |
---|
| 35 | { |
---|
| 36 | CreateFactory ( Test ); |
---|
| 37 | |
---|
[2034] | 38 | Test::Test(BaseObject* creator) : BaseObject(creator), network::Synchronisable(creator) |
---|
[1958] | 39 | { |
---|
| 40 | RegisterObject ( Test ); |
---|
| 41 | setConfigValues(); |
---|
| 42 | registerVariables(); |
---|
| 43 | setObjectMode(0x3); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | Test::~Test() |
---|
| 47 | { |
---|
[1960] | 48 | |
---|
[1958] | 49 | } |
---|
| 50 | |
---|
| 51 | void Test::setConfigValues() |
---|
| 52 | { |
---|
| 53 | SetConfigValue ( v1, 1 ).callback ( this, &Test::checkV1 ); |
---|
| 54 | SetConfigValue ( v2, 2 ).callback ( this, &Test::checkV2 ); |
---|
| 55 | SetConfigValue ( v3, 3 ).callback ( this, &Test::checkV3 ); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | void Test::registerVariables() |
---|
| 60 | { |
---|
| 61 | REGISTERDATA ( v1,network::direction::toclient, new network::NetworkCallback<Test> ( this, &Test::checkV1 ) ); |
---|
| 62 | REGISTERDATA ( v2,network::direction::toserver, new network::NetworkCallback<Test> ( this, &Test::checkV2 ) ); |
---|
| 63 | REGISTERDATA ( v3,network::direction::bidirectional, new network::NetworkCallback<Test> ( this, &Test::checkV3 ) ); |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | void Test::checkV1(){ |
---|
[1990] | 67 | COUT(1) << "V1 changed: " << v1 << std::endl; |
---|
[1958] | 68 | } |
---|
[1960] | 69 | |
---|
[1958] | 70 | void Test::checkV2(){ |
---|
[1990] | 71 | COUT(1) << "V2 changed: " << v2 << std::endl; |
---|
[1958] | 72 | } |
---|
[1960] | 73 | |
---|
[1958] | 74 | void Test::checkV3(){ |
---|
[1990] | 75 | COUT(1) << "V3 changed: " << v3 << std::endl; |
---|
[1958] | 76 | } |
---|
[1960] | 77 | |
---|
| 78 | |
---|
[1958] | 79 | } |
---|