[74] | 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 | * Benjamin Knecht <beni_at_orxonox.net>, (C) 2007 |
---|
| 23 | * Co-authors: |
---|
| 24 | * ... |
---|
| 25 | * |
---|
| 26 | */ |
---|
| 27 | |
---|
[142] | 28 | /** |
---|
| 29 | @file orxonox.cc |
---|
| 30 | @brief Orxonox Main File |
---|
| 31 | */ |
---|
| 32 | |
---|
[460] | 33 | #include <OgreSceneNode.h> |
---|
| 34 | #include <OgreSceneManager.h> |
---|
| 35 | #include <OgreRoot.h> |
---|
| 36 | #include <OgreFrameListener.h> |
---|
| 37 | #include <OgreConfigFile.h> |
---|
| 38 | #include <OgreTextureManager.h> |
---|
| 39 | #include <OgreEntity.h> |
---|
| 40 | #include <OgreRenderWindow.h> |
---|
| 41 | |
---|
[137] | 42 | #include <OIS/OIS.h> |
---|
| 43 | #include <CEGUI/CEGUI.h> |
---|
| 44 | #include <OgreCEGUIRenderer.h> |
---|
[74] | 45 | |
---|
[164] | 46 | #include <string> |
---|
| 47 | #include <iostream> |
---|
| 48 | |
---|
[375] | 49 | //#include "../xml/xmlParser.h" |
---|
| 50 | //#include "../loader/LevelLoader.h" |
---|
[264] | 51 | |
---|
[443] | 52 | #include "core/CoreIncludes.h" |
---|
[454] | 53 | #include "core/SignalHandler.h" |
---|
[375] | 54 | #include "objects/Tickable.h" |
---|
| 55 | #include "objects/Timer.h" |
---|
[460] | 56 | #include "objects/WorldEntity.h" |
---|
[375] | 57 | |
---|
[264] | 58 | #include "objects/BaseObject.h" |
---|
| 59 | #include "objects/Test.h" |
---|
| 60 | #include "objects/test1.h" |
---|
| 61 | #include "objects/test2.h" |
---|
| 62 | #include "objects/test3.h" |
---|
[164] | 63 | |
---|
[151] | 64 | // some tests to see if enet works without includsion |
---|
| 65 | //#include <enet/enet.h> |
---|
| 66 | //#include <enet/protocol.h> |
---|
[142] | 67 | |
---|
[137] | 68 | #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE |
---|
| 69 | #include <CoreFoundation/CoreFoundation.h> |
---|
[74] | 70 | |
---|
[137] | 71 | // This function will locate the path to our application on OS X, |
---|
| 72 | // unlike windows you can not rely on the curent working directory |
---|
| 73 | // for locating your configuration files and resources. |
---|
| 74 | std::string macBundlePath() |
---|
[74] | 75 | { |
---|
[137] | 76 | char path[1024]; |
---|
| 77 | CFBundleRef mainBundle = CFBundleGetMainBundle(); |
---|
| 78 | assert(mainBundle); |
---|
| 79 | |
---|
| 80 | CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle); |
---|
| 81 | assert(mainBundleURL); |
---|
| 82 | |
---|
| 83 | CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle); |
---|
| 84 | assert(cfStringRef); |
---|
| 85 | |
---|
| 86 | CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII); |
---|
| 87 | |
---|
| 88 | CFRelease(mainBundleURL); |
---|
| 89 | CFRelease(cfStringRef); |
---|
| 90 | |
---|
| 91 | return std::string(path); |
---|
| 92 | } |
---|
| 93 | #endif |
---|
| 94 | |
---|
[264] | 95 | namespace orxonox |
---|
| 96 | { |
---|
[266] | 97 | class OrxExitListener : public Ogre::FrameListener |
---|
| 98 | { |
---|
| 99 | public: |
---|
| 100 | OrxExitListener(OIS::Keyboard *keyboard) |
---|
| 101 | : mKeyboard(keyboard) |
---|
| 102 | { |
---|
| 103 | } |
---|
[74] | 104 | |
---|
[266] | 105 | bool frameStarted(const Ogre::FrameEvent& evt) |
---|
| 106 | { |
---|
| 107 | mKeyboard->capture(); |
---|
| 108 | return !mKeyboard->isKeyDown(OIS::KC_ESCAPE); |
---|
| 109 | } |
---|
[135] | 110 | |
---|
[266] | 111 | private: |
---|
| 112 | OIS::Keyboard *mKeyboard; |
---|
| 113 | }; |
---|
[74] | 114 | |
---|
[266] | 115 | class OrxApplication |
---|
| 116 | { |
---|
| 117 | public: |
---|
| 118 | void go() |
---|
| 119 | { |
---|
[375] | 120 | createRoot(); |
---|
| 121 | defineResources(); |
---|
| 122 | setupRenderSystem(); |
---|
| 123 | createRenderWindow(); |
---|
| 124 | initializeResourceGroups(); |
---|
| 125 | createScene(); |
---|
| 126 | setupScene(); |
---|
| 127 | setupInputSystem(); |
---|
| 128 | setupCEGUI(); |
---|
| 129 | createFrameListener(); |
---|
[457] | 130 | Factory::createClassHierarchy(); |
---|
[264] | 131 | |
---|
| 132 | #define testandcout(code) \ |
---|
| 133 | std::cout << #code << " " << code << "\n" |
---|
| 134 | |
---|
| 135 | /* |
---|
| 136 | std::cout << "Test 1\n"; |
---|
| 137 | BaseObject* test1; |
---|
| 138 | test1 = new BaseObject(); |
---|
| 139 | test1 = new BaseObject(); |
---|
| 140 | test1 = new BaseObject(); |
---|
| 141 | |
---|
| 142 | std::cout << "Test 2\n"; |
---|
| 143 | A1* test2; |
---|
| 144 | test2 = new A1(); |
---|
| 145 | test2 = new A1(); |
---|
| 146 | test2 = new A1(); |
---|
| 147 | |
---|
| 148 | std::cout << "Test 3\n"; |
---|
| 149 | BaseObject* test3; |
---|
| 150 | test3 = new BaseObject(); |
---|
| 151 | test3 = new BaseObject(); |
---|
| 152 | test3 = new BaseObject(); |
---|
| 153 | |
---|
| 154 | std::cout << "Test 4\n"; |
---|
| 155 | A3* test4; |
---|
| 156 | test4 = new A3(); |
---|
| 157 | test4 = new A3(); |
---|
| 158 | test4 = new A3(); |
---|
| 159 | */ |
---|
[375] | 160 | /* |
---|
[264] | 161 | std::cout << "Test 5\n"; |
---|
| 162 | A1* test5_01 = new A1(); |
---|
| 163 | A2* test5_02 = new A2(); |
---|
| 164 | A3* test5_03 = new A3(); |
---|
| 165 | A1B1* test5_04 = new A1B1(); |
---|
| 166 | A1B2* test5_05 = new A1B2(); |
---|
| 167 | A2B1* test5_06 = new A2B1(); |
---|
| 168 | A2B2* test5_07 = new A2B2(); |
---|
| 169 | A3B1* test5_08 = new A3B1(); |
---|
| 170 | A3B2* test5_09 = new A3B2(); |
---|
| 171 | A1B1C1* test5_10 = new A1B1C1(); |
---|
| 172 | A1B1C2* test5_11 = new A1B1C2(); |
---|
| 173 | A1B2C1* test5_12 = new A1B2C1(); |
---|
| 174 | A2B1C1* test5_13 = new A2B1C1(); |
---|
| 175 | A2B2C1* test5_14 = new A2B2C1(); |
---|
| 176 | A3B1C1* test5_15 = new A3B1C1(); |
---|
| 177 | A3B1C2* test5_16 = new A3B1C2(); |
---|
| 178 | A3B2C1* test5_17 = new A3B2C1(); |
---|
| 179 | A3B2C2* test5_18 = new A3B2C2(); |
---|
| 180 | |
---|
| 181 | OrxonoxClass* test5; |
---|
| 182 | for (int i = 0; i <= 18; i++) |
---|
| 183 | { |
---|
| 184 | if (i == 0) test5 = new BaseObject; |
---|
| 185 | if (i == 1) test5 = test5_01; |
---|
| 186 | if (i == 2) test5 = test5_02; |
---|
| 187 | if (i == 3) test5 = test5_03; |
---|
| 188 | if (i == 4) test5 = test5_04; |
---|
| 189 | if (i == 5) test5 = test5_05; |
---|
| 190 | if (i == 6) test5 = test5_06; |
---|
| 191 | if (i == 7) test5 = test5_07; |
---|
| 192 | if (i == 8) test5 = test5_08; |
---|
| 193 | if (i == 9) test5 = test5_09; |
---|
| 194 | if (i == 10) test5 = test5_10; |
---|
| 195 | if (i == 11) test5 = test5_11; |
---|
| 196 | if (i == 12) test5 = test5_12; |
---|
| 197 | if (i == 13) test5 = test5_13; |
---|
| 198 | if (i == 14) test5 = test5_14; |
---|
| 199 | if (i == 15) test5 = test5_15; |
---|
| 200 | if (i == 16) test5 = test5_16; |
---|
| 201 | if (i == 17) test5 = test5_17; |
---|
| 202 | if (i == 18) test5 = test5_18; |
---|
| 203 | |
---|
| 204 | std::cout << "\n"; |
---|
[362] | 205 | std::cout << test5->getIdentifier()->getName() << " (" << test5->getIdentifier()->getNetworkID() << "): parents: " << test5->getIdentifier()->getParents().toString() << "\n"; |
---|
| 206 | std::cout << test5->getIdentifier()->getName() << " (" << test5->getIdentifier()->getNetworkID() << "): children: " << test5->getIdentifier()->getChildren().toString() << "\n"; |
---|
[264] | 207 | } |
---|
[362] | 208 | |
---|
| 209 | std::cout << "Class with ID 0: " << ID(0) << " " << ID(0)->getName() << "\n"; |
---|
| 210 | std::cout << "Class with ID 1: " << ID(1) << " " << ID(1)->getName() << "\n"; |
---|
| 211 | std::cout << "Class with ID 2: " << ID(2) << " " << ID(2)->getName() << "\n"; |
---|
| 212 | std::cout << "Class with ID 3: " << ID(3) << " " << ID(3)->getName() << "\n"; |
---|
| 213 | std::cout << "Class with ID 4: " << ID(4) << " " << ID(4)->getName() << "\n"; |
---|
| 214 | std::cout << "Class with ID 100: " << ID(100) << "\n"; |
---|
| 215 | std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n"; |
---|
| 216 | |
---|
| 217 | std::cout << "\nChange ID of BaseObject to 100\n"; |
---|
| 218 | Class(BaseObject)->setNetworkID(100); |
---|
| 219 | std::cout << "Class with ID 100: " << ID(100) << "\n"; |
---|
| 220 | std::cout << "Class with ID 1: " << ID(1) << "\n"; |
---|
| 221 | std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n"; |
---|
| 222 | |
---|
| 223 | std::cout << "\nChange ID of BaseObject to 3\n"; |
---|
| 224 | Class(BaseObject)->setNetworkID(3); |
---|
| 225 | std::cout << "Class with ID 100: " << ID(100) << "\n"; |
---|
| 226 | std::cout << "Class with ID 1: " << ID(1) << "\n"; |
---|
| 227 | std::cout << "Class with ID 3: " << ID(3) << "\n"; |
---|
| 228 | std::cout << "ID of BaseObject: " << Class(BaseObject)->getNetworkID() << "\n"; |
---|
| 229 | std::cout << "ID of Test1: " << Class(Test1)->getNetworkID() << "\n"; |
---|
[375] | 230 | */ |
---|
[264] | 231 | /* |
---|
| 232 | std::cout << "\n"; |
---|
| 233 | std::cout << "isA(XYZ)-Test:\n"; |
---|
| 234 | std::cout << "test5_01 = A1, Erwartet: 1 0 0 1 0\n"; |
---|
| 235 | testandcout(test5_01->isA(Class(A1))); |
---|
| 236 | testandcout(test5_01->isA(Class(A2))); |
---|
| 237 | testandcout(test5_01->isA(Class(A1B1))); |
---|
| 238 | testandcout(test5_01->isA(Class(BaseObject))); |
---|
| 239 | testandcout(test5_01->isA(Class(Interface1))); |
---|
| 240 | |
---|
| 241 | std::cout << "\n"; |
---|
| 242 | std::cout << "test5_02 = A2, Erwartet: 0 1 0 1 0\n"; |
---|
| 243 | testandcout(test5_02->isA(Class(A1))); |
---|
| 244 | testandcout(test5_02->isA(Class(A2))); |
---|
| 245 | testandcout(test5_02->isA(Class(A1B1))); |
---|
| 246 | testandcout(test5_02->isA(Class(BaseObject))); |
---|
| 247 | testandcout(test5_02->isA(Class(Interface1))); |
---|
| 248 | |
---|
| 249 | std::cout << "\n"; |
---|
| 250 | std::cout << "test5_01 = A3, Erwartet: 0 0 0 1 1\n"; |
---|
| 251 | testandcout(test5_03->isA(Class(A1))); |
---|
| 252 | testandcout(test5_03->isA(Class(A2))); |
---|
| 253 | testandcout(test5_03->isA(Class(A1B1))); |
---|
| 254 | testandcout(test5_03->isA(Class(BaseObject))); |
---|
| 255 | testandcout(test5_03->isA(Class(Interface1))); |
---|
| 256 | |
---|
| 257 | std::cout << "\n"; |
---|
| 258 | std::cout << "isDirectA(XYZ)-Test:\n"; |
---|
| 259 | std::cout << "test5_01 = A1, Erwartet: 1 0 0 0 0\n"; |
---|
| 260 | testandcout(test5_01->isDirectlyA(Class(A1))); |
---|
| 261 | testandcout(test5_01->isDirectlyA(Class(A2))); |
---|
| 262 | testandcout(test5_01->isDirectlyA(Class(A1B1))); |
---|
| 263 | testandcout(test5_01->isDirectlyA(Class(BaseObject))); |
---|
| 264 | testandcout(test5_01->isDirectlyA(Class(Interface1))); |
---|
| 265 | |
---|
| 266 | std::cout << "\n"; |
---|
| 267 | std::cout << "test5_02 = A2, Erwartet: 0 1 0 0 0\n"; |
---|
| 268 | testandcout(test5_02->isDirectlyA(Class(A1))); |
---|
| 269 | testandcout(test5_02->isDirectlyA(Class(A2))); |
---|
| 270 | testandcout(test5_02->isDirectlyA(Class(A1B1))); |
---|
| 271 | testandcout(test5_02->isDirectlyA(Class(BaseObject))); |
---|
| 272 | testandcout(test5_02->isDirectlyA(Class(Interface1))); |
---|
| 273 | |
---|
| 274 | std::cout << "\n"; |
---|
| 275 | std::cout << "test5_03 = A3, Erwartet: 0 0 0 0 0\n"; |
---|
| 276 | testandcout(test5_03->isDirectlyA(Class(A1))); |
---|
| 277 | testandcout(test5_03->isDirectlyA(Class(A2))); |
---|
| 278 | testandcout(test5_03->isDirectlyA(Class(A1B1))); |
---|
| 279 | testandcout(test5_03->isDirectlyA(Class(BaseObject))); |
---|
| 280 | testandcout(test5_03->isDirectlyA(Class(Interface1))); |
---|
| 281 | |
---|
| 282 | std::cout << "\n"; |
---|
| 283 | std::cout << "isChildOf(XYZ)-Test:\n"; |
---|
| 284 | std::cout << "test5_04 = A1B1, Erwartet: 1 0 1 0 0 0 0\n"; |
---|
| 285 | testandcout(test5_04->isChildOf(Class(A1))); |
---|
| 286 | testandcout(test5_04->isChildOf(Class(A2))); |
---|
| 287 | testandcout(test5_04->isChildOf(Class(BaseObject))); |
---|
| 288 | testandcout(test5_04->isChildOf(Class(Interface1))); |
---|
| 289 | testandcout(test5_04->isChildOf(Class(Interface2))); |
---|
| 290 | testandcout(test5_04->isChildOf(Class(A1B1C2))); |
---|
| 291 | testandcout(test5_04->isChildOf(Class(A1B1))); |
---|
| 292 | |
---|
| 293 | std::cout << "\n"; |
---|
| 294 | std::cout << "test5_06 = A2B1, Erwartet: 0 1 1 0 0 0 0\n"; |
---|
| 295 | testandcout(test5_06->isChildOf(Class(A1))); |
---|
| 296 | testandcout(test5_06->isChildOf(Class(A2))); |
---|
| 297 | testandcout(test5_06->isChildOf(Class(BaseObject))); |
---|
| 298 | testandcout(test5_06->isChildOf(Class(Interface1))); |
---|
| 299 | testandcout(test5_06->isChildOf(Class(Interface2))); |
---|
| 300 | testandcout(test5_06->isChildOf(Class(A1B1C2))); |
---|
| 301 | testandcout(test5_06->isChildOf(Class(A1B1))); |
---|
| 302 | |
---|
| 303 | std::cout << "\n"; |
---|
| 304 | std::cout << "test5_07 = A2B2, Erwartet: 0 1 1 1 0 0\n"; |
---|
| 305 | testandcout(test5_07->isChildOf(Class(A1))); |
---|
| 306 | testandcout(test5_07->isChildOf(Class(A2))); |
---|
| 307 | testandcout(test5_07->isChildOf(Class(BaseObject))); |
---|
| 308 | testandcout(test5_07->isChildOf(Class(Interface1))); |
---|
| 309 | testandcout(test5_07->isChildOf(Class(Interface2))); |
---|
| 310 | testandcout(test5_07->isChildOf(Class(A1B1C2))); |
---|
| 311 | |
---|
| 312 | std::cout << "\n"; |
---|
| 313 | std::cout << "test5_08 = A3B1, Erwartet: 0 0 1 1 0 0\n"; |
---|
| 314 | testandcout(test5_08->isChildOf(Class(A1))); |
---|
| 315 | testandcout(test5_08->isChildOf(Class(A2))); |
---|
| 316 | testandcout(test5_08->isChildOf(Class(BaseObject))); |
---|
| 317 | testandcout(test5_08->isChildOf(Class(Interface1))); |
---|
| 318 | testandcout(test5_08->isChildOf(Class(Interface2))); |
---|
| 319 | testandcout(test5_08->isChildOf(Class(A1B1C2))); |
---|
| 320 | |
---|
| 321 | std::cout << "\n"; |
---|
| 322 | std::cout << "test5_09 = A3B2, Erwartet: 0 0 1 1 1 0\n"; |
---|
| 323 | testandcout(test5_09->isChildOf(Class(A1))); |
---|
| 324 | testandcout(test5_09->isChildOf(Class(A2))); |
---|
| 325 | testandcout(test5_09->isChildOf(Class(BaseObject))); |
---|
| 326 | testandcout(test5_09->isChildOf(Class(Interface1))); |
---|
| 327 | testandcout(test5_09->isChildOf(Class(Interface2))); |
---|
| 328 | testandcout(test5_09->isChildOf(Class(A1B1C2))); |
---|
| 329 | |
---|
| 330 | std::cout << "\n"; |
---|
| 331 | std::cout << "isParentOf(XYZ)-Test:\n"; |
---|
| 332 | std::cout << "test1 = BaseObject, Erwartet: 0 0 1 1 1 1 1\n"; |
---|
| 333 | testandcout(test1->isParentOf(Class(BaseObject))); |
---|
| 334 | testandcout(test1->isParentOf(Class(Interface1))); |
---|
| 335 | testandcout(test1->isParentOf(Class(A1))); |
---|
| 336 | testandcout(test1->isParentOf(Class(A2))); |
---|
| 337 | testandcout(test1->isParentOf(Class(A1B1))); |
---|
| 338 | testandcout(test1->isParentOf(Class(A2B2))); |
---|
| 339 | testandcout(test1->isParentOf(Class(A3B1C2))); |
---|
| 340 | |
---|
| 341 | std::cout << "\n"; |
---|
| 342 | std::cout << "test5_01 = A1, Erwartet: 0 0 0 0 1 0 0\n"; |
---|
| 343 | testandcout(test5_01->isParentOf(Class(BaseObject))); |
---|
| 344 | testandcout(test5_01->isParentOf(Class(Interface1))); |
---|
| 345 | testandcout(test5_01->isParentOf(Class(A1))); |
---|
| 346 | testandcout(test5_01->isParentOf(Class(A2))); |
---|
| 347 | testandcout(test5_01->isParentOf(Class(A1B1))); |
---|
| 348 | testandcout(test5_01->isParentOf(Class(A2B2))); |
---|
| 349 | testandcout(test5_01->isParentOf(Class(A3B1C2))); |
---|
| 350 | |
---|
| 351 | std::cout << "\n"; |
---|
| 352 | std::cout << "Interface1, Erwartet: 0 0 0 0 0 1 1\n"; |
---|
| 353 | testandcout(Class(Interface1)->isParentOf(Class(BaseObject))); |
---|
| 354 | testandcout(Class(Interface1)->isParentOf(Class(Interface1))); |
---|
| 355 | testandcout(Class(Interface1)->isParentOf(Class(A1))); |
---|
| 356 | testandcout(Class(Interface1)->isParentOf(Class(A2))); |
---|
| 357 | testandcout(Class(Interface1)->isParentOf(Class(A1B1))); |
---|
| 358 | testandcout(Class(Interface1)->isParentOf(Class(A2B2))); |
---|
| 359 | testandcout(Class(Interface1)->isParentOf(Class(A3B1C2))); |
---|
| 360 | */ |
---|
| 361 | /* |
---|
| 362 | std::cout << "Test 6\n"; |
---|
| 363 | std::cout << "1:\n"; |
---|
| 364 | Identifier* test6_01 = Class(A1B1); |
---|
| 365 | std::cout << "2:\n"; |
---|
| 366 | Identifier* test6_02 = Class(A1B1); |
---|
| 367 | std::cout << "3:\n"; |
---|
| 368 | Identifier* test6_03 = Class(A1); |
---|
| 369 | std::cout << "4:\n"; |
---|
| 370 | Identifier* test6_04 = Class(A1B1C1); |
---|
| 371 | std::cout << "5:\n"; |
---|
| 372 | Identifier* test6_05 = Class(A1B1); |
---|
| 373 | std::cout << "6:\n"; |
---|
| 374 | Identifier* test6_06 = Class(A1B1C1); |
---|
| 375 | |
---|
| 376 | std::cout << "\n"; |
---|
| 377 | std::cout << "BaseObject: parents: " << Class(BaseObject)->getParents().toString() << "\n"; |
---|
| 378 | std::cout << "BaseObject: children: " << Class(BaseObject)->getChildren().toString() << "\n"; |
---|
| 379 | |
---|
| 380 | std::cout << "\n"; |
---|
| 381 | std::cout << "A1: parents: " << Class(A1)->getParents().toString() << "\n"; |
---|
| 382 | std::cout << "A1: children: " << Class(A1)->getChildren().toString() << "\n"; |
---|
| 383 | |
---|
| 384 | std::cout << "\n"; |
---|
| 385 | std::cout << "A1B1: parents: " << Class(A1B1)->getParents().toString() << "\n"; |
---|
| 386 | std::cout << "A1B1: children: " << Class(A1B1)->getChildren().toString() << "\n"; |
---|
| 387 | |
---|
| 388 | std::cout << "\n"; |
---|
| 389 | std::cout << "A1B1C1: parents: " << Class(A1B1C1)->getParents().toString() << "\n"; |
---|
| 390 | std::cout << "A1B1C1: children: " << Class(A1B1C1)->getChildren().toString() << "\n"; |
---|
| 391 | |
---|
| 392 | std::cout << "\n"; |
---|
| 393 | std::cout << "A3B1C1 child of A3: " << Class(A3B1C1)->isChildOf(Class(A3)) << "\n"; |
---|
| 394 | std::cout << "\n"; |
---|
| 395 | std::cout << "A2 parent of A2B1C1: " << Class(A2)->isParentOf(Class(A2B1C1)) << "\n"; |
---|
| 396 | */ |
---|
| 397 | /* |
---|
| 398 | std::cout << "Test 7\n"; |
---|
| 399 | std::cout << "1\n"; |
---|
| 400 | SubclassIdentifier<A1B1> test7_01; |
---|
| 401 | test7_01 = Class(A1B1C1); |
---|
| 402 | |
---|
| 403 | SubclassIdentifier<A1B1> test7_02; |
---|
| 404 | test7_02 = Class(A1B1); |
---|
| 405 | |
---|
| 406 | std::cout << test7_01->getName() << "\n"; |
---|
| 407 | std::cout << test7_02->getName() << "\n"; |
---|
| 408 | */ |
---|
| 409 | /* |
---|
| 410 | std::cout << "2\n"; |
---|
| 411 | |
---|
| 412 | SubclassIdentifier<A1B1> test7_03; |
---|
| 413 | test7_03 = Class(A1); |
---|
| 414 | |
---|
| 415 | SubclassIdentifier<A1B1> test7_04; |
---|
| 416 | test7_04 = Class(A1B2); |
---|
| 417 | |
---|
| 418 | SubclassIdentifier<A1B1> test7_05; |
---|
| 419 | test7_05 = Class(A2); |
---|
| 420 | */ |
---|
| 421 | /* |
---|
| 422 | std::cout << "Test 8\n"; |
---|
| 423 | |
---|
| 424 | std::cout << "1\n"; |
---|
| 425 | Test1* test8_01 = new Test1; |
---|
| 426 | Test3* test8_03 = new Test3; |
---|
| 427 | test8_03->usefullClassesIsATest(test8_01); |
---|
| 428 | |
---|
| 429 | std::cout << "2\n"; |
---|
| 430 | Test2* test8_02 = new Test2; |
---|
| 431 | test8_03->usefullClassesIsATest(test8_02); |
---|
| 432 | |
---|
| 433 | std::cout << "3\n"; |
---|
| 434 | test8_01->setUsefullClass1(Class(Test1)); |
---|
| 435 | test8_01->setUsefullClass1(test8_02->getIdentifier()); |
---|
| 436 | test8_01->setUsefullClass2(Class(Test2)); |
---|
| 437 | test8_01->setUsefullClassOfTypeTest3(Class(Test3)); |
---|
| 438 | test8_01->setUsefullClassOfTypeTest3(test8_03->getIdentifier()); |
---|
| 439 | |
---|
| 440 | |
---|
| 441 | testandcout(test8_01->isA(Class(Test1))); |
---|
| 442 | testandcout(test8_01->isA(Class(Test2))); |
---|
| 443 | testandcout(test8_01->isA(Class(Test3))); |
---|
| 444 | |
---|
| 445 | Test2* test8_04 = new Test2; |
---|
| 446 | testandcout(test8_02->isA(Class(Test1))); |
---|
| 447 | testandcout(test8_02->isA(Class(Test2))); |
---|
| 448 | testandcout(test8_02->isA(Class(Test3))); |
---|
| 449 | |
---|
| 450 | Test3* test8_05 = new Test3; |
---|
| 451 | testandcout(test8_03->isA(Class(Test1))); |
---|
| 452 | testandcout(test8_03->isA(Class(Test2))); |
---|
| 453 | testandcout(test8_03->isA(Class(Test3))); |
---|
| 454 | |
---|
| 455 | delete test8_01; |
---|
| 456 | delete test8_02; |
---|
| 457 | delete test8_03; |
---|
| 458 | |
---|
| 459 | |
---|
| 460 | std::cout << "Test 9\n"; |
---|
| 461 | std::cout << "1\n"; |
---|
| 462 | Identifier* test9_01 = Class(A3); |
---|
| 463 | BaseObject* test9_02 = test9_01->fabricate(); |
---|
| 464 | std::cout << test9_02->getIdentifier()->getName() << "\n"; |
---|
| 465 | |
---|
| 466 | std::cout << "\n2\n"; |
---|
| 467 | BaseObject* test9_03 = Class(A1B2)->fabricate(); |
---|
| 468 | std::cout << test9_03->getIdentifier()->getName() << "\n"; |
---|
| 469 | |
---|
| 470 | std::cout << "\n3\n"; |
---|
| 471 | SubclassIdentifier<A1> test9_04; |
---|
| 472 | test9_04 = Class(A1B1C1); |
---|
| 473 | A1* test9_05 = test9_04.fabricate(); |
---|
| 474 | std::cout << test9_05->getIdentifier()->getName() << "\n"; |
---|
| 475 | |
---|
| 476 | std::cout << "\n4\n"; |
---|
| 477 | BaseObject* test9_06 = ID("A2B2")->fabricate(); |
---|
| 478 | std::cout << test9_06->getIdentifier()->getName() << "\n"; |
---|
| 479 | |
---|
| 480 | std::cout << "\n5\n"; |
---|
| 481 | delete test9_02; |
---|
| 482 | delete test9_03; |
---|
| 483 | delete test9_05; |
---|
| 484 | delete test9_06; |
---|
| 485 | */ |
---|
[375] | 486 | /* |
---|
[264] | 487 | std::cout << "Test 10\n"; |
---|
| 488 | Identifier* test10_01 = Class(A1B2); |
---|
| 489 | Identifier* test10_02 = Class(A2); |
---|
| 490 | Identifier* test10_03 = Class(A3B1C1); |
---|
| 491 | |
---|
| 492 | BaseObject* test10_04 = test10_01->fabricate(); |
---|
| 493 | BaseObject* test10_05 = test10_02->fabricate(); |
---|
| 494 | BaseObject* test10_06 = test10_03->fabricate(); |
---|
| 495 | |
---|
| 496 | BaseObject* test10_07; |
---|
| 497 | for (int i = 0; i < 10; i++) |
---|
| 498 | test10_07 = ID("A1B1C1")->fabricate(); |
---|
| 499 | |
---|
| 500 | std::cout << "1\n"; |
---|
| 501 | int count; |
---|
| 502 | |
---|
| 503 | count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it != 0; ++it) { count++; } |
---|
| 504 | std::cout << "Anzahl BaseObjects: " << count << "\n"; |
---|
| 505 | count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it != 0; ++it) { count++; } |
---|
| 506 | std::cout << "Anzahl A1: " << count << "\n"; |
---|
| 507 | count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; } |
---|
| 508 | std::cout << "Anzahl A1B1: " << count << "\n"; |
---|
| 509 | count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; } |
---|
| 510 | std::cout << "Anzahl A1B1C1: " << count << "\n"; |
---|
| 511 | count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; } |
---|
| 512 | std::cout << "Anzahl A2: " << count << "\n"; |
---|
| 513 | |
---|
| 514 | std::cout << "2\n"; |
---|
| 515 | BaseObject* test10_08; |
---|
| 516 | BaseObject* test10_09; |
---|
| 517 | BaseObject* test10_10; |
---|
| 518 | for (int i = 0; i < 10; i++) |
---|
| 519 | { |
---|
| 520 | test10_08 = ID("A2B1C1")->fabricate(); |
---|
[366] | 521 | std::string objName = "A2B1C1#"; |
---|
| 522 | objName += '0' + i; |
---|
| 523 | test10_08->setName(objName); |
---|
[264] | 524 | |
---|
| 525 | if (i == 0) |
---|
| 526 | test10_09 = test10_08; |
---|
| 527 | |
---|
| 528 | if (i == 5) |
---|
| 529 | test10_10 = test10_08; |
---|
| 530 | } |
---|
| 531 | |
---|
| 532 | count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it != 0; ++it) { count++; } |
---|
| 533 | std::cout << "Anzahl BaseObjects: " << count << "\n"; |
---|
| 534 | count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it != 0; ++it) { count++; } |
---|
| 535 | std::cout << "Anzahl A1: " << count << "\n"; |
---|
| 536 | count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; } |
---|
| 537 | std::cout << "Anzahl A1B1: " << count << "\n"; |
---|
| 538 | count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; } |
---|
| 539 | std::cout << "Anzahl A1B1C1: " << count << "\n"; |
---|
| 540 | count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; } |
---|
| 541 | std::cout << "Anzahl A2: " << count << "\n"; |
---|
| 542 | |
---|
| 543 | for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it) |
---|
[366] | 544 | std::cout << "Name: " << it->getName() << "\n"; |
---|
[264] | 545 | |
---|
| 546 | std::cout << "3\n"; |
---|
| 547 | for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it) |
---|
[366] | 548 | std::cout << "Name: " << it->getName() << "\n"; |
---|
[264] | 549 | |
---|
| 550 | std::cout << "4\n"; |
---|
| 551 | delete test10_08; |
---|
| 552 | |
---|
| 553 | count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it != 0; ++it) { count++; } |
---|
| 554 | std::cout << "Anzahl BaseObjects: " << count << "\n"; |
---|
| 555 | count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it != 0; ++it) { count++; } |
---|
| 556 | std::cout << "Anzahl A1: " << count << "\n"; |
---|
| 557 | count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; } |
---|
| 558 | std::cout << "Anzahl A1B1: " << count << "\n"; |
---|
| 559 | count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; } |
---|
| 560 | std::cout << "Anzahl A1B1C1: " << count << "\n"; |
---|
| 561 | count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; } |
---|
| 562 | std::cout << "Anzahl A2: " << count << "\n"; |
---|
| 563 | |
---|
| 564 | std::cout << "5\n"; |
---|
| 565 | for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it) |
---|
[366] | 566 | std::cout << "Name: " << it->getName() << "\n"; |
---|
[264] | 567 | |
---|
| 568 | std::cout << "6\n"; |
---|
| 569 | for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it) |
---|
[366] | 570 | std::cout << "Name: " << it->getName() << "\n"; |
---|
[264] | 571 | |
---|
| 572 | std::cout << "7\n"; |
---|
| 573 | delete test10_09; |
---|
| 574 | |
---|
| 575 | count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::end(); it != 0; --it) { count++; } |
---|
| 576 | std::cout << "Anzahl BaseObjects: " << count << "\n"; |
---|
| 577 | count = 0; for (Iterator<A1> it = ObjectList<A1>::end(); it != 0; --it) { count++; } |
---|
| 578 | std::cout << "Anzahl A1: " << count << "\n"; |
---|
| 579 | count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::end(); it; --it) { count++; } |
---|
| 580 | std::cout << "Anzahl A1B1: " << count << "\n"; |
---|
| 581 | count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::end(); it; --it) { count++; } |
---|
| 582 | std::cout << "Anzahl A1B1C1: " << count << "\n"; |
---|
| 583 | count = 0; for (Iterator<A2> it = ObjectList<A2>::end(); it; --it) { count++; } |
---|
| 584 | std::cout << "Anzahl A2: " << count << "\n"; |
---|
| 585 | |
---|
| 586 | std::cout << "8\n"; |
---|
| 587 | for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it) |
---|
[366] | 588 | std::cout << "Name: " << it->getName() << "\n"; |
---|
[264] | 589 | |
---|
| 590 | std::cout << "9\n"; |
---|
| 591 | for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it) |
---|
[366] | 592 | std::cout << "Name: " << it->getName() << "\n"; |
---|
[264] | 593 | |
---|
| 594 | std::cout << "10\n"; |
---|
| 595 | delete test10_10; |
---|
| 596 | |
---|
| 597 | count = 0; for (Iterator<BaseObject> it = ObjectList<BaseObject>::start(); it != 0; ++it) { count++; } |
---|
| 598 | std::cout << "Anzahl BaseObjects: " << count << "\n"; |
---|
| 599 | count = 0; for (Iterator<A1> it = ObjectList<A1>::start(); it != 0; ++it) { count++; } |
---|
| 600 | std::cout << "Anzahl A1: " << count << "\n"; |
---|
| 601 | count = 0; for (Iterator<A1B1> it = ObjectList<A1B1>::start(); it; ++it) { count++; } |
---|
| 602 | std::cout << "Anzahl A1B1: " << count << "\n"; |
---|
| 603 | count = 0; for (Iterator<A1B1C1> it = ObjectList<A1B1C1>::start(); it; ++it) { count++; } |
---|
| 604 | std::cout << "Anzahl A1B1C1: " << count << "\n"; |
---|
| 605 | count = 0; for (Iterator<A2> it = ObjectList<A2>::start(); it; ++it) { count++; } |
---|
| 606 | std::cout << "Anzahl A2: " << count << "\n"; |
---|
| 607 | |
---|
| 608 | std::cout << "11\n"; |
---|
| 609 | for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::start(); it; ++it) |
---|
[366] | 610 | std::cout << "Name: " << it->getName() << "\n"; |
---|
[264] | 611 | |
---|
| 612 | std::cout << "12\n"; |
---|
| 613 | for (Iterator<A2B1C1> it = ObjectList<A2B1C1>::end(); it; --it) |
---|
[366] | 614 | std::cout << "Name: " << it->getName() << "\n"; |
---|
[264] | 615 | |
---|
| 616 | std::cout << "13\n"; |
---|
[375] | 617 | */ |
---|
| 618 | std::cout << "Test 11\n"; |
---|
| 619 | /* |
---|
| 620 | std::cout << "1\n"; |
---|
| 621 | count = 0; for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) { count++; } |
---|
| 622 | std::cout << "AnzahlTickable: " << count << "\n"; |
---|
[366] | 623 | |
---|
[375] | 624 | Test1* test11_1; |
---|
| 625 | for (int i = 0; i < 3; i++) |
---|
| 626 | test11_1 = new Test1; |
---|
| 627 | |
---|
| 628 | count = 0; for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) { count++; } |
---|
| 629 | std::cout << "AnzahlTickable: " << count << "\n"; |
---|
| 630 | |
---|
| 631 | for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) |
---|
| 632 | it->tick(0); |
---|
| 633 | |
---|
| 634 | std::cout << "2\n"; |
---|
[434] | 635 | Test2* test11_2 = new Test2; |
---|
[375] | 636 | */ |
---|
| 637 | |
---|
| 638 | std::cout << "3\n"; |
---|
[434] | 639 | Test3* test11_3 = new Test3; |
---|
| 640 | test11_3->configOutput(); |
---|
[375] | 641 | |
---|
[434] | 642 | std::cout << "4\n"; |
---|
| 643 | |
---|
[460] | 644 | std::cout << "Test 12\n"; |
---|
| 645 | std::cout << "1\n"; |
---|
| 646 | |
---|
| 647 | WorldEntity* test12_1 = new WorldEntity; |
---|
| 648 | |
---|
| 649 | std::cout << sizeof(WorldEntity) << std::endl; |
---|
| 650 | |
---|
| 651 | std::cout << "2\n"; |
---|
| 652 | |
---|
| 653 | |
---|
| 654 | |
---|
[375] | 655 | startRenderLoop(); |
---|
[266] | 656 | } |
---|
[74] | 657 | |
---|
[266] | 658 | ~OrxApplication() |
---|
| 659 | { |
---|
| 660 | mInputManager->destroyInputObject(mKeyboard); |
---|
| 661 | OIS::InputManager::destroyInputSystem(mInputManager); |
---|
[137] | 662 | |
---|
[266] | 663 | // delete mRenderer; |
---|
| 664 | // delete mSystem; |
---|
[137] | 665 | |
---|
[266] | 666 | delete mListener; |
---|
| 667 | delete mRoot; |
---|
| 668 | } |
---|
[137] | 669 | |
---|
[266] | 670 | private: |
---|
| 671 | Ogre::Root *mRoot; |
---|
| 672 | OIS::Keyboard *mKeyboard; |
---|
| 673 | OIS::Mouse *mMouse; |
---|
| 674 | OIS::InputManager *mInputManager; |
---|
| 675 | CEGUI::OgreCEGUIRenderer *mRenderer; |
---|
| 676 | CEGUI::System *mSystem; |
---|
| 677 | OrxExitListener *mListener; |
---|
[137] | 678 | |
---|
[266] | 679 | void createRoot() |
---|
| 680 | { |
---|
| 681 | #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE |
---|
| 682 | mRoot = new Ogre::Root(macBundlePath() + "/Contents/Resources/plugins.cfg"); |
---|
| 683 | #else |
---|
| 684 | mRoot = new Ogre::Root(); |
---|
| 685 | #endif |
---|
| 686 | } |
---|
[74] | 687 | |
---|
[266] | 688 | void defineResources() |
---|
| 689 | { |
---|
| 690 | Ogre::String secName, typeName, archName; |
---|
| 691 | Ogre::ConfigFile cf; |
---|
| 692 | #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE |
---|
| 693 | cf.load(macBundlePath() + "/Contents/Resources/resources.cfg"); |
---|
| 694 | #else |
---|
| 695 | cf.load("resources.cfg"); |
---|
| 696 | #endif |
---|
| 697 | |
---|
| 698 | Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator(); |
---|
| 699 | while (seci.hasMoreElements()) |
---|
[264] | 700 | { |
---|
[266] | 701 | secName = seci.peekNextKey(); |
---|
| 702 | Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); |
---|
| 703 | Ogre::ConfigFile::SettingsMultiMap::iterator i; |
---|
| 704 | for (i = settings->begin(); i != settings->end(); ++i) |
---|
[264] | 705 | { |
---|
[266] | 706 | typeName = i->first; |
---|
| 707 | archName = i->second; |
---|
| 708 | #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE |
---|
| 709 | Ogre::ResourceGroupManager::getSingleton().addResourceLocation( String(macBundlePath() + "/" + archName), typeName, secName); |
---|
| 710 | #else |
---|
| 711 | Ogre::ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName); |
---|
| 712 | #endif |
---|
[264] | 713 | } |
---|
| 714 | } |
---|
[266] | 715 | } |
---|
[264] | 716 | |
---|
[266] | 717 | void setupRenderSystem() |
---|
| 718 | { |
---|
| 719 | if (!mRoot->restoreConfig() && !mRoot->showConfigDialog()) |
---|
| 720 | throw Ogre::Exception(52, "User canceled the config dialog!", "OrxApplication::setupRenderSystem()"); |
---|
| 721 | } |
---|
[74] | 722 | |
---|
[266] | 723 | void createRenderWindow() |
---|
| 724 | { |
---|
| 725 | mRoot->initialise(true, "Ogre Render Window"); |
---|
| 726 | } |
---|
[74] | 727 | |
---|
[266] | 728 | void initializeResourceGroups() |
---|
| 729 | { |
---|
| 730 | Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); |
---|
| 731 | Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); |
---|
| 732 | } |
---|
[74] | 733 | |
---|
[266] | 734 | void createScene(void) |
---|
| 735 | { |
---|
[74] | 736 | |
---|
[375] | 737 | // string levelFile = "sp_level_moonstation.oxw"; |
---|
| 738 | // loader::LevelLoader* loader = new loader::LevelLoader(levelFile); |
---|
[266] | 739 | } |
---|
[164] | 740 | |
---|
[266] | 741 | void setupScene() |
---|
| 742 | { |
---|
[460] | 743 | WorldEntity::sceneManager_s = mRoot->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager"); |
---|
| 744 | Ogre::Camera *cam = WorldEntity::sceneManager_s->createCamera("Camera"); |
---|
[266] | 745 | Ogre::Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam); |
---|
| 746 | } |
---|
[258] | 747 | |
---|
[266] | 748 | void setupInputSystem() |
---|
| 749 | { |
---|
| 750 | size_t windowHnd = 0; |
---|
| 751 | std::ostringstream windowHndStr; |
---|
| 752 | OIS::ParamList pl; |
---|
| 753 | Ogre::RenderWindow *win = mRoot->getAutoCreatedWindow(); |
---|
[74] | 754 | |
---|
[266] | 755 | win->getCustomAttribute("WINDOW", &windowHnd); |
---|
| 756 | windowHndStr << windowHnd; |
---|
| 757 | pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str())); |
---|
| 758 | mInputManager = OIS::InputManager::createInputSystem(pl); |
---|
[74] | 759 | |
---|
[266] | 760 | try |
---|
| 761 | { |
---|
| 762 | mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false)); |
---|
| 763 | mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, false)); |
---|
[264] | 764 | } |
---|
[266] | 765 | catch (const OIS::Exception &e) |
---|
[264] | 766 | { |
---|
[266] | 767 | throw new Ogre::Exception(42, e.eText, "OrxApplication::setupInputSystem"); |
---|
| 768 | } |
---|
| 769 | } |
---|
[74] | 770 | |
---|
[266] | 771 | void setupCEGUI() |
---|
| 772 | { |
---|
| 773 | Ogre::SceneManager *mgr = mRoot->getSceneManager("Default SceneManager"); |
---|
| 774 | Ogre::RenderWindow *win = mRoot->getAutoCreatedWindow(); |
---|
[137] | 775 | |
---|
[266] | 776 | // CEGUI setup |
---|
| 777 | // mRenderer = new CEGUI::OgreCEGUIRenderer(win, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mgr); |
---|
| 778 | // mSystem = new CEGUI::System(mRenderer); |
---|
[137] | 779 | |
---|
[266] | 780 | // Other CEGUI setup here. |
---|
| 781 | } |
---|
[137] | 782 | |
---|
[266] | 783 | void createFrameListener() |
---|
| 784 | { |
---|
[375] | 785 | TickFrameListener* TickFL = new TickFrameListener(); |
---|
| 786 | mRoot->addFrameListener(TickFL); |
---|
| 787 | |
---|
| 788 | TimerFrameListener* TimerFL = new TimerFrameListener(); |
---|
| 789 | mRoot->addFrameListener(TimerFL); |
---|
| 790 | |
---|
[266] | 791 | mListener = new OrxExitListener(mKeyboard); |
---|
[375] | 792 | mRoot->addFrameListener(mListener); |
---|
[266] | 793 | } |
---|
| 794 | |
---|
| 795 | void startRenderLoop() |
---|
| 796 | { |
---|
| 797 | mRoot->startRendering(); |
---|
| 798 | } |
---|
| 799 | }; |
---|
[264] | 800 | } |
---|
[137] | 801 | |
---|
[264] | 802 | using namespace Ogre; |
---|
| 803 | |
---|
[454] | 804 | //#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32 |
---|
| 805 | //#define WIN32_LEAN_AND_MEAN |
---|
| 806 | //#include "windows.h" |
---|
[74] | 807 | |
---|
[454] | 808 | // INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT) |
---|
| 809 | //#else |
---|
[137] | 810 | int main(int argc, char **argv) |
---|
[454] | 811 | //#endif |
---|
[74] | 812 | { |
---|
[137] | 813 | try |
---|
| 814 | { |
---|
[454] | 815 | SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log"); |
---|
[264] | 816 | orxonox::OrxApplication orxonox; |
---|
[74] | 817 | orxonox.go(); |
---|
[137] | 818 | } |
---|
| 819 | catch(Exception& e) |
---|
| 820 | { |
---|
[454] | 821 | //#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32 |
---|
| 822 | // MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL); |
---|
| 823 | //#else |
---|
[74] | 824 | fprintf(stderr, "An exception has occurred: %s\n", |
---|
| 825 | e.getFullDescription().c_str()); |
---|
[454] | 826 | //#endif |
---|
[74] | 827 | } |
---|
| 828 | |
---|
| 829 | return 0; |
---|
| 830 | } |
---|
[137] | 831 | |
---|