Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2008, 2:51:02 PM (16 years ago)
Author:
rgrieder
Message:
  • Added debug overlay that is constantly shown in graphics mode. F2 toggles its visibility, but only in level mode for now.
  • Added ConstructionCallback to get informed about the construction of any object of a specific type. Use RegisterConstructionCallback(ThisClassName, TargetClassName, FunctionName); to register such a callback.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/gamestates/GSGraphics.cc

    r2023 r2084  
    5151#include "core/input/KeyBinder.h"
    5252#include "core/input/ExtendedInputState.h"
     53#include "core/Loader.h"
     54#include "core/XMLFile.h"
    5355#include "overlays/console/InGameConsole.h"
    5456#include "gui/GUIManager.h"
    5557#include "tools/WindowEventListener.h"
     58#include "objects/Tickable.h"
    5659#include "Settings.h"
    5760
     
    6568        , renderWindow_(0)
    6669        , viewport_(0)
     70        , bWindowEventListenerUpdateRequired_(false)
    6771        , inputManager_(0)
    6872        , console_(0)
     
    7781        , statisticsStartCount_(0)
    7882        , tickTime_(0)
     83        , debugOverlay_(0)
    7984    {
    8085        RegisterRootObject(GSGraphics);
     
    114119        this->initialiseResources();
    115120
    116 
    117         // HACK: temporary:
    118         //graphicsEngine_->renderWindow_  = this->renderWindow_;
    119         //graphicsEngine_->root_          = this->ogreRoot_;
    120         //graphicsEngine_->viewport_      = this->viewport_;
    121 
     121        // We want to get informed whenever an object of type WindowEventListener is created
     122        // in order to later update the window size.
     123        bWindowEventListenerUpdateRequired_ = false;
     124        RegisterConstructionCallback(GSGraphics, orxonox::WindowEventListener, requestWindowEventListenerUpdate);
     125
     126        // load debug overlay
     127        COUT(3) << "Loading Debug Overlay..." << std::endl;
     128        this->debugOverlay_ = new XMLFile(Settings::getDataPath() + "overlay/debug.oxo");
     129        Loader::open(debugOverlay_);
    122130
    123131        // Calls the InputManager which sets up the input devices.
     
    166174        //delete this->masterKeyBinder_;
    167175        delete this->inputManager_;
     176
     177        Loader::unload(this->debugOverlay_);
     178        delete this->debugOverlay_;
    168179
    169180        // destroy render window
     
    222233        this->console_->tick(dt);
    223234        this->tickChild(time);
     235
     236        /*** HACK *** HACK ***/
     237        // Call the Tickable objects
     238        for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
     239            it->tick(time.getDeltaTime());
     240        /*** HACK *** HACK ***/
     241
     242        if (this->bWindowEventListenerUpdateRequired_)
     243        {
     244            // Update all WindowEventListeners for the case a new one was created.
     245            this->windowResized(this->renderWindow_);
     246            this->bWindowEventListenerUpdateRequired_ = false;
     247        }
    224248
    225249        unsigned long long timeAfterTick = time.getRealMicroseconds();
Note: See TracChangeset for help on using the changeset viewer.