Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 12, 2009, 8:20:07 PM (15 years ago)
Author:
rgrieder
Message:

Merged core5 branch back to the trunk.
Key features include clean level unloading and an extended XML event system.

Two important notes:
Delete your keybindings.ini files! * or you will still get parser errors when loading the key bindings.
Delete build_dir/lib/modules/libgamestates.module! * or orxonox won't start.
Best thing to do is to delete the build folder ;)

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/GraphicsManager.cc

    r5781 r5929  
    4848
    4949#include "SpecialConfig.h"
     50#include "util/Clock.h"
    5051#include "util/Exception.h"
    5152#include "util/StringUtils.h"
    5253#include "util/SubString.h"
    53 #include "Clock.h"
    5454#include "ConsoleCommand.h"
    5555#include "ConfigValueIncludes.h"
    5656#include "CoreIncludes.h"
    57 #include "Core.h"
    5857#include "Game.h"
    5958#include "GameMode.h"
    6059#include "Loader.h"
    6160#include "MemoryArchive.h"
     61#include "PathConfig.h"
    6262#include "WindowEventListener.h"
    6363#include "XMLFile.h"
     
    102102
    103103        // At first, add the root paths of the data directories as resource locations
    104         Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Core::getDataPathString(), "FileSystem", "dataRoot", false);
     104        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getDataPathString(), "FileSystem", "dataRoot", false);
    105105        // Load resources
    106106        resources_.reset(new XMLFile("resources.oxr", "dataRoot"));
     
    109109
    110110        // Only for development runs
    111         if (Core::isDevelopmentRun())
    112         {
    113             Ogre::ResourceGroupManager::getSingleton().addResourceLocation(Core::getExternalDataPathString(), "FileSystem", "externalDataRoot", false);
     111        if (PathConfig::isDevelopmentRun())
     112        {
     113            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(PathConfig::getExternalDataPathString(), "FileSystem", "externalDataRoot", false);
    114114            extResources_.reset(new XMLFile("resources.oxr", "externalDataRoot"));
    115115            extResources_->setLuaSupport(false);
     
    130130    GraphicsManager::~GraphicsManager()
    131131    {
     132        Loader::unload(debugOverlay_.get());
     133
    132134        Ogre::WindowEventUtilities::removeWindowEventListener(renderWindow_, ogreWindowEventListener_.get());
    133135        // TODO: Destroy the console command
     136
     137        // Undeclare the resources
     138        Loader::unload(resources_.get());
     139        if (PathConfig::isDevelopmentRun())
     140            Loader::unload(extResources_.get());
    134141    }
    135142
     
    241248        }
    242249
    243         boost::filesystem::path ogreConfigFilepath(Core::getConfigPath() / this->ogreConfigFile_);
    244         boost::filesystem::path ogreLogFilepath(Core::getLogPath() / this->ogreLogFile_);
     250        boost::filesystem::path ogreConfigFilepath(PathConfig::getConfigPath() / this->ogreConfigFile_);
     251        boost::filesystem::path ogreLogFilepath(PathConfig::getLogPath() / this->ogreLogFile_);
    245252
    246253        // create a new logManager
     
    313320
    314321        // add console commands
    315         FunctorMember<GraphicsManager>* functor1 = createFunctor(&GraphicsManager::printScreen);
    316         ccPrintScreen_ = createConsoleCommand(functor1->setObject(this), "printScreen");
     322        ccPrintScreen_ = createConsoleCommand(createFunctor(&GraphicsManager::printScreen, this), "printScreen");
    317323        CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
    318324    }
    319325
     326    void GraphicsManager::loadDebugOverlay()
     327    {
     328        // Load debug overlay to show info about fps and tick time
     329        COUT(4) << "Loading Debug Overlay..." << std::endl;
     330        debugOverlay_.reset(new XMLFile("debug.oxo"));
     331        Loader::open(debugOverlay_.get());
     332    }
     333
     334    /**
     335    @note
     336        A note about the Ogre::FrameListener: Even though we don't use them,
     337        they still get called. However, the delta times are not correct (except
     338        for timeSinceLastFrame, which is the most important). A little research
     339        as shown that there is probably only one FrameListener that doesn't even
     340        need the time. So we shouldn't run into problems.
     341    */
    320342    void GraphicsManager::update(const Clock& time)
    321343    {
     
    418440        assert(this->renderWindow_);
    419441       
    420         this->renderWindow_->writeContentsToTimestampedFile(Core::getLogPathString() + "screenShot_", ".jpg");
     442        this->renderWindow_->writeContentsToTimestampedFile(PathConfig::getLogPathString() + "screenShot_", ".jpg");
    421443    }
    422444}
Note: See TracChangeset for help on using the changeset viewer.