Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickups/src/orxonox/objects/Test.cc @ 2988

Last change on this file since 2988 was 2662, checked in by rgrieder, 16 years ago

Merged presentation branch back to trunk.

  • Property svn:eol-style set to native
File size: 3.8 KB
Line 
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 "core/ConsoleCommand.h"
33#include "Test.h"
34
35namespace orxonox
36{
37        CreateFactory ( Test );
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;
45
46        Test::Test(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
47        {
48    assert(instance_==0);
49    instance_=this;
50                RegisterObject ( Test );
51    setConfigValues();
52    registerVariables();
53                setObjectMode(0x3);
54        }
55
56        Test::~Test()
57        {
58    instance_=0;
59        }
60
61        void Test::setConfigValues()
62        {
63                SetConfigValue ( u1, 1 )/*.callback ( this, &Test::checkV1 )*/;
64    SetConfigValue ( u2, 2 )/*.callback ( this, &Test::checkV2 )*/;
65    SetConfigValue ( u3, 3 )/*.callback ( this, &Test::checkV3 )*/;
66    SetConfigValue ( u4, 4 )/*.callback ( this, &Test::checkV4 )*/;
67   
68    SetConfigValue ( s1, 1 )/*.callback ( this, &Test::checkV1 )*/;
69    SetConfigValue ( s2, 2 )/*.callback ( this, &Test::checkV2 )*/;
70    SetConfigValue ( s3, 3 )/*.callback ( this, &Test::checkV3 )*/;
71    SetConfigValue ( s4, 4 )/*.callback ( this, &Test::checkV4 )*/;
72        }
73
74
75        void Test::registerVariables()
76        {
77                registerVariable ( u1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkU1 ));
78    registerVariable ( u2, variableDirection::toserver, new NetworkCallback<Test> ( this, &Test::checkU2 ));
79                registerVariable ( u3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkU3 ), true );
80    registerVariable ( u4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkU4 ), true );
81   
82    registerVariable ( s1, variableDirection::toclient, new NetworkCallback<Test> ( this, &Test::checkS1 ));
83    registerVariable ( s2, variableDirection::toserver, new NetworkCallback<Test> ( this, &Test::checkS2 ));
84    registerVariable ( s3, variableDirection::serverMaster, new NetworkCallback<Test> ( this, &Test::checkS3 ), true );
85    registerVariable ( s4, variableDirection::clientMaster, new NetworkCallback<Test> ( this, &Test::checkS4 ), true );
86        }
87
88  void Test::checkU1(){ COUT(1) << "U1 changed: " << u1 << std::endl; }
89  void Test::checkU2(){ COUT(1) << "U2 changed: " << u2 << std::endl; }
90  void Test::checkU3(){ COUT(1) << "U3 changed: " << u3 << std::endl; }
91  void Test::checkU4(){ COUT(1) << "U4 changed: " << u4 << std::endl; }
92
93  void Test::checkS1(){ COUT(1) << "S1 changed: " << s1 << std::endl; }
94  void Test::checkS2(){ COUT(1) << "S2 changed: " << s2 << std::endl; }
95  void Test::checkS3(){ COUT(1) << "S3 changed: " << s3 << std::endl; }
96  void Test::checkS4(){ COUT(1) << "S4 changed: " << s4 << std::endl; }
97
98}
Note: See TracBrowser for help on using the repository browser.