Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/input/src/asylum/orxonox/objects/test3.cc @ 1280

Last change on this file since 1280 was 1056, checked in by landauf, 17 years ago

don't panic, no codechanges!
added a link to www.orxonox.net

File size: 5.6 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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "test1.h"
30#include "test2.h"
31#include "test3.h"
32#include "core/CoreIncludes.h"
33#include "core/ConfigValueIncludes.h"
34
35namespace orxonox
36{
37    CreateFactory(Test3);
38
39    Test3::Test3()
40    {
41        RegisterObject(Test3);
42
43        this->setConfigValues();
44    }
45
46    void Test3::setConfigValues()
47    {
48        SetConfigValue(value_int_, 1);
49        SetConfigValue(value_uint_, 1);
50        SetConfigValue(value_char_, 1);
51        SetConfigValue(value_uchar_, 1);
52        SetConfigValue(value_float_, 1);
53        SetConfigValue(value_double_, 1);
54        SetConfigValue(value_bool_, 1);
55        SetConfigValue(value_string_, "This is a test");
56        SetConfigValue(value_constchar_, "This is another test");
57        SetConfigValue(value_vector2_, Vector2(101, 202));
58        SetConfigValue(value_vector3_, Vector3(13, 26, 39));
59        SetConfigValue(value_colourvalue_, ColourValue(1.0, 0.5, 0.25, 0.887));
60        SetConfigValueVector(vector_int_, std::vector<int>(1, 13));
61        SetConfigValueVector(vector_string_, std::vector<std::string>(3, "nothing"));
62        SetConfigValueVector(vector_vector3_, std::vector<Vector3>(1, Vector3(3, 2, 1)));
63    }
64
65    Test3::~Test3()
66    {
67    }
68
69    void Test3::configOutput()
70    {
71        std::cout << "int:             " << this->value_int_ << std::endl;
72        std::cout << "uint:            " << this->value_uint_ << std::endl;
73        std::cout << "char:            " << (int)this->value_char_ << std::endl;
74        std::cout << "uchar:           " << (int)this->value_uchar_ << std::endl;
75        std::cout << "float:           " << this->value_float_ << std::endl;
76        std::cout << "double:          " << this->value_double_ << std::endl;
77        std::cout << "bool:            " << this->value_bool_ << std::endl;
78        std::cout << "string:         >" << this->value_string_ << "<" << std::endl;
79        std::cout << "constchar:      >" << this->value_constchar_ << "<" << std::endl;
80        std::cout << "vector2:         " << this->value_vector2_ << std::endl;
81        std::cout << "vector3:         " << this->value_vector3_ << std::endl;
82        std::cout << "colourvalue:     " << this->value_colourvalue_ << std::endl;
83        std::cout << std::endl;
84        for (unsigned int i = 0; i < this->vector_int_.size(); i++)
85        std::cout << "vector<int>:     " << i << ": " << this->vector_int_[i] << std::endl;
86        for (unsigned int i = 0; i < this->vector_string_.size(); i++)
87        std::cout << "vector<string>:  " << i << ":>" << this->vector_string_[i] << "<" << std::endl;
88        for (unsigned int i = 0; i < this->vector_vector3_.size(); i++)
89        std::cout << "vector<vector3>: " << i << ": " << this->vector_vector3_[i] << std::endl;
90
91        ModifyConfigValue(value_int_, tset, "100");
92        std::cout << std::endl;
93        std::cout << "int:             " << this->value_int_ << std::endl;
94
95        ModifyConfigValue(value_int_, update);
96        std::cout << std::endl;
97        std::cout << "int:             " << this->value_int_ << std::endl;
98    }
99
100    #define testandcout(code) \
101      std::cout << #code << " " << code << std::endl
102
103    void Test3::usefullClassesIsATest(Test1* test1)
104    {
105        std::cout << std::endl;
106        std::cout << "Test1:" << std::endl;
107        testandcout(test1->usefullClass1isA(Class(Test1)));
108        testandcout(test1->usefullClass1isA(Class(Test2)));
109        testandcout(test1->usefullClass1isA(Class(Test3)));
110        std::cout << std::endl;
111        testandcout(test1->usefullClass2isA(Class(Test1)));
112        testandcout(test1->usefullClass2isA(Class(Test2)));
113        testandcout(test1->usefullClass2isA(Class(Test3)));
114        std::cout << std::endl;
115        testandcout(test1->usefullClass3isA(Class(Test1)));
116        testandcout(test1->usefullClass3isA(Class(Test2)));
117        testandcout(test1->usefullClass3isA(Class(Test3)));
118    }
119
120    void Test3::usefullClassesIsATest(Test2* test2)
121    {
122        std::cout << std::endl;
123        std::cout << "Test2:" << std::endl;
124        testandcout(test2->usefullClass1isA(Class(Test1)));
125        testandcout(test2->usefullClass1isA(Class(Test2)));
126        testandcout(test2->usefullClass1isA(Class(Test3)));
127        std::cout << std::endl;
128        testandcout(test2->usefullClass2isA(Class(Test1)));
129        testandcout(test2->usefullClass2isA(Class(Test2)));
130        testandcout(test2->usefullClass2isA(Class(Test3)));
131        std::cout << std::endl;
132        testandcout(test2->usefullClass3isA(Class(Test1)));
133        testandcout(test2->usefullClass3isA(Class(Test2)));
134        testandcout(test2->usefullClass3isA(Class(Test3)));
135    }
136}
Note: See TracBrowser for help on using the repository browser.