| [1670] | 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 |  *      Fabian 'x3n' Landau | 
|---|
 | 26 |  * | 
|---|
 | 27 |  */ | 
|---|
 | 28 |  | 
|---|
 | 29 | #include "OrxonoxStableHeaders.h" | 
|---|
 | 30 | #include "GSStandalone.h" | 
|---|
 | 31 |  | 
|---|
| [2790] | 32 | #include <OgreViewport.h> | 
|---|
 | 33 | #include <OgreCamera.h> | 
|---|
| [2087] | 34 | #include "core/Core.h" | 
|---|
| [2790] | 35 | #include "core/ConsoleCommand.h" | 
|---|
 | 36 | #include "gui/GUIManager.h" | 
|---|
| [1670] | 37 |  | 
|---|
 | 38 | namespace orxonox | 
|---|
 | 39 | { | 
|---|
| [2790] | 40 |     SetConsoleCommand(GSStandalone, showGUI, true).setAsInputCommand(); | 
|---|
 | 41 |  | 
|---|
 | 42 |     bool GSStandalone::guiShowing_s = false; | 
|---|
 | 43 |  | 
|---|
| [1670] | 44 |     GSStandalone::GSStandalone() | 
|---|
| [2087] | 45 |         : GameState<GSGraphics>("standalone") | 
|---|
| [1670] | 46 |     { | 
|---|
 | 47 |     } | 
|---|
 | 48 |  | 
|---|
 | 49 |     GSStandalone::~GSStandalone() | 
|---|
 | 50 |     { | 
|---|
 | 51 |     } | 
|---|
 | 52 |  | 
|---|
| [2790] | 53 |     void GSStandalone::showGUI() | 
|---|
 | 54 |     { | 
|---|
 | 55 |         GSStandalone::guiShowing_s = true; | 
|---|
 | 56 |     } | 
|---|
 | 57 |  | 
|---|
| [1670] | 58 |     void GSStandalone::enter() | 
|---|
 | 59 |     { | 
|---|
| [2087] | 60 |         Core::setIsStandalone(true); | 
|---|
| [1670] | 61 |  | 
|---|
| [2087] | 62 |         GSLevel::enter(this->getParent()->getViewport()); | 
|---|
| [2790] | 63 |  | 
|---|
 | 64 |         guiManager_ = getParent()->getGUIManager(); | 
|---|
 | 65 |         // not sure if necessary | 
|---|
 | 66 |         // guiManager_->loadScene("IngameMenu"); | 
|---|
| [1670] | 67 |     } | 
|---|
 | 68 |  | 
|---|
 | 69 |     void GSStandalone::leave() | 
|---|
 | 70 |     { | 
|---|
| [2087] | 71 |         GSLevel::leave(); | 
|---|
| [1670] | 72 |  | 
|---|
| [2087] | 73 |         Core::setIsStandalone(false); | 
|---|
| [1670] | 74 |     } | 
|---|
 | 75 |  | 
|---|
| [1674] | 76 |     void GSStandalone::ticked(const Clock& time) | 
|---|
| [1670] | 77 |     { | 
|---|
| [2790] | 78 |         if (guiShowing_s) | 
|---|
 | 79 |         { | 
|---|
 | 80 |             guiManager_->showGUI("IngameMenu", this->getParent()->getViewport()->getCamera()->getSceneManager()); | 
|---|
 | 81 |         } | 
|---|
 | 82 |         else | 
|---|
 | 83 |         { | 
|---|
 | 84 |             if (guiManager_) | 
|---|
 | 85 |                 guiManager_->hideGUI(); | 
|---|
 | 86 |         } | 
|---|
 | 87 |         // tick CEGUI | 
|---|
 | 88 |         guiManager_->tick(time.getDeltaTime()); | 
|---|
 | 89 |  | 
|---|
| [1674] | 90 |         GSLevel::ticked(time); | 
|---|
 | 91 |         this->tickChild(time); | 
|---|
| [1670] | 92 |     } | 
|---|
 | 93 | } | 
|---|