Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 16, 2009, 11:47:06 AM (16 years ago)
Author:
bknecht
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/gamestates/GSStandalone.cc

    r2087 r2790  
    3030#include "GSStandalone.h"
    3131
     32#include <OgreViewport.h>
     33#include <OgreCamera.h>
    3234#include "core/Core.h"
     35#include "core/ConsoleCommand.h"
     36#include "gui/GUIManager.h"
    3337
    3438namespace orxonox
    3539{
     40    SetConsoleCommand(GSStandalone, showGUI, true).setAsInputCommand();
     41
     42    bool GSStandalone::guiShowing_s = false;
     43
    3644    GSStandalone::GSStandalone()
    3745        : GameState<GSGraphics>("standalone")
     
    4351    }
    4452
     53    void GSStandalone::showGUI()
     54    {
     55        GSStandalone::guiShowing_s = true;
     56    }
     57
    4558    void GSStandalone::enter()
    4659    {
     
    4861
    4962        GSLevel::enter(this->getParent()->getViewport());
     63
     64        guiManager_ = getParent()->getGUIManager();
     65        // not sure if necessary
     66        // guiManager_->loadScene("IngameMenu");
    5067    }
    5168
     
    5976    void GSStandalone::ticked(const Clock& time)
    6077    {
     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
    6190        GSLevel::ticked(time);
    6291        this->tickChild(time);
Note: See TracChangeset for help on using the changeset viewer.