Entry point for your game. This is build by default using the "StandardMainLoop" toolkit. Feel free to bring code over directly as you need to modify or extend things. You will need to merge against future changes to the SML code if you do this.
| 299 | // to bring code over directly as you need to modify or extend things. You |
| 300 | // will need to merge against future changes to the SML code if you do this. |
| 301 | S32 TorqueMain(S32 argc, const char **argv) |
| 302 | { |
| 303 | // Some handy debugging code: |
| 304 | // if (argc == 1) { |
| 305 | // static const char* argvFake[] = { "dtest.exe", "-jload", "test.jrn" }; |
| 306 | // argc = 3; |
| 307 | // argv = argvFake; |
| 308 | // } |
| 309 | |
| 310 | // Memory::enableLogging("testMem.log"); |
| 311 | // Memory::setBreakAlloc(104717); |
| 312 | |
| 313 | // Initialize the subsystems. |
| 314 | StandardMainLoop::init(); |
| 315 | |
| 316 | // Handle any command line args. |
| 317 | if(!StandardMainLoop::handleCommandLine(argc, argv)) |
| 318 | { |
| 319 | Platform::AlertOK("Error", "Failed to initialize game, shutting down."); |
| 320 | |
| 321 | return 1; |
| 322 | } |
| 323 | |
| 324 | // Main loop |
| 325 | while(StandardMainLoop::doMainLoop()); |
| 326 | |
| 327 | // Clean everything up. |
| 328 | StandardMainLoop::shutdown(); |
| 329 | |
| 330 | // Do we need to restart? |
| 331 | if( StandardMainLoop::requiresRestart() ) |
| 332 | Platform::restartInstance(); |
| 333 | |
| 334 | // Return. |
| 335 | return StandardMainLoop::getReturnStatus(); |
| 336 | } |
| 337 | |
| 338 | #endif //TORQUE_SHARED |