Last change
on this file since 141 was
141,
checked in by rgrieder, 17 years ago
|
RunManager.cpp completely commented in Doxygen style.
One or two comments are yet inappropriate since a few changes to the code have to be made anyway. coming soon.
|
File size:
1.7 KB
|
Rev | Line | |
---|
[141] | 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 | |
---|
[123] | 29 | #include "Orxonox.h" |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | void Orxonox::go(void) |
---|
| 33 | { |
---|
| 34 | if (!setup()) |
---|
| 35 | return; |
---|
| 36 | |
---|
| 37 | mTimer = new Timer(); |
---|
| 38 | |
---|
| 39 | unsigned long lastTime = mTimer->getMilliseconds(); |
---|
| 40 | |
---|
| 41 | while (true) |
---|
| 42 | { |
---|
| 43 | //Pump messages in all registered RenderWindow windows |
---|
| 44 | WindowEventUtilities::messagePump(); |
---|
| 45 | |
---|
| 46 | mOgre->getRoot()->renderOneFrame(); |
---|
| 47 | |
---|
[141] | 48 | if (!mRunMgr->tick(mTimer->getMilliseconds(), |
---|
| 49 | (mTimer->getMilliseconds() - lastTime) / 1000.0)) |
---|
[123] | 50 | break; |
---|
| 51 | lastTime = mTimer->getMilliseconds(); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | // clean up |
---|
| 55 | destroy(); |
---|
| 56 | } |
---|
| 57 | |
---|
[141] | 58 | |
---|
[123] | 59 | bool Orxonox::setup(void) |
---|
| 60 | { |
---|
| 61 | // create new 3D ogre render engine |
---|
| 62 | mOgre = new OgreControl(); |
---|
| 63 | mOgre->initialise(); |
---|
| 64 | |
---|
| 65 | mRunMgr = new RunManager(mOgre); |
---|
| 66 | |
---|
| 67 | return true; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | void Orxonox::destroy() |
---|
| 72 | { |
---|
| 73 | if (mTimer) |
---|
| 74 | delete mTimer; |
---|
| 75 | if (mRunMgr) |
---|
| 76 | delete mRunMgr; |
---|
| 77 | if (mOgre) |
---|
| 78 | delete mOgre; |
---|
[141] | 79 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.