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 modify |
---|
8 | * it under the terms of the GNU General Public License as published by |
---|
9 | * the Free Software Foundation, either version 3 of the License, or |
---|
10 | * (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, see <http://www.gnu.org/licenses/>. |
---|
19 | * |
---|
20 | * |
---|
21 | * Author: |
---|
22 | * Reto Grieder |
---|
23 | * Co-authors: |
---|
24 | * ... |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | //#define WITH_HIERARCHY |
---|
29 | |
---|
30 | #include "OgrePlatform.h" |
---|
31 | #include "OgreException.h" |
---|
32 | |
---|
33 | #include "orxonox.h" |
---|
34 | |
---|
35 | #ifdef WITH_HIERARCHY |
---|
36 | #include "class_hierarchy/BaseObject.h" |
---|
37 | #include "class_hierarchy/Test.h" |
---|
38 | #include "class_hierarchy/test1.h" |
---|
39 | #include "class_hierarchy/test2.h" |
---|
40 | #include "class_hierarchy/test3.h" |
---|
41 | #endif |
---|
42 | |
---|
43 | |
---|
44 | #ifdef __cplusplus |
---|
45 | extern "C" { |
---|
46 | #endif |
---|
47 | |
---|
48 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 |
---|
49 | #define WIN32_LEAN_AND_MEAN |
---|
50 | #include "windows.h" |
---|
51 | INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT) |
---|
52 | #else |
---|
53 | int main(int argc, char **argv) |
---|
54 | #endif |
---|
55 | { |
---|
56 | #ifndef WITH_HIERARCHY |
---|
57 | try { |
---|
58 | // create an orxonox application and run it |
---|
59 | orxonox::Orxonox myApp; |
---|
60 | |
---|
61 | myApp.go(); |
---|
62 | } |
---|
63 | catch (Ogre::Exception& e) { |
---|
64 | #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 |
---|
65 | MessageBoxA(NULL, e.getFullDescription().c_str(), |
---|
66 | "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); |
---|
67 | #else |
---|
68 | std::cerr << "Exception:\n"; |
---|
69 | std::cerr << e.getFullDescription().c_str() << "\n"; |
---|
70 | #endif |
---|
71 | return 1; |
---|
72 | } |
---|
73 | |
---|
74 | #else |
---|
75 | #define testandcout(code) \ |
---|
76 | std::cout << #code << " " << code << "\n" |
---|
77 | |
---|
78 | using namespace orxonox; |
---|
79 | |
---|
80 | std::cout << "Test 8\n"; |
---|
81 | |
---|
82 | std::cout << "1\n"; |
---|
83 | Test1* test8_01 = new Test1; |
---|
84 | Test1* asdf = new Test1; |
---|
85 | Test3* test8_03 = new Test3; |
---|
86 | test8_03->usefullClassesIsATest(test8_01); |
---|
87 | |
---|
88 | std::cout << "2\n"; |
---|
89 | Test2* test8_02 = new Test2; |
---|
90 | test8_03->usefullClassesIsATest(test8_02); |
---|
91 | |
---|
92 | std::cout << "3\n"; |
---|
93 | test8_01->setUsefullClass1(Class(Test1)); |
---|
94 | test8_01->setUsefullClass1(test8_02->getIdentifier()); |
---|
95 | test8_01->setUsefullClass2(Class(Test2)); |
---|
96 | test8_01->setUsefullClassOfTypeTest3(Class(Test3)); |
---|
97 | test8_01->setUsefullClassOfTypeTest3(test8_03->getIdentifier()); |
---|
98 | |
---|
99 | |
---|
100 | testandcout(test8_01->isA(Class(Test1))); |
---|
101 | testandcout(test8_01->isA(Class(Test2))); |
---|
102 | testandcout(test8_01->isA(Class(Test3))); |
---|
103 | |
---|
104 | Test2* test8_04 = new Test2; |
---|
105 | testandcout(test8_02->isA(Class(Test1))); |
---|
106 | testandcout(test8_02->isA(Class(Test2))); |
---|
107 | testandcout(test8_02->isA(Class(Test3))); |
---|
108 | |
---|
109 | Test3* test8_05 = new Test3; |
---|
110 | testandcout(test8_03->isA(Class(Test1))); |
---|
111 | testandcout(test8_03->isA(Class(Test2))); |
---|
112 | testandcout(test8_03->isA(Class(Test3))); |
---|
113 | |
---|
114 | delete test8_01; |
---|
115 | delete test8_02; |
---|
116 | delete test8_03; |
---|
117 | |
---|
118 | #endif |
---|
119 | return 0; |
---|
120 | } |
---|
121 | |
---|
122 | #ifdef __cplusplus |
---|
123 | } |
---|
124 | #endif |
---|