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