1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * |
---|
4 | * |
---|
5 | * License notice: |
---|
6 | * |
---|
7 | * This program is free software; you can redistribute it and/or |
---|
8 | * modify it under the terms of the GNU General Public License |
---|
9 | * as published by the Free Software Foundation; either version 2 |
---|
10 | * of the License, or (at your option) any later version. |
---|
11 | * |
---|
12 | * This program is distributed in the hope that it will be useful, |
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | * GNU General Public License for more details. |
---|
16 | * |
---|
17 | * You should have received a copy of the GNU General Public License |
---|
18 | * along with this program; if not, write to the Free Software |
---|
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
20 | * |
---|
21 | * Author: |
---|
22 | * Fabian 'x3n' Landau |
---|
23 | * Co-authors: |
---|
24 | * ... |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | #include "test1.h" |
---|
29 | #include "test2.h" |
---|
30 | #include "test3.h" |
---|
31 | #include "core/CoreIncludes.h" |
---|
32 | #include "core/ConfigValueIncludes.h" |
---|
33 | |
---|
34 | namespace orxonox |
---|
35 | { |
---|
36 | CreateFactory(Test3); |
---|
37 | |
---|
38 | Test3::Test3() |
---|
39 | { |
---|
40 | RegisterObject(Test3); |
---|
41 | |
---|
42 | this->setConfigValues(); |
---|
43 | } |
---|
44 | |
---|
45 | void Test3::setConfigValues() |
---|
46 | { |
---|
47 | SetConfigValue(value_int_, 1); |
---|
48 | SetConfigValue(value_uint_, 1); |
---|
49 | SetConfigValue(value_char_, 1); |
---|
50 | SetConfigValue(value_uchar_, 1); |
---|
51 | SetConfigValue(value_float_, 1); |
---|
52 | SetConfigValue(value_double_, 1); |
---|
53 | SetConfigValue(value_bool_, 1); |
---|
54 | SetConfigValue(value_string_, "This is a test"); |
---|
55 | SetConfigValue(value_constchar_, "This is another test"); |
---|
56 | SetConfigValue(value_vector2_, Vector2(101, 202)); |
---|
57 | SetConfigValue(value_vector3_, Vector3(13, 26, 39)); |
---|
58 | SetConfigValue(value_colourvalue_, ColourValue(1.0, 0.5, 0.25, 0.887)); |
---|
59 | SetConfigValueVector(vector_int_, std::vector<int>(1, 13)); |
---|
60 | SetConfigValueVector(vector_string_, std::vector<std::string>(3, "nothing")); |
---|
61 | SetConfigValueVector(vector_vector3_, std::vector<Vector3>(1, Vector3(3, 2, 1))); |
---|
62 | } |
---|
63 | |
---|
64 | Test3::~Test3() |
---|
65 | { |
---|
66 | } |
---|
67 | |
---|
68 | void Test3::configOutput() |
---|
69 | { |
---|
70 | std::cout << "int: " << this->value_int_ << std::endl; |
---|
71 | std::cout << "uint: " << this->value_uint_ << std::endl; |
---|
72 | std::cout << "char: " << (int)this->value_char_ << std::endl; |
---|
73 | std::cout << "uchar: " << (int)this->value_uchar_ << std::endl; |
---|
74 | std::cout << "float: " << this->value_float_ << std::endl; |
---|
75 | std::cout << "double: " << this->value_double_ << std::endl; |
---|
76 | std::cout << "bool: " << this->value_bool_ << std::endl; |
---|
77 | std::cout << "string: >" << this->value_string_ << "<" << std::endl; |
---|
78 | std::cout << "constchar: >" << this->value_constchar_ << "<" << std::endl; |
---|
79 | std::cout << "vector2: " << this->value_vector2_ << std::endl; |
---|
80 | std::cout << "vector3: " << this->value_vector3_ << std::endl; |
---|
81 | std::cout << "colourvalue: " << this->value_colourvalue_ << std::endl; |
---|
82 | std::cout << std::endl; |
---|
83 | for (unsigned int i = 0; i < this->vector_int_.size(); i++) |
---|
84 | std::cout << "vector<int>: " << i << ": " << this->vector_int_[i] << std::endl; |
---|
85 | for (unsigned int i = 0; i < this->vector_string_.size(); i++) |
---|
86 | std::cout << "vector<string>: " << i << ":>" << this->vector_string_[i] << "<" << std::endl; |
---|
87 | for (unsigned int i = 0; i < this->vector_vector3_.size(); i++) |
---|
88 | std::cout << "vector<vector3>: " << i << ": " << this->vector_vector3_[i] << std::endl; |
---|
89 | |
---|
90 | ModifyConfigValue(value_int_, tset, "100"); |
---|
91 | std::cout << std::endl; |
---|
92 | std::cout << "int: " << this->value_int_ << std::endl; |
---|
93 | |
---|
94 | ModifyConfigValue(value_int_, update); |
---|
95 | std::cout << std::endl; |
---|
96 | std::cout << "int: " << this->value_int_ << std::endl; |
---|
97 | } |
---|
98 | |
---|
99 | #define testandcout(code) \ |
---|
100 | std::cout << #code << " " << code << std::endl |
---|
101 | |
---|
102 | void Test3::usefullClassesIsATest(Test1* test1) |
---|
103 | { |
---|
104 | std::cout << std::endl; |
---|
105 | std::cout << "Test1:" << std::endl; |
---|
106 | testandcout(test1->usefullClass1isA(Class(Test1))); |
---|
107 | testandcout(test1->usefullClass1isA(Class(Test2))); |
---|
108 | testandcout(test1->usefullClass1isA(Class(Test3))); |
---|
109 | std::cout << std::endl; |
---|
110 | testandcout(test1->usefullClass2isA(Class(Test1))); |
---|
111 | testandcout(test1->usefullClass2isA(Class(Test2))); |
---|
112 | testandcout(test1->usefullClass2isA(Class(Test3))); |
---|
113 | std::cout << std::endl; |
---|
114 | testandcout(test1->usefullClass3isA(Class(Test1))); |
---|
115 | testandcout(test1->usefullClass3isA(Class(Test2))); |
---|
116 | testandcout(test1->usefullClass3isA(Class(Test3))); |
---|
117 | } |
---|
118 | |
---|
119 | void Test3::usefullClassesIsATest(Test2* test2) |
---|
120 | { |
---|
121 | std::cout << std::endl; |
---|
122 | std::cout << "Test2:" << std::endl; |
---|
123 | testandcout(test2->usefullClass1isA(Class(Test1))); |
---|
124 | testandcout(test2->usefullClass1isA(Class(Test2))); |
---|
125 | testandcout(test2->usefullClass1isA(Class(Test3))); |
---|
126 | std::cout << std::endl; |
---|
127 | testandcout(test2->usefullClass2isA(Class(Test1))); |
---|
128 | testandcout(test2->usefullClass2isA(Class(Test2))); |
---|
129 | testandcout(test2->usefullClass2isA(Class(Test3))); |
---|
130 | std::cout << std::endl; |
---|
131 | testandcout(test2->usefullClass3isA(Class(Test1))); |
---|
132 | testandcout(test2->usefullClass3isA(Class(Test2))); |
---|
133 | testandcout(test2->usefullClass3isA(Class(Test3))); |
---|
134 | } |
---|
135 | } |
---|