Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/objects/Test.cc @ 2276

Last change on this file since 2276 was 2171, checked in by landauf, 16 years ago

merged revisions 2111-2170 from objecthierarchy branch back to trunk.

  • Property svn:eol-style set to native
File size: 2.7 KB
RevLine 
[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"
[2171]32#include "core/ConsoleCommand.h"
[1958]33#include "Test.h"
34
35namespace orxonox
36{
37        CreateFactory ( Test );
[2171]38 
39  SetConsoleCommand(Test, printV1, true).accessLevel(AccessLevel::User);
40  SetConsoleCommand(Test, printV2, true).accessLevel(AccessLevel::User);
41  SetConsoleCommand(Test, printV3, true).accessLevel(AccessLevel::User);
42  SetConsoleCommand(Test, printV4, true).accessLevel(AccessLevel::User);
43 
44  Test* Test::instance_ = 0;
[1958]45
[2171]46        Test::Test(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
[1958]47        {
[2171]48    assert(instance_==0);
49    instance_=this;
[1958]50                RegisterObject ( Test );
[2171]51    setConfigValues();
52    registerVariables();
[1958]53                setObjectMode(0x3);
54        }
55
56        Test::~Test()
57        {
[2171]58    instance_=0;
[1958]59        }
60
61        void Test::setConfigValues()
62        {
[2171]63                SetConfigValue ( v1, 1 )/*.callback ( this, &Test::checkV1 )*/;
64    SetConfigValue ( v2, 2 )/*.callback ( this, &Test::checkV2 )*/;
65    SetConfigValue ( v3, 3 )/*.callback ( this, &Test::checkV3 )*/;
66    SetConfigValue ( v4, 4 )/*.callback ( this, &Test::checkV4 )*/;
[1958]67        }
68
69
70        void Test::registerVariables()
71        {
[2171]72                REGISTERDATA ( v1,direction::toclient, new NetworkCallback<Test> ( this, &Test::checkV1 ) );
73    REGISTERDATA ( v2,direction::toserver, new NetworkCallback<Test> ( this, &Test::checkV2 ) );
74                REGISTERDATA ( v3,direction::serverMaster, new NetworkCallback<Test> ( this, &Test::checkV3 ) );
75    REGISTERDATA ( v4,direction::clientMaster, new NetworkCallback<Test> ( this, &Test::checkV4 ) );
[1958]76        }
77
[2171]78  void Test::checkV1(){
79    COUT(1) << "V1 changed: " << v1 << std::endl;
80  }
[1960]81
[2171]82  void Test::checkV2(){
83    COUT(1) << "V2 changed: " << v2 << std::endl;
84  }
[1960]85
[2171]86  void Test::checkV3(){
87    COUT(1) << "V3 changed: " << v3 << std::endl;
88  }
89 
90  void Test::checkV4(){
91    COUT(1) << "V4 changed: " << v4 << std::endl;
92  }
[1960]93
94
[1958]95}
Note: See TracBrowser for help on using the repository browser.