Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 28, 2009, 7:46:37 PM (16 years ago)
Author:
rgrieder
Message:

Merged buildsystem3 containing buildsystem2 containing Adi's buildsystem branch back to the trunk.
Please update the media directory if you were not using buildsystem3 before.

Location:
code/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/gamestates/CMakeLists.txt

    • Property svn:eol-style set to native
    r2131 r2710  
    1 SET( SRC_FILES
     1ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  GSDedicated.cc
    33  GSClient.cc
     
    1010  GSStandalone.cc
    1111)
    12 
    13 ADD_SOURCE_FILES(SRC_FILES)
  • code/trunk/src/orxonox/gamestates/GSGraphics.cc

    r2662 r2710  
    3131
    3232#include <fstream>
     33#include <boost/filesystem.hpp>
     34
    3335#include <OgreCompositorManager.h>
    3436#include <OgreConfigFile.h>
     
    4345#include <OgreWindowEventUtilities.h>
    4446
     47#include "SpecialConfig.h"
    4548#include "util/Debug.h"
    4649#include "util/Exception.h"
     50#include "util/String.h"
     51#include "util/SubString.h"
    4752#include "core/ConsoleCommand.h"
    4853#include "core/ConfigValueIncludes.h"
     
    5762#include "gui/GUIManager.h"
    5863#include "tools/WindowEventListener.h"
    59 #include "Settings.h"
    6064
    6165// for compatibility
     
    9296        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
    9397            .description("Location of the Ogre config file");
    94         SetConfigValue(ogrePluginsFile_, "plugins.cfg")
    95             .description("Location of the Ogre plugins file");
     98        SetConfigValue(ogrePluginsFolder_, ORXONOX_OGRE_PLUGINS_FOLDER)
     99            .description("Folder where the Ogre plugins are located.");
     100        SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)
     101            .description("Comma separated list of all plugins to load.");
    96102        SetConfigValue(ogreLogFile_,     "ogre.log")
    97103            .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
     
    102108        SetConfigValue(ogreLogLevelCritical_, 2)
    103109            .description("Corresponding orxonox debug level for ogre Critical");
    104         SetConfigValue(defaultMasterKeybindings_, "def_masterKeybindings.ini")
    105             .description("Filename of default master keybindings.");
    106110    }
    107111
     
    115119        // Ogre setup procedure
    116120        setupOgre();
     121        // load all the required plugins for Ogre
     122        loadOgrePlugins();
     123        // read resource declaration file
    117124        this->declareResources();
    118         this->loadRenderer();    // creates the render window
     125        // Reads ogre config and creates the render window
     126        this->loadRenderer();
     127
    119128        // TODO: Spread this so that this call only initialises things needed for the Console and GUI
    120129        this->initialiseResources();
     
    127136        // load debug overlay
    128137        COUT(3) << "Loading Debug Overlay..." << std::endl;
    129         this->debugOverlay_ = new XMLFile(Settings::getDataPath() + "overlay/debug.oxo");
     138        this->debugOverlay_ = new XMLFile((Core::getMediaPath() / "overlay" / "debug.oxo").file_string());
    130139        Loader::open(debugOverlay_);
    131140
     
    138147        // Configure master input state with a KeyBinder
    139148        masterKeyBinder_ = new KeyBinder();
    140         masterKeyBinder_->loadBindings("masterKeybindings.ini", defaultMasterKeybindings_);
     149        masterKeyBinder_->loadBindings("masterKeybindings.ini");
    141150        inputManager_->getMasterInputState()->addKeyHandler(masterKeyBinder_);
    142151
     
    200209        delete this->ogreRoot_;
    201210
    202 //#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
    203211        // delete the ogre log and the logManager (since we have created it).
    204212        this->ogreLogger_->getDefaultLog()->removeListener(this);
    205213        this->ogreLogger_->destroyLog(Ogre::LogManager::getSingleton().getDefaultLog());
    206214        delete this->ogreLogger_;
    207 //#endif
    208215
    209216        delete graphicsEngine_;
     
    276283        COUT(3) << "Setting up Ogre..." << std::endl;
    277284
    278         // TODO: LogManager doesn't work on oli platform. The why is yet unknown.
    279 //#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     285        if (ogreConfigFile_ == "")
     286        {
     287            COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl;
     288            ModifyConfigValue(ogreConfigFile_, tset, "config.cfg");
     289        }
     290        if (ogreLogFile_ == "")
     291        {
     292            COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl;
     293            ModifyConfigValue(ogreLogFile_, tset, "ogre.log");
     294        }
     295
     296        boost::filesystem::path ogreConfigFilepath(Core::getConfigPath() / this->ogreConfigFile_);
     297        boost::filesystem::path ogreLogFilepath(Core::getLogPath() / this->ogreLogFile_);
     298
    280299        // create a new logManager
     300        // Ogre::Root will detect that we've already created a Log
    281301        ogreLogger_ = new Ogre::LogManager();
    282302        COUT(4) << "Ogre LogManager created" << std::endl;
     
    284304        // create our own log that we can listen to
    285305        Ogre::Log *myLog;
    286         if (this->ogreLogFile_ == "")
    287             myLog = ogreLogger_->createLog("ogre.log", true, false, true);
    288         else
    289             myLog = ogreLogger_->createLog(this->ogreLogFile_, true, false, false);
     306        myLog = ogreLogger_->createLog(ogreLogFilepath.file_string(), true, false, false);
    290307        COUT(4) << "Ogre Log created" << std::endl;
    291308
    292309        myLog->setLogDetail(Ogre::LL_BOREME);
    293310        myLog->addListener(this);
    294 //#endif
    295 
    296         // Root will detect that we've already created a Log
     311
    297312        COUT(4) << "Creating Ogre Root..." << std::endl;
    298313
    299         if (ogrePluginsFile_ == "")
    300         {
    301             COUT(2) << "Warning: Ogre plugins file set to \"\". Defaulting to plugins.cfg" << std::endl;
    302             ModifyConfigValue(ogrePluginsFile_, tset, "plugins.cfg");
    303         }
    304         if (ogreConfigFile_ == "")
    305         {
    306             COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl;
    307             ModifyConfigValue(ogreConfigFile_, tset, "config.cfg");
    308         }
    309         if (ogreLogFile_ == "")
    310         {
    311             COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl;
    312             ModifyConfigValue(ogreLogFile_, tset, "ogre.log");
    313         }
    314 
    315314        // check for config file existence because Ogre displays (caught) exceptions if not
    316         std::ifstream probe;
    317         probe.open(ogreConfigFile_.c_str());
    318         if (!probe)
     315        if (!boost::filesystem::exists(ogreConfigFilepath))
    319316        {
    320317            // create a zero sized file
    321318            std::ofstream creator;
    322             creator.open(ogreConfigFile_.c_str());
     319            creator.open(ogreConfigFilepath.file_string().c_str());
    323320            creator.close();
    324321        }
    325         else
    326             probe.close();
    327 
    328         ogreRoot_ = new Ogre::Root(ogrePluginsFile_, ogreConfigFile_, ogreLogFile_);
    329 
    330 #if 0 // Ogre 1.4.3 doesn't yet support setDebugOutputEnabled(.)
    331 #if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
    332         // tame the ogre ouput so we don't get all the mess in the console
    333         Ogre::Log* defaultLog = Ogre::LogManager::getSingleton().getDefaultLog();
    334         defaultLog->setDebugOutputEnabled(false);
    335         defaultLog->setLogDetail(Ogre::LL_BOREME);
    336         defaultLog->addListener(this);
    337 #endif
    338 #endif
     322
     323        // Leave plugins file empty. We're going to do that part manually later
     324        ogreRoot_ = new Ogre::Root("", ogreConfigFilepath.file_string(), ogreLogFilepath.file_string());
    339325
    340326        COUT(3) << "Ogre set up done." << std::endl;
     327    }
     328
     329    void GSGraphics::loadOgrePlugins()
     330    {
     331        // just to make sure the next statement doesn't segfault
     332        if (ogrePluginsFolder_ == "")
     333            ogrePluginsFolder_ = ".";
     334
     335        boost::filesystem::path folder(ogrePluginsFolder_);
     336        // Do some SubString magic to get the comma separated list of plugins
     337        SubString plugins(ogrePlugins_, ",", " ", false, 92, false, 34, false, 40, 41, false, '\0');
     338        for (unsigned int i = 0; i < plugins.size(); ++i)
     339            ogreRoot_->loadPlugin((folder / plugins[i]).file_string());
    341340    }
    342341
     
    357356        try
    358357        {
    359             cf.load(Settings::getDataPath() + resourceFile_);
     358            cf.load((Core::getMediaPath() / resourceFile_).file_string());
    360359        }
    361360        catch (...)
     
    383382
    384383                    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
    385                         std::string(Settings::getDataPath() + archName), typeName, secName);
     384                        (Core::getMediaPath() / archName).directory_string(), typeName, secName);
    386385                }
    387386            }
  • code/trunk/src/orxonox/gamestates/GSGraphics.h

    r2662 r2710  
    6060
    6161        void setupOgre();
     62        void loadOgrePlugins();
    6263        void declareResources();
    6364        void loadRenderer();
     
    9899        std::string           resourceFile_;             //!< resources file name
    99100        std::string           ogreConfigFile_;           //!< ogre config file name
    100         std::string           ogrePluginsFile_;          //!< ogre plugins file name
     101        std::string           ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
     102        std::string           ogrePlugins_;              //!< Comma separated list of all plugins to load
    101103        std::string           ogreLogFile_;              //!< log file name for Ogre log messages
    102104        int                   ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
    103105        int                   ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
    104106        int                   ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
    105         std::string           defaultMasterKeybindings_; //!< Filename of default master keybindings.
    106107
    107108        // console commands
  • code/trunk/src/orxonox/gamestates/GSLevel.cc

    r2662 r2710  
    4646#include "LevelManager.h"
    4747#include "PlayerManager.h"
    48 #include "Settings.h"
    4948
    5049namespace orxonox
     
    7675    {
    7776        SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName=");
    78         SetConfigValue(defaultKeybindings_, "def_keybindings.ini")
    79             .description("Filename of default keybindings.");
    8077    }
    8178
     
    8683            inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game", 20);
    8784            keyBinder_ = new KeyBinder();
    88             keyBinder_->loadBindings("keybindings.ini", defaultKeybindings_);
     85            keyBinder_->loadBindings("keybindings.ini");
    8986            inputState_->setHandler(keyBinder_);
    9087
     
    205202        std::string levelName;
    206203        CommandLine::getValue("level", &levelName);
    207         startFile_ = new XMLFile(Settings::getDataPath() + std::string("levels/") + levelName);
     204        startFile_ = new XMLFile(Core::getMediaPathString() + "levels" + CP_SLASH + levelName);
    208205        Loader::open(startFile_);
    209206    }
  • code/trunk/src/orxonox/gamestates/GSLevel.h

    r2662 r2710  
    6666        //##### ConfigValues #####
    6767        std::string           keyDetectorCallbackCode_;
    68         //! Filename of default keybindings.
    69         std::string           defaultKeybindings_;
    7068
    7169        // console commands
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r2662 r2710  
    4444#include "tools/Timer.h"
    4545#include "objects/Tickable.h"
    46 #include "Settings.h"
    47 
    48 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     46
     47#ifdef ORXONOX_PLATFORM_WINDOWS
    4948#  ifndef WIN32_LEAN_AND_MEAN
    5049#    define WIN32_LEAN_AND_MEAN
     
    6362namespace orxonox
    6463{
    65     SetCommandLineArgument(dataPath, "").information("PATH");
    6664    SetCommandLineArgument(limitToCPU, 1).information("0: off | #cpu");
    6765
     
    7169        , bPaused_(false)
    7270        , timeFactorPauseBackup_(1.0f)
    73         , settings_(0)
    7471        , tclBind_(0)
    7572        , tclThreadManager_(0)
     
    113110        this->luaBind_ = new LuaBind();
    114111
    115         // instantiate Settings class
    116         this->settings_ = new Settings();
    117 
    118         std::string dataPath = CommandLine::getValue("dataPath");
    119         if (dataPath != "")
    120         {
    121             if (*dataPath.end() != '/' && *dataPath.end() != '\\')
    122                 Settings::tsetDataPath(dataPath + "/");
    123             else
    124                 Settings::tsetDataPath(dataPath);
    125         }
    126 
    127112        // initialise TCL
    128         this->tclBind_ = new TclBind(Settings::getDataPath());
     113        this->tclBind_ = new TclBind(Core::getMediaPathPOSIXString());
    129114        this->tclThreadManager_ = new TclThreadManager(tclBind_->getTclInterpreter());
    130115
     
    182167        delete this->tclBind_;
    183168
    184         delete this->settings_;
    185169        delete this->luaBind_;
    186170
     
    269253    void GSRoot::setThreadAffinity(unsigned int limitToCPU)
    270254    {
    271 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
     255#ifdef ORXONOX_PLATFORM_WINDOWS
    272256        // Get the current process core mask
    273257        DWORD procMask;
  • code/trunk/src/orxonox/gamestates/GSRoot.h

    r2662 r2710  
    8181        bool                  bPaused_;
    8282        float                 timeFactorPauseBackup_;
    83         Settings*             settings_;
    8483        TclBind*              tclBind_;
    8584        TclThreadManager*     tclThreadManager_;
Note: See TracChangeset for help on using the changeset viewer.