Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 25, 2009, 2:14:05 PM (15 years ago)
Author:
rgrieder
Message:

Moved InputManager, GUIManager and GraphicsManager handling from GSGraphics to Core.

File:
1 edited

Legend:

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

    r3346 r3349  
    3535#include "GSGraphics.h"
    3636
    37 #include <boost/filesystem.hpp>
    38 #include <OgreRenderWindow.h>
    39 
    4037#include "util/Convert.h"
    4138#include "core/Clock.h"
     
    4441#include "core/Core.h"
    4542#include "core/Game.h"
    46 #include "core/GameMode.h"
    47 #include "core/GraphicsManager.h"
    4843#include "core/GUIManager.h"
    4944#include "core/input/InputManager.h"
     
    6055namespace orxonox
    6156{
    62     DeclareGameState(GSGraphics, "graphics", true, true);
     57    DeclareGameState(GSGraphics, "graphics", false, true);
    6358
    6459    GSGraphics::GSGraphics(const GameStateConstrParams& params)
    6560        : GameState(params)
    66         , inputManager_(0)
    6761        , console_(0)
    68         , guiManager_(0)
    69         , graphicsManager_(0)
    7062        , soundManager_(0)
    7163        , masterKeyBinder_(0)
     
    9991        Core::getInstance().loadGraphics();
    10092
    101         // Load OGRE including the render window
    102         this->graphicsManager_ = new GraphicsManager();
    103 
    10493        // load debug overlay
    10594        COUT(3) << "Loading Debug Overlay..." << std::endl;
    106         this->debugOverlay_ = new XMLFile((Core::getMediaPath() / "overlay" / "debug.oxo").string());
     95        this->debugOverlay_ = new XMLFile(Core::getMediaPathString() + "overlay/debug.oxo");
    10796        Loader::open(debugOverlay_);
    108 
    109         // The render window width and height are used to set up the mouse movement.
    110         size_t windowHnd = 0;
    111         Ogre::RenderWindow* renderWindow = GraphicsManager::getInstance().getRenderWindow();
    112         renderWindow->getCustomAttribute("WINDOW", &windowHnd);
    113 
    114         // Calls the InputManager which sets up the input devices.
    115         inputManager_ = new InputManager(windowHnd);
    116 
    11797        // load master key bindings
    11898        masterInputState_ = InputManager::getInstance().createInputState("master", true);
     
    127107        console_ = new InGameConsole();
    128108        console_->initialise();
    129 
    130         // load the CEGUI interface
    131         guiManager_ = new GUIManager(renderWindow);
    132109
    133110        // add console command to toggle GUI
     
    161138        delete this->masterKeyBinder_;
    162139
    163         delete this->guiManager_;
    164140        delete this->console_;
    165141
     
    169145        delete this->soundManager_;
    170146
    171         delete this->inputManager_;
    172         this->inputManager_ = 0;
    173 
    174         // HACK:
     147        // HACK: (destroys a resource smart pointer)
    175148        Map::hackDestroyMap();
    176 
    177         delete graphicsManager_;
    178149
    179150        // Unload OGRE, CEGUI and OIS
     
    210181        }
    211182
    212         uint64_t timeBeforeTick = time.getRealMicroseconds();
    213 
    214         this->inputManager_->update(time);
    215183        this->console_->update(time);
    216 
    217         uint64_t timeAfterTick = time.getRealMicroseconds();
    218 
    219         // Also add our tick time
    220         Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
    221 
    222         // Process gui events
    223         this->guiManager_->update(time);
    224         // Render
    225         this->graphicsManager_->update(time);
    226184    }
    227185}
Note: See TracChangeset for help on using the changeset viewer.