Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickups/src/orxonox/gamestates/GSStandalone.cc @ 2956

Last change on this file since 2956 was 2790, checked in by bknecht, 16 years ago

Ugly hack to use GUI ingame. Hack itself needs improvement AND of course it should be hackfree!

  • Property svn:eol-style set to native
File size: 2.3 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 *      Fabian 'x3n' Landau
26 *
27 */
28
29#include "OrxonoxStableHeaders.h"
30#include "GSStandalone.h"
31
32#include <OgreViewport.h>
33#include <OgreCamera.h>
34#include "core/Core.h"
35#include "core/ConsoleCommand.h"
36#include "gui/GUIManager.h"
37
38namespace orxonox
39{
40    SetConsoleCommand(GSStandalone, showGUI, true).setAsInputCommand();
41
42    bool GSStandalone::guiShowing_s = false;
43
44    GSStandalone::GSStandalone()
45        : GameState<GSGraphics>("standalone")
46    {
47    }
48
49    GSStandalone::~GSStandalone()
50    {
51    }
52
53    void GSStandalone::showGUI()
54    {
55        GSStandalone::guiShowing_s = true;
56    }
57
58    void GSStandalone::enter()
59    {
60        Core::setIsStandalone(true);
61
62        GSLevel::enter(this->getParent()->getViewport());
63
64        guiManager_ = getParent()->getGUIManager();
65        // not sure if necessary
66        // guiManager_->loadScene("IngameMenu");
67    }
68
69    void GSStandalone::leave()
70    {
71        GSLevel::leave();
72
73        Core::setIsStandalone(false);
74    }
75
76    void GSStandalone::ticked(const Clock& time)
77    {
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
90        GSLevel::ticked(time);
91        this->tickChild(time);
92    }
93}
Note: See TracBrowser for help on using the repository browser.