Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: sandbox_qt/src/libraries/core/Game.cc @ 7421

Last change on this file since 7421 was 7421, checked in by rgrieder, 14 years ago

Basic stuff up and running for the Qt sandbox.
No GUI support yet.

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Reto Grieder
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30@file
31@brief
32    Implementation of the Game class.
33*/
34
35#include "Game.h"
36
37#include <exception>
38
39#include "util/Debug.h"
40#include "util/Exception.h"
41#include "util/Sleep.h"
42#include "Core.h"
43
44namespace orxonox
45{
46    Game* Game::singletonPtr_s = 0;
47
48    Game::Game(const std::string& cmdLine)
49    {
50        this->bAbort_ = false;
51
52        // Create the Core
53        this->core_.reset(new Core(cmdLine));
54    }
55
56    /**
57    @brief
58        All destruction code is handled by QScopedPointers.
59    */
60    Game::~Game()
61    {
62    }
63
64    void Game::setConfigValues()
65    {
66        /*
67        SetConfigValue(statisticsRefreshCycle_, 250000)
68            .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
69        SetConfigValue(statisticsAvgLength_, 1000000)
70            .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
71        SetConfigValue(fpsLimit_, 50)
72            .description("Sets the desired frame rate (0 for no limit).");
73        */
74    }
75
76    /**
77    @brief
78        Main loop of the orxonox game.
79    */
80    void Game::run()
81    {
82        while (!this->bAbort_)
83        {
84            try
85                { this->core_->update(); }
86            catch (...)
87            {
88                COUT(0) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << std::endl;
89                COUT(0) << "This should really never happen! Closing the program." << std::endl;
90                this->stop();
91                break;
92            }
93        }
94    }
95
96    void Game::stop()
97    {
98        this->bAbort_ = true;
99    }
100}
Note: See TracBrowser for help on using the repository browser.