Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 30, 2009, 2:10:44 PM (15 years ago)
Author:
rgrieder
Message:

Merged resource branch back to the trunk. Changes:

  • Automated graphics loading by evaluating whether a GameState requires it
  • Using native Tcl library (x3n)

Windows users: Update your dependency package!

Location:
code/trunk
Files:
3 deleted
50 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r3280 r3370  
    2020SET_SOURCE_FILES(ORXONOX_SRC_FILES
    2121  CameraManager.cc
    22   GraphicsManager.cc
    2322  LevelManager.cc
    2423  Main.cc
     
    2726)
    2827ADD_SUBDIRECTORY(gamestates)
    29 ADD_SUBDIRECTORY(gui)
    3028ADD_SUBDIRECTORY(interfaces)
    3129ADD_SUBDIRECTORY(objects)
     
    4341  TOLUA_FILES
    4442    LevelManager.h
    45     gui/GUIManager.h
    4643    objects/pickup/BaseItem.h
    4744    objects/pickup/PickupInventory.h
     
    5350  ${ORXONOX_WIN32}
    5451  LINK_LIBRARIES
     52    ${Boost_FILESYSTEM_LIBRARY}
     53    ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
     54    ${Boost_THREAD_LIBRARY}
     55    ${Boost_DATE_TIME_LIBRARY} # Thread dependency
    5556    ${OGRE_LIBRARY}
    56     ${CEGUI_LIBRARY}
    57     ${LUA_LIBRARIES}
    58     ${CEGUILUA_LIBRARY}
    59     ${Boost_SYSTEM_LIBRARY}
    6057    ${OPENAL_LIBRARY}
    6158    ${ALUT_LIBRARY}
     
    6360    ${VORBIS_LIBRARY}
    6461    ${OGG_LIBRARY}
    65     ogreceguirenderer_orxonox
    6662    tinyxml++_orxonox
    6763    tolua++_orxonox
  • code/trunk/src/orxonox/CameraManager.cc

    r3280 r3370  
    3434#include "util/StringUtils.h"
    3535#include "core/GameMode.h"
     36#include "core/GUIManager.h"
    3637#include "core/ObjectList.h"
    3738#include "tools/Shader.h"
    3839#include "objects/worldentities/Camera.h"
    3940#include "objects/Scene.h"
    40 #include "gui/GUIManager.h"
    4141
    4242namespace orxonox
    4343{
    44     CameraManager* CameraManager::singletonRef_s = 0;
     44    CameraManager* CameraManager::singletonPtr_s = 0;
    4545
    4646    CameraManager::CameraManager(Ogre::Viewport* viewport)
    4747        : viewport_(viewport)
    4848    {
    49         assert(singletonRef_s == 0);
    50         singletonRef_s = this;
    51 
    5249        this->fallbackCamera_ = 0;
    5350    }
     
    5552    CameraManager::~CameraManager()
    5653    {
    57         assert(singletonRef_s != 0);
    58         singletonRef_s = 0;
    59 
    6054        if (this->fallbackCamera_)
    6155            this->fallbackCamera_->getSceneManager()->destroyCamera(this->fallbackCamera_);
  • code/trunk/src/orxonox/CameraManager.h

    r3196 r3370  
    4141#include <list>
    4242#include "util/OgreForwardRefs.h"
     43#include "util/Singleton.h"
    4344
    4445namespace orxonox
    4546{
    46     class _OrxonoxExport CameraManager
     47    class _OrxonoxExport CameraManager : public Singleton<CameraManager>
    4748    {
     49            friend class Singleton<CameraManager>;
    4850        public:
    4951            CameraManager(Ogre::Viewport* viewport);
     
    5759            void useCamera(Ogre::Camera* camera);
    5860
    59             static CameraManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
    60             static CameraManager* getInstancePtr() { return singletonRef_s; }
     61            static CameraManager* getInstancePtr() { return singletonPtr_s; }
    6162
    6263        private:
     
    6768            Ogre::Camera*         fallbackCamera_;
    6869
    69             static CameraManager* singletonRef_s;
     70            static CameraManager* singletonPtr_s;
    7071    };
    7172}
  • code/trunk/src/orxonox/LevelManager.cc

    r3280 r3370  
    3030
    3131#include <map>
     32#include <boost/filesystem.hpp>
    3233
    3334#include "core/CommandLine.h"
    3435#include "core/ConfigValueIncludes.h"
     36#include "core/Core.h"
    3537#include "core/CoreIncludes.h"
     38#include "core/Loader.h"
    3639#include "PlayerManager.h"
    3740#include "objects/Level.h"
     
    4245    SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
    4346
    44     LevelManager* LevelManager::singletonRef_s = 0;
     47    LevelManager* LevelManager::singletonPtr_s = 0;
    4548
    4649    LevelManager::LevelManager()
    4750    {
    48         assert(singletonRef_s == 0);
    49         singletonRef_s = this;
    50 
    5151        RegisterRootObject(LevelManager);
    5252        this->setConfigValues();
     
    6161    LevelManager::~LevelManager()
    6262    {
    63         assert(singletonRef_s != 0);
    64         singletonRef_s = 0;
    6563    }
    6664
     
    120118    }
    121119
    122     const std::string& LevelManager::getDefaultLevel()
     120    const std::string& LevelManager::getDefaultLevel() const
    123121    {
    124122        return defaultLevelName_;
    125123    }
     124
     125    std::string LevelManager::getAvailableLevelListItem(unsigned int index) const
     126    {
     127        if (index >= availableLevels_.size())
     128            return std::string();
     129        else
     130            return availableLevels_[index];
     131    }
     132
     133    void LevelManager::compileAvailableLevelList()
     134    {
     135        availableLevels_.clear();
     136
     137        boost::filesystem::directory_iterator file(Core::getMediaPathString() + "levels");
     138        boost::filesystem::directory_iterator end;
     139
     140        while (file != end)
     141        {
     142            if (!boost::filesystem::is_directory(*file) && file->string()[file->string().length()-1] != '~')
     143            {
     144                std::string filename = file->path().leaf();
     145                if (filename.length() > 4)
     146                    availableLevels_.push_back(filename.substr(0,filename.length()-4));
     147            }
     148            ++file;
     149        }
     150    }
    126151}
  • code/trunk/src/orxonox/LevelManager.h

    r3304 r3370  
    3535#include <list>
    3636#include <string>
     37
     38#include "util/Singleton.h"
    3739#include "core/OrxonoxClass.h"
    3840
     
    4244    class _OrxonoxExport LevelManager
    4345    // tolua_end
    44         : public OrxonoxClass
     46        : public Singleton<LevelManager>, public OrxonoxClass
    4547    { // tolua_export
     48            friend class Singleton<LevelManager>;
    4649        public:
    4750            LevelManager();
     
    5558
    5659            void setDefaultLevel(const std::string& levelName); //tolua_export
    57             const std::string& getDefaultLevel(); //tolua_export
     60            const std::string& getDefaultLevel() const; //tolua_export
     61            void compileAvailableLevelList(); //tolua_export
     62            std::string getAvailableLevelListItem(unsigned int index) const; //tolua_export
    5863
    59             static LevelManager* getInstancePtr() { return singletonRef_s; }
    60             static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
     64            static LevelManager* getInstancePtr() { return singletonPtr_s; }
     65            static LevelManager& getInstance()    { return Singleton<LevelManager>::getInstance(); } // tolua_export
    6166
    6267        private:
     
    6671
    6772            std::list<Level*> levels_s;
     73            std::vector<std::string> availableLevels_;
    6874
    6975            // config values
    7076            std::string defaultLevelName_;
    7177
    72             static LevelManager* singletonRef_s;
     78            static LevelManager* singletonPtr_s;
    7379    }; // tolua_export
    7480} // tolua_export
  • code/trunk/src/orxonox/Main.cc

    r3323 r3370  
    4646#include "util/Debug.h"
    4747#include "util/Exception.h"
     48#include "core/CommandLine.h"
    4849#include "core/Game.h"
     50
     51SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
     52// Shortcuts for easy direct loading
     53SetCommandLineSwitch(server).information("Start in server mode");
     54SetCommandLineSwitch(client).information("Start in client mode");
     55SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
     56SetCommandLineSwitch(standalone).information("Start in standalone mode");
    4957
    5058/*
     
    8694
    8795        game->requestState("root");
     96
     97        // Some development hacks (not really, but in the future, this calls won't make sense anymore)
     98        if (CommandLine::getValue("standalone").getBool())
     99            Game::getInstance().requestStates("graphics, standalone, level");
     100        else if (CommandLine::getValue("server").getBool())
     101            Game::getInstance().requestStates("graphics, server, level");
     102        else if (CommandLine::getValue("client").getBool())
     103            Game::getInstance().requestStates("graphics, client, level");
     104        else if (CommandLine::getValue("dedicated").getBool())
     105            Game::getInstance().requestStates("dedicated, level");
     106        else if (CommandLine::getValue("console").getBool())
     107            Game::getInstance().requestStates("ioConsole");
     108        else
     109            Game::getInstance().requestStates("graphics, mainMenu");
    88110    }
    89111    catch (const std::exception& ex)
  • code/trunk/src/orxonox/OrxonoxPrecompiledHeaders.h

    r3322 r3370  
    9090//#include "core/ConfigValueIncludes.h" // 19
    9191//#include "core/ConsoleCommand.h" // 15
    92 #include "core/Core.h"
     92//#include "core/Core.h" // ?, but not many times
    9393#include "core/CoreIncludes.h"
    94 #include "core/GameMode.h"
    9594#include "core/XMLPort.h"
    9695
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r3327 r3370  
    7373        };
    7474    }
    75 
    76     class GraphicsManager;
    77     class OgreWindowEventListener;
    78     class Settings;
    7975
    8076    class RadarViewable;
     
    277273    class Map;
    278274
    279     //gui
    280     class GUIManager;
    281 
    282275    //sound
    283276    class SoundBase;
     
    293286}
    294287
    295 namespace CEGUI
    296 {
    297     class DefaultLogger;
    298     class Logger;
    299     class LuaScriptModule;
    300 
    301     class OgreCEGUIRenderer;
    302     class OgreCEGUIResourceProvider;
    303     class OgreCEGUITexture;
    304 }
    305 
    306288// Bullet Physics Engine
    307289class btTransform;
     
    330312typedef int ALint;
    331313
    332 // Lua
    333 struct lua_State;
    334 
    335314#endif /* _OrxonoxPrereqs_H__ */
  • code/trunk/src/orxonox/PawnManager.cc

    r3196 r3370  
    3434namespace orxonox
    3535{
    36     PawnManager* PawnManager::singletonRef_s = 0;
     36    PawnManager* PawnManager::singletonPtr_s = 0;
    3737
    3838    PawnManager::PawnManager()
    3939    {
    4040        RegisterRootObject(PawnManager);
    41 
    42         assert(PawnManager::singletonRef_s == 0);
    43         PawnManager::singletonRef_s = this;
    4441    }
    4542
    4643    PawnManager::~PawnManager()
    4744    {
    48         assert(PawnManager::singletonRef_s != 0);
    49         PawnManager::singletonRef_s = 0;
    5045    }
    5146
    5247    void PawnManager::touch()
    5348    {
    54         if (!PawnManager::singletonRef_s)
     49        if (!PawnManager::singletonPtr_s)
    5550            new PawnManager();
    5651    }
  • code/trunk/src/orxonox/PawnManager.h

    r3196 r3370  
    3131
    3232#include "OrxonoxPrereqs.h"
     33
     34#include "util/Singleton.h"
    3335#include "interfaces/Tickable.h"
    3436
    3537namespace orxonox
    3638{
    37     class _OrxonoxExport PawnManager : public Tickable
     39    class _OrxonoxExport PawnManager : protected Singleton<PawnManager>, public Tickable
    3840    {
     41            friend class Singleton<PawnManager>;
    3942        public:
    4043            static void touch();
     
    4649            virtual ~PawnManager();
    4750
    48             static PawnManager* singletonRef_s;
     51            static PawnManager* singletonPtr_s;
    4952    };
    5053}
  • code/trunk/src/orxonox/PlayerManager.cc

    r3297 r3370  
    3737namespace orxonox
    3838{
    39     PlayerManager* PlayerManager::singletonRef_s = 0;
     39    PlayerManager* PlayerManager::singletonPtr_s = 0;
    4040
    4141    PlayerManager::PlayerManager()
    4242    {
    4343        RegisterRootObject(PlayerManager);
    44 
    45         assert(singletonRef_s == 0);
    46         singletonRef_s = this;
    4744
    4845        this->getConnectedClients();
     
    5148    PlayerManager::~PlayerManager()
    5249    {
    53         assert(singletonRef_s);
    54         singletonRef_s = 0;
    5550    }
    5651
  • code/trunk/src/orxonox/PlayerManager.h

    r3196 r3370  
    3434#include <cassert>
    3535#include <map>
     36#include "util/Singleton.h"
    3637#include "network/ClientConnectionListener.h"
    3738
    3839namespace orxonox
    3940{
    40     class _OrxonoxExport PlayerManager : public ClientConnectionListener
     41    class _OrxonoxExport PlayerManager : public Singleton<PlayerManager>, public ClientConnectionListener
    4142    {
     43            friend class Singleton<PlayerManager>;
    4244        public:
    4345            PlayerManager();
    4446            virtual ~PlayerManager();
    45 
    46             inline static PlayerManager& getInstance()
    47                 { assert(singletonRef_s); return *singletonRef_s; }
    4847
    4948            PlayerInfo* getClient(unsigned int clientID) const;
     
    5756            std::map<unsigned int, PlayerInfo*> clients_;
    5857
    59             static PlayerManager* singletonRef_s;
     58            static PlayerManager* singletonPtr_s;
    6059    };
    6160}
  • code/trunk/src/orxonox/gamestates/GSClient.cc

    r3280 r3370  
    4242    SetCommandLineArgument(ip, "127.0.0.1").information("Sever IP as strin in the form #.#.#.#");
    4343
    44     GSClient::GSClient(const GameStateConstrParams& params)
    45         : GameState(params)
     44    GSClient::GSClient(const GameStateInfo& info)
     45        : GameState(info)
    4646        , client_(0)
    4747    {
  • code/trunk/src/orxonox/gamestates/GSClient.h

    r3280 r3370  
    4040    {
    4141    public:
    42         GSClient(const GameStateConstrParams& params);
     42        GSClient(const GameStateInfo& info);
    4343        ~GSClient();
    4444
  • code/trunk/src/orxonox/gamestates/GSDedicated.cc

    r3351 r3370  
    5555    termios* GSDedicated::originalTerminalSettings_;
    5656
    57     GSDedicated::GSDedicated(const GameStateConstrParams& params)
    58         : GameState(params)
     57    GSDedicated::GSDedicated(const GameStateInfo& info)
     58        : GameState(info)
    5959        , server_(0)
    6060        , closeThread_(false)
  • code/trunk/src/orxonox/gamestates/GSDedicated.h

    r3304 r3370  
    4848    {
    4949    public:
    50         GSDedicated(const GameStateConstrParams& params);
     50        GSDedicated(const GameStateInfo& info);
    5151        ~GSDedicated();
    5252
  • code/trunk/src/orxonox/gamestates/GSGraphics.cc

    r3327 r3370  
    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"
     43#include "core/GUIManager.h"
    4744#include "core/input/InputManager.h"
    4845#include "core/input/KeyBinder.h"
     
    5148#include "core/XMLFile.h"
    5249#include "overlays/console/InGameConsole.h"
    53 #include "gui/GUIManager.h"
    5450#include "sound/SoundManager.h"
    55 #include "GraphicsManager.h"
     51
     52// HACK:
     53#include "overlays/map/Map.h"
    5654
    5755namespace orxonox
    5856{
    59     DeclareGameState(GSGraphics, "graphics", true, true);
     57    DeclareGameState(GSGraphics, "graphics", false, true);
    6058
    61     GSGraphics::GSGraphics(const GameStateConstrParams& params)
    62         : GameState(params)
    63         , inputManager_(0)
     59    GSGraphics::GSGraphics(const GameStateInfo& info)
     60        : GameState(info)
    6461        , console_(0)
    65         , guiManager_(0)
    66         , graphicsManager_(0)
    6762        , soundManager_(0)
    6863        , masterKeyBinder_(0)
     
    7065        , debugOverlay_(0)
    7166    {
     67        // load master key bindings
     68        masterInputState_ = InputManager::getInstance().createInputState("master", true);
     69        masterKeyBinder_ = new KeyBinder();
     70        masterInputState_->setKeyHandler(masterKeyBinder_);
    7271    }
    7372
    7473    GSGraphics::~GSGraphics()
    7574    {
     75        InputManager::getInstance().destroyState("master");
     76        delete this->masterKeyBinder_;
    7677    }
    7778
     
    9394    void GSGraphics::activate()
    9495    {
    95         GameMode::setShowsGraphics(true);
    96 
    97         // Load OGRE including the render window
    98         this->graphicsManager_ = new GraphicsManager();
    99 
    10096        // load debug overlay
    10197        COUT(3) << "Loading Debug Overlay..." << std::endl;
    102         this->debugOverlay_ = new XMLFile((Core::getMediaPath() / "overlay" / "debug.oxo").string());
     98        this->debugOverlay_ = new XMLFile(Core::getMediaPathString() + "overlay/debug.oxo");
    10399        Loader::open(debugOverlay_);
    104100
    105         // The render window width and height are used to set up the mouse movement.
    106         size_t windowHnd = 0;
    107         Ogre::RenderWindow* renderWindow = GraphicsManager::getInstance().getRenderWindow();
    108         renderWindow->getCustomAttribute("WINDOW", &windowHnd);
    109 
    110         // Calls the InputManager which sets up the input devices.
    111         inputManager_ = new InputManager(windowHnd);
    112 
    113         // load master key bindings
    114         masterInputState_ = InputManager::getInstance().createInputState("master", true);
    115         masterKeyBinder_ = new KeyBinder();
    116101        masterKeyBinder_->loadBindings("masterKeybindings.ini");
    117         masterInputState_->setKeyHandler(masterKeyBinder_);
    118102
    119103        // Load the SoundManager
     
    123107        console_ = new InGameConsole();
    124108        console_->initialise();
    125 
    126         // load the CEGUI interface
    127         guiManager_ = new GUIManager();
    128         guiManager_->initialise(renderWindow);
    129109
    130110        // add console command to toggle GUI
     
    154134*/
    155135
    156         masterInputState_->setHandler(0);
    157         InputManager::getInstance().destroyState("master");
    158         delete this->masterKeyBinder_;
    159 
    160         delete this->guiManager_;
    161136        delete this->console_;
    162137
     
    166141        delete this->soundManager_;
    167142
    168         delete this->inputManager_;
    169         this->inputManager_ = 0;
    170 
    171         delete graphicsManager_;
    172 
    173         GameMode::setShowsGraphics(false);
     143        // HACK: (destroys a resource smart pointer)
     144        Map::hackDestroyMap();
    174145    }
    175146
     
    203174        }
    204175
    205         uint64_t timeBeforeTick = time.getRealMicroseconds();
    206 
    207         this->inputManager_->update(time);
    208176        this->console_->update(time);
    209 
    210         uint64_t timeAfterTick = time.getRealMicroseconds();
    211 
    212         // Also add our tick time
    213         Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
    214 
    215         // Process gui events
    216         this->guiManager_->update(time);
    217         // Render
    218         this->graphicsManager_->update(time);
    219177    }
    220178}
  • code/trunk/src/orxonox/gamestates/GSGraphics.h

    r3327 r3370  
    5050    {
    5151    public:
    52         GSGraphics(const GameStateConstrParams& params);
     52        GSGraphics(const GameStateInfo& info);
    5353        ~GSGraphics();
    5454
     
    6161    private:
    6262        // managed singletons
    63         InputManager*         inputManager_;        //!< Reference to input management
    6463        InGameConsole*        console_;
    65         GUIManager*           guiManager_;          //!< Interface to GUI
    66         GraphicsManager*      graphicsManager_;     //!< Interface to Ogre
    6764        SoundManager*         soundManager_;        //!< Keeps track of SoundBase objects
    6865
  • code/trunk/src/orxonox/gamestates/GSIOConsole.cc

    r3280 r3370  
    3838    DeclareGameState(GSIOConsole, "ioConsole", false, false);
    3939
    40     GSIOConsole::GSIOConsole(const GameStateConstrParams& params)
    41         : GameState(params)
     40    GSIOConsole::GSIOConsole(const GameStateInfo& info)
     41        : GameState(info)
    4242    {
    4343    }
  • code/trunk/src/orxonox/gamestates/GSIOConsole.h

    r3280 r3370  
    3838    {
    3939    public:
    40         GSIOConsole(const GameStateConstrParams& params);
     40        GSIOConsole(const GameStateInfo& info);
    4141        ~GSIOConsole();
    4242
  • code/trunk/src/orxonox/gamestates/GSLevel.cc

    r3327 r3370  
    4040#include "core/GameMode.h"
    4141#include "core/Core.h"
     42#include "core/GraphicsManager.h"
     43#include "core/GUIManager.h"
    4244#include "core/Loader.h"
    4345#include "core/XMLFile.h"
     
    4749#include "objects/quest/QuestManager.h"
    4850#include "overlays/notifications/NotificationManager.h"
    49 #include "gui/GUIManager.h"
    5051#include "CameraManager.h"
    51 #include "GraphicsManager.h"
    5252#include "LevelManager.h"
    5353#include "PlayerManager.h"
     
    5555namespace orxonox
    5656{
    57     DeclareGameState(GSLevel, "level", false, true);
     57    DeclareGameState(GSLevel, "level", false, false);
    5858    SetConsoleCommand(GSLevel, showIngameGUI, true);
    5959
    6060    XMLFile* GSLevel::startFile_s = NULL;
    6161
    62     GSLevel::GSLevel(const GameStateConstrParams& params)
    63         : GameState(params)
     62    GSLevel::GSLevel(const GameStateInfo& info)
     63        : GameState(info)
    6464        , keyBinder_(0)
    6565        , gameInputState_(0)
  • code/trunk/src/orxonox/gamestates/GSLevel.h

    r3327 r3370  
    4141    {
    4242    public:
    43         GSLevel(const GameStateConstrParams& params);
     43        GSLevel(const GameStateInfo& info);
    4444        ~GSLevel();
    4545        void setConfigValues();
  • code/trunk/src/orxonox/gamestates/GSMainMenu.cc

    r3327 r3370  
    3636#include "core/Clock.h"
    3737#include "core/ConsoleCommand.h"
     38#include "core/GraphicsManager.h"
     39#include "core/GUIManager.h"
    3840#include "objects/Scene.h"
    39 #include "gui/GUIManager.h"
    4041#include "sound/SoundMainMenu.h"
    41 #include "GraphicsManager.h"
    4242
    4343namespace orxonox
     
    4545    DeclareGameState(GSMainMenu, "mainMenu", false, true);
    4646
    47     GSMainMenu::GSMainMenu(const GameStateConstrParams& params)
    48         : GameState(params)
     47    GSMainMenu::GSMainMenu(const GameStateInfo& info)
     48        : GameState(info)
    4949        , inputState_(0)
    50     {
    51     }
    52 
    53     GSMainMenu::~GSMainMenu()
    54     {
    55     }
    56 
    57     void GSMainMenu::activate()
    5850    {
    5951        inputState_ = InputManager::getInstance().createInputState("mainMenu");
     
    6557        // and a Camera
    6658        this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera");
     59    }
    6760
     61    GSMainMenu::~GSMainMenu()
     62    {
     63        InputManager::getInstance().destroyState("mainMenu");
     64
     65        this->scene_->getSceneManager()->destroyCamera(this->camera_);
     66        delete this->scene_;
     67    }
     68
     69    void GSMainMenu::activate()
     70    {
    6871        // show main menu
    69         GUIManager::getInstance().showGUI("mainmenu_3");
     72        GUIManager::getInstance().showGUI("mainmenu_4");
    7073        GUIManager::getInstance().setCamera(this->camera_);
    7174        GraphicsManager::getInstance().setCamera(this->camera_);
     
    107110
    108111        InputManager::getInstance().leaveState("mainMenu");
    109         InputManager::getInstance().destroyState("mainMenu");
    110112
    111113        GUIManager::getInstance().setCamera(0);
    112114        GraphicsManager::getInstance().setCamera(0);
    113         this->scene_->getSceneManager()->destroyCamera(this->camera_);
    114         delete this->scene_;
    115115
    116116/*
  • code/trunk/src/orxonox/gamestates/GSMainMenu.h

    r3327 r3370  
    4040    {
    4141    public:
    42         GSMainMenu(const GameStateConstrParams& params);
     42        GSMainMenu(const GameStateInfo& info);
    4343        ~GSMainMenu();
    4444
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r3304 r3370  
    3030
    3131#include "core/Clock.h"
    32 #include "core/CommandLine.h"
    3332#include "core/ConsoleCommand.h"
    3433#include "core/Game.h"
    3534#include "core/GameMode.h"
     35#include "core/LuaBind.h"
    3636#include "network/NetworkFunction.h"
     37#include "ToluaBindCore.h"
     38#include "ToluaBindOrxonox.h"
    3739#include "tools/Timer.h"
    3840#include "interfaces/TimeFactorListener.h"
     
    4244namespace orxonox
    4345{
    44     DeclareGameState(GSRoot, "root", true, false);
    45     SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
    46     // Shortcuts for easy direct loading
    47     SetCommandLineSwitch(server).information("Start in server mode");
    48     SetCommandLineSwitch(client).information("Start in client mode");
    49     SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
    50     SetCommandLineSwitch(standalone).information("Start in standalone mode");
     46    DeclareGameState(GSRoot, "root", false, false);
    5147
    52     GSRoot::GSRoot(const GameStateConstrParams& params)
    53         : GameState(params)
     48    GSRoot::GSRoot(const GameStateInfo& info)
     49        : GameState(info)
    5450        , timeFactor_(1.0f)
    5551        , bPaused_(false)
     
    5854        this->ccSetTimeFactor_ = 0;
    5955        this->ccPause_ = 0;
     56
     57        // Tell LuaBind about all tolua interfaces
     58        LuaBind::getInstance().addToluaInterface(&tolua_Core_open, "Core");
     59        LuaBind::getInstance().addToluaInterface(&tolua_Orxonox_open, "Orxonox");
    6060    }
    6161
     
    8888        // create the global LevelManager
    8989        this->levelManager_ = new LevelManager();
    90 
    91         // Load level directly?
    92         bool loadLevel = false;
    93         if (CommandLine::getValue("standalone").getBool())
    94         {
    95             Game::getInstance().requestStates("graphics, standalone, level");
    96             loadLevel = true;
    97         }
    98         if (CommandLine::getValue("server").getBool())
    99         {
    100             Game::getInstance().requestStates("graphics, server, level");
    101             loadLevel = true;
    102         }
    103         if (CommandLine::getValue("client").getBool())
    104         {
    105             Game::getInstance().requestStates("graphics, client, level");
    106             loadLevel = true;
    107         }
    108         if (CommandLine::getValue("dedicated").getBool())
    109         {
    110             Game::getInstance().requestStates("dedicated, level");
    111             loadLevel = true;
    112         }
    113        
    114         // Determine where to start otherwise
    115         if (!loadLevel && !CommandLine::getValue("console").getBool())
    116         {
    117             // Also load graphics
    118             Game::getInstance().requestState("graphics");
    119         }
    12090    }
    12191
     
    148118        }
    149119
    150         uint64_t timeBeforeTick = time.getRealMicroseconds();
    151 
    152120        for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it)
    153121            it->tick(time);
     
    164132            it->tick(leveldt * this->timeFactor_);
    165133        /*** HACK *** HACK ***/
    166 
    167         uint64_t timeAfterTick = time.getRealMicroseconds();
    168 
    169         // Also add our tick time
    170         Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);
    171134    }
    172135
     
    174137    @brief
    175138        Changes the speed of Orxonox
     139    @remark
     140        This function is a hack when placed here!
     141        Timefactor should be related to the scene (level or so), not the game
    176142    */
    177143    void GSRoot::setTimeFactor(float factor)
  • code/trunk/src/orxonox/gamestates/GSRoot.h

    r3280 r3370  
    3838    {
    3939    public:
    40         GSRoot(const GameStateConstrParams& params);
     40        GSRoot(const GameStateInfo& info);
    4141        ~GSRoot();
    4242
  • code/trunk/src/orxonox/gamestates/GSServer.cc

    r3280 r3370  
    4141    SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)");
    4242
    43     GSServer::GSServer(const GameStateConstrParams& params)
    44         : GameState(params)
     43    GSServer::GSServer(const GameStateInfo& info)
     44        : GameState(info)
    4545        , server_(0)
    4646    {
  • code/trunk/src/orxonox/gamestates/GSServer.h

    r3280 r3370  
    4040    {
    4141    public:
    42         GSServer(const GameStateConstrParams& params);
     42        GSServer(const GameStateInfo& info);
    4343        ~GSServer();
    4444
  • code/trunk/src/orxonox/gamestates/GSStandalone.cc

    r3280 r3370  
    3636    DeclareGameState(GSStandalone, "standalone", false, true);
    3737
    38     GSStandalone::GSStandalone(const GameStateConstrParams& params)
    39         : GameState(params)
     38    GSStandalone::GSStandalone(const GameStateInfo& info)
     39        : GameState(info)
    4040    {
    4141    }
  • code/trunk/src/orxonox/gamestates/GSStandalone.h

    r3280 r3370  
    3838    {
    3939    public:
    40         GSStandalone(const GameStateConstrParams& params);
     40        GSStandalone(const GameStateInfo& info);
    4141        ~GSStandalone();
    4242
  • code/trunk/src/orxonox/objects/pickup/BaseItem.h

    r3196 r3370  
    5151            Daniel 'Huty' Haggenmueller
    5252    */
    53     class _OrxonoxExport BaseItem
    54 // tolua_end
    55         : public BaseObject
    56 // tolua_begin
     53    class _OrxonoxExport BaseItem : public BaseObject
    5754    {
    5855// tolua_end
  • code/trunk/src/orxonox/objects/pickup/PickupInventory.cc

    r3327 r3370  
    3737
    3838#include "core/ConsoleCommand.h"
     39#include "core/GUIManager.h"
    3940#include "core/input/InputManager.h"
    40 #include "gui/GUIManager.h"
    4141#include "objects/controllers/HumanController.h"
    4242#include "objects/worldentities/pawns/Pawn.h"
  • code/trunk/src/orxonox/objects/pickup/PickupInventory.h

    r3196 r3370  
    4343namespace orxonox
    4444{
    45 // tolua_end
    4645    /**
    4746        @brief Static class for the inventory GUI window.
    4847        @author Daniel 'Huty' Haggenmueller
    4948    */
    50 // tolua_begin
    5149    class _OrxonoxExport PickupInventory
    5250    {
  • code/trunk/src/orxonox/objects/pickup/PickupSpawner.cc

    r3325 r3370  
    3737
    3838#include "core/CoreIncludes.h"
     39#include "core/GUIManager.h"     // HACK; see below
    3940#include "core/Template.h"
    4041#include "core/XMLPort.h"
    41 #include "gui/GUIManager.h"     // HACK; see below
    4242#include "objects/worldentities/pawns/Pawn.h"
    4343#include "PickupInventory.h"    // HACK; Only for hack, remove later
  • code/trunk/src/orxonox/objects/quest/QuestDescription.h

    r3196 r3370  
    5454        Damian 'Mozork' Frick
    5555    */
    56     class _OrxonoxExport QuestDescription
     56    class _OrxonoxExport QuestDescription : public BaseObject
     57    {
    5758// tolua_end
    58         : public BaseObject
    59     { // tolua_export
    6059        public:
    6160            QuestDescription(BaseObject* creator);
  • code/trunk/src/orxonox/objects/quest/QuestListener.cc

    r3280 r3370  
    8181    /**
    8282    @brief
    83         Makes all QuestListener in the list aware that a certain status change has occured and executes them if the status change affects them.
     83        Makes all QuestListener in the list aware that a certain status change has occurred and executes them if the status change affects them.
    8484    @param listeners
    8585        The list of QuestListeners that have to be made aware of the status change.
     
    182182        else
    183183        {
    184             COUT(1) << "An unforseen, never to happen, Error has occured. This is impossible!" << std::endl;
     184            COUT(1) << "An unforseen, never to happen, Error has occurred. This is impossible!" << std::endl;
    185185        return "";
    186186        }
  • code/trunk/src/orxonox/objects/quest/QuestManager.cc

    r3325 r3370  
    3636#include "util/Exception.h"
    3737#include "core/CoreIncludes.h"
    38 #include "gui/GUIManager.h"
    3938
    4039#include "objects/infos/PlayerInfo.h"
     
    4847{
    4948    //! Pointer to the current (and single) instance of this class.
    50     /*static*/ QuestManager* QuestManager::singletonRef_s = NULL;
     49    /*static*/ QuestManager* QuestManager::singletonPtr_s = NULL;
    5150
    5251    /**
     
    5958    {
    6059        RegisterRootObject(QuestManager);
    61 
    62         assert(singletonRef_s == 0);
    63         singletonRef_s = this;
    6460    }
    6561
     
    7167    {
    7268
    73     }
    74 
    75     /**
    76     @brief
    77         Returns a reference to the current (and single) instance of the QuestManager, and creates one if there isn't one to begin with.
    78     @return
    79         Returns a reference to the single instance of the Quest Manager.
    80     */
    81     /*static*/ QuestManager & QuestManager::getInstance()
    82     {
    83         assert(singletonRef_s);
    84         return *singletonRef_s;
    8569    }
    8670
     
    225209    QuestContainer* QuestManager::getQuestTree(std::string & name)
    226210    {
    227         GUIOverlay* gui = GUIManager::getInstance().getOverlay(name);
     211        GUIOverlay* gui = NULL;
     212        for (ObjectList<GUIOverlay>::iterator it = ObjectList<GUIOverlay>::begin(); it != ObjectList<GUIOverlay>::end(); ++it)
     213            if (it->getGUIName() == name)
     214                gui = *it;
    228215
    229216        PlayerInfo* player;
     
    321308        {
    322309            container->status = "";
    323             COUT(1) << "An error occured. A Quest of un-specified status wanted to be displayed." << std::endl;
     310            COUT(1) << "An error occurred. A Quest of un-specified status wanted to be displayed." << std::endl;
    324311        }
    325312       
  • code/trunk/src/orxonox/objects/quest/QuestManager.h

    r3196 r3370  
    4040#include <map>
    4141#include <string>
     42
     43#include "util/Singleton.h"
    4244#include "core/OrxonoxClass.h"
    4345
     
    7173        Damian 'Mozork' Frick
    7274    */
    73     class _OrxonoxExport QuestManager
    74 // tolua_end
    75         : public OrxonoxClass
    76 // tolua_begin
     75    class _OrxonoxExport QuestManager : public Singleton<QuestManager>, public orxonox::OrxonoxClass
    7776    {
    7877// tolua_end
     78            friend class Singleton<QuestManager>;
    7979        public:
    8080            QuestManager();
    8181            virtual ~QuestManager();
    8282
    83             static QuestManager& getInstance(); // tolua_export //!< Returns a reference to the single instance of the Quest Manager.
     83            //! Returns a reference to the single instance of the Quest Manager.
     84            static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export
    8485
    8586            bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
     
    9293
    9394        private:
    94             static QuestManager* singletonRef_s;
     95            static QuestManager* singletonPtr_s;
    9596
    9697            std::map<std::string, Quest*> questMap_; //!< All Quests registered by their id's.
  • code/trunk/src/orxonox/overlays/GUIOverlay.cc

    r3327 r3370  
    3434#include "core/input/InputManager.h"
    3535#include "core/CoreIncludes.h"
     36#include "core/GUIManager.h"
    3637#include "core/XMLPort.h"
    37 #include "gui/GUIManager.h"
    3838
    3939namespace orxonox
     
    5555
    5656        XMLPortParam(GUIOverlay, "guiname", setGUIName, getGUIName, xmlElement, mode);
    57        
    58         GUIManager::getInstance().registerOverlay(this->guiName_, this);
    5957    }
    6058
  • code/trunk/src/orxonox/overlays/console/InGameConsole.cc

    r3327 r3370  
    6060    SetConsoleCommand(InGameConsole, closeConsole, true);
    6161
    62     InGameConsole* InGameConsole::singletonRef_s = 0;
     62    InGameConsole* InGameConsole::singletonPtr_s = 0;
    6363
    6464    /**
     
    7676        RegisterObject(InGameConsole);
    7777
    78         assert(singletonRef_s == 0);
    79         singletonRef_s = this;
    80 
    8178        this->bActive_ = false;
    8279        this->cursor_ = 0.0f;
     
    131128        if (this->consoleOverlay_)
    132129            Ogre::OverlayManager::getSingleton().destroy(consoleOverlay_);
    133 
    134         singletonRef_s = 0;
    135130    }
    136131
  • code/trunk/src/orxonox/overlays/console/InGameConsole.h

    r3327 r3370  
    3434
    3535#include <string>
     36
    3637#include "util/OgreForwardRefs.h"
     38#include "util/Singleton.h"
    3739#include "core/Shell.h"
    3840#include "core/WindowEventListener.h"
     
    4042namespace orxonox
    4143{
    42     class _OrxonoxExport InGameConsole : public ShellListener, public WindowEventListener
     44    class _OrxonoxExport InGameConsole : public Singleton<InGameConsole>, public ShellListener, public WindowEventListener
    4345    {
     46        friend class Singleton<InGameConsole>;
    4447    public: // functions
    4548        InGameConsole();
     
    5154
    5255        void update(const Clock& time);
    53 
    54         static InGameConsole& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
    55         static InGameConsole* getInstancePtr() { return singletonRef_s; }
    5656
    5757        static void openConsole();
     
    112112        bool bHidesAllInput_;
    113113
    114         static InGameConsole* singletonRef_s;
     114        static InGameConsole* singletonPtr_s;
    115115    };
    116116}
  • code/trunk/src/orxonox/overlays/notifications/NotificationManager.cc

    r3196 r3370  
    4646    const std::string NotificationManager::NONE = "none";
    4747
    48     NotificationManager* NotificationManager::singletonRef_s = NULL;
     48    NotificationManager* NotificationManager::singletonPtr_s = NULL;
    4949
    5050    /**
     
    5555    {
    5656        RegisterRootObject(NotificationManager);
    57 
    58         assert(singletonRef_s == 0);
    59         singletonRef_s = this;
    6057
    6158        this->highestIndex_ = 0;
     
    7067    }
    7168
    72     /**
    73     @brief
    74         Returns the current (and single) instance of the NotificationManager. Creates one, if there isn't one to begin with.
    75     @return
    76         Returns a reference to the single instance of the NotificationManager.
    77     */
    78     /*static*/ NotificationManager & NotificationManager::getInstance()
    79     {
    80         assert(singletonRef_s);
    81         return *singletonRef_s;
    82     }
    83    
    8469    /**
    8570    @brief
  • code/trunk/src/orxonox/overlays/notifications/NotificationManager.h

    r3196 r3370  
    4040#include <map>
    4141#include <string>
     42
     43#include "util/Singleton.h"
    4244#include "core/OrxonoxClass.h"
    4345
     
    5254        Damian 'Mozork' Frick
    5355    */
    54     class _OrxonoxExport NotificationManager : public OrxonoxClass
     56    class _OrxonoxExport NotificationManager : public Singleton<NotificationManager>, public OrxonoxClass
    5557    {
     58            friend class Singleton<NotificationManager>;
    5659        public:
    5760            NotificationManager();
     
    6063            static const std::string ALL;
    6164            static const std::string NONE;
    62 
    63             static NotificationManager & getInstance(); //! Returns a reference to the single instance of the NotificationManager.
    6465
    6566            bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
     
    8889
    8990        private:
    90             static NotificationManager* singletonRef_s;
     91            static NotificationManager* singletonPtr_s;
    9192
    9293            int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that  no key appears twice.
  • code/trunk/src/orxonox/sound/SoundBase.cc

    r3196 r3370  
    6565    void SoundBase::update() {
    6666        if(this->entity_ != NULL && alIsSource(this->source_)) {
    67             Vector3 pos = this->entity_->getPosition();
     67            const Vector3& pos = this->entity_->getPosition();
    6868            alSource3f(this->source_, AL_POSITION, pos.x, pos.y, pos.z);
    6969            ALenum error = alGetError();
     
    7171                COUT(2) << "Sound: OpenAL: Invalid sound position" << std::endl;
    7272
    73             Vector3 vel = this->entity_->getVelocity();
     73            const Vector3& vel = this->entity_->getVelocity();
    7474            alSource3f(this->source_, AL_VELOCITY, vel.x, vel.y, vel.z);
    7575            error = alGetError();
     
    7777                COUT(2) << "Sound: OpenAL: Invalid sound velocity" << std::endl;
    7878
    79             Quaternion orient = this->entity_->getOrientation();
     79            const Quaternion& orient = this->entity_->getOrientation();
    8080            Vector3 at = orient.zAxis();
    8181            alSource3f(this->source_, AL_DIRECTION, at.x, at.y, at.z);
     
    190190        if(ov_open(f, &vf, NULL, 0) < 0)
    191191        {
    192             COUT(2) << "Sound: libvorbisfile: File seems not to be an Ogg Vorbis bitstream" << std::endl;
     192            COUT(2) << "Sound: libvorbisfile: File does not seem to be an Ogg Vorbis bitstream" << std::endl;
    193193            ov_clear(&vf);
    194194            return AL_NONE;
  • code/trunk/src/orxonox/sound/SoundManager.cc

    r3280 r3370  
    3838namespace orxonox
    3939{
    40     SoundManager* SoundManager::singletonRef_s = NULL;
     40    SoundManager* SoundManager::singletonPtr_s = NULL;
    4141
    4242    /**
     
    4545    SoundManager::SoundManager()
    4646    {
    47         assert(singletonRef_s == NULL);
    48         singletonRef_s = this;
    49 
    5047        this->device_ = NULL;
    5148        this->soundavailable_ = true;
     
    9390    SoundManager::~SoundManager()
    9491    {
    95         assert(singletonRef_s != NULL);
    96         singletonRef_s = NULL;
    97 
    9892        alcDestroyContext(this->context_);
    9993        alcCloseDevice(this->device_);
     
    148142
    149143        // update listener orientation
    150         Quaternion orient = camera->getOrientation();
     144        const Quaternion& orient = camera->getOrientation();
    151145        Vector3 up = orient.xAxis(); // just a wild guess
    152146        Vector3 at = orient.zAxis();
  • code/trunk/src/orxonox/sound/SoundManager.h

    r3280 r3370  
    3232#include <cassert>
    3333#include <list>
     34#include "util/Singleton.h"
    3435#include "interfaces/Tickable.h"
    3536
     
    4243     *
    4344     */
    44     class _OrxonoxExport SoundManager : public Tickable
     45    class _OrxonoxExport SoundManager : public Singleton<SoundManager>, public Tickable
    4546    {
     47        friend class Singleton<SoundManager>;
    4648    public:
    4749        SoundManager();
     
    5254        bool isSoundAvailable();
    5355
    54         static SoundManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
    55 
    5656    private:
    5757        ALCdevice* device_;
     
    6060        bool soundavailable_;
    6161
    62         static SoundManager* singletonRef_s;
     62        static SoundManager* singletonPtr_s;
    6363    }; // class SoundManager
    6464} // namespace orxonox
  • code/trunk/src/orxonox/tools/ParticleInterface.cc

    r3301 r3370  
    4343#include "util/Math.h"
    4444#include "core/CoreIncludes.h"
     45#include "core/ConfigValueIncludes.h"
    4546#include "core/GameMode.h"
    46 #include "GraphicsManager.h"
    4747
    4848namespace orxonox
     
    9191    }
    9292
     93    void ParticleInterface::setConfigValues()
     94    {
     95        SetConfigValue(globalDetailLevel_, 2)
     96            .description("O: off, 1: low, 2: normal, 3: high").callback(this, &ParticleInterface::detailLevelChanged);
     97    }
     98
    9399    Ogre::ParticleEmitter* ParticleInterface::createNewEmitter()
    94100    {
     
    180186        this->detaillevel_ = level;
    181187        if (GameMode::showsGraphics())
    182             this->detailLevelChanged(GraphicsManager::getInstance().getDetailLevelParticle());
    183     }
    184 
    185     void ParticleInterface::detailLevelChanged(unsigned int newlevel)
    186     {
    187         if (newlevel >= static_cast<unsigned int>(this->detaillevel_))
     188            this->detailLevelChanged();
     189    }
     190
     191    void ParticleInterface::detailLevelChanged()
     192    {
     193        if (this->globalDetailLevel_ >= this->detaillevel_)
    188194            this->bAllowedByLOD_ = true;
    189195        else
  • code/trunk/src/orxonox/tools/ParticleInterface.h

    r3280 r3370  
    4747            ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::Value detaillevel);
    4848            virtual ~ParticleInterface();
     49            void setConfigValues();
    4950
    5051            inline Ogre::ParticleSystem* getParticleSystem()
     
    7778                { return this->bVisible_; }
    7879
    79             void detailLevelChanged(unsigned int newlevel);
    8080            void setDetailLevel(unsigned int level);
    8181
     
    9090        private:
    9191            void updateVisibility();
     92            void detailLevelChanged();
    9293
    9394            Ogre::ParticleSystem*     particleSystem_;
     
    9697            bool                      bEnabled_;
    9798            bool                      bAllowedByLOD_;
    98             unsigned int              detaillevel_;     //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
     99            unsigned int              detaillevel_;       //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
    99100            float                     speedFactor_;
     101
     102            // config values
     103            unsigned int              globalDetailLevel_; //!< Global maximum detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
    100104
    101105            static ParticleInterface* currentParticleInterface_s;
  • code/trunk/src/orxonox/tools/Shader.cc

    r3301 r3370  
    4141#include "core/CoreIncludes.h"
    4242#include "core/GameMode.h"
    43 #include "GraphicsManager.h"
     43#include "core/GraphicsManager.h"
    4444
    4545namespace orxonox
Note: See TracChangeset for help on using the changeset viewer.