Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2009, 10:23:58 PM (14 years ago)
Author:
rgrieder
Message:

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
Location:
code/trunk
Files:
2 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/gamestates/GSGraphics.cc

    r5929 r6417  
    6464    void GSGraphics::activate()
    6565    {
    66         // add console command to toggle GUI
    67         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSGraphics::toggleGUI, this), "toggleGUI"));
     66
    6867    }
    6968
     
    7877    }
    7978
    80     /**
    81     @brief
    82         Toggles the visibility of the current GUI
    83 
    84         This function just executes a Lua function in the main script of the GUI by accessing the GUIManager.
    85         For more details on this function check out the Lua code.
    86     */
    87     void GSGraphics::toggleGUI()
    88     {
    89         GUIManager::getInstance().executeCode("toggleGUI()");
    90     }
    91 
    9279    void GSGraphics::update(const Clock& time)
    9380    {
  • code/trunk/src/orxonox/gamestates/GSGraphics.h

    r5929 r6417  
    5757        void update(const Clock& time);
    5858
    59         void toggleGUI();
    60 
    6159    private:
    6260    };
  • code/trunk/src/orxonox/gamestates/GSLevel.cc

    r5966 r6417  
    5656        , guiKeysOnlyInputState_(0)
    5757        , startFile_(0)
     58        , bShowIngameGUI_(false)
    5859    {
    5960    }
     
    7879            guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly");
    7980            guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr());
    80 
    81             CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSLevel::showIngameGUI, this), "showIngameGUI"));
    8281        }
    8382
     
    9190            // level is loaded: we can start capturing the input
    9291            InputManager::getInstance().enterState("game");
    93            
     92
    9493            // connect the HumanPlayer to the game
    9594            PlayerManager::getInstance().clientConnected(0);
    96         }
    97     }
    98 
    99     void GSLevel::showIngameGUI(bool show)
    100     {
    101         if (show)
    102         {
    103             GUIManager::getInstance().showGUI("inGameTest");
    104             GUIManager::getInstance().executeCode("showCursor()");
    105             InputManager::getInstance().enterState("guiMouseOnly");
    106         }
    107         else
    108         {
    109             GUIManager::getInstance().executeCode("hideGUI(\"inGameTest\")");
    110             GUIManager::getInstance().executeCode("hideCursor()");
    111             InputManager::getInstance().leaveState("guiMouseOnly");
    11295        }
    11396    }
     
    122105            InputManager::getInstance().leaveState("game");
    123106        }
    124        
     107
    125108        // disconnect all HumanPlayers
    126109        PlayerManager::getInstance().disconnectAllClients();
     
    152135        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
    153136            this->staticObjects_.insert(*it);
    154        
     137
    155138        // call the loader
    156139        COUT(0) << "Loading level..." << std::endl;
     
    171154            if (find == this->staticObjects_.end())
    172155            {
    173                 COUT(3) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << ")" << std::endl;
     156                COUT(3) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << ')' << std::endl;
    174157            }
    175158        }
  • code/trunk/src/orxonox/gamestates/GSLevel.h

    r5929 r6417  
    5252        void loadLevel();
    5353        void unloadLevel();
    54         void showIngameGUI(bool show);
    5554
    5655        InputState*              gameInputState_;          //!< input state for normal ingame playing
     
    6059        XMLFile* startFile_;
    6160        std::set<BaseObject*> staticObjects_;
     61        bool bShowIngameGUI_;
    6262    };
    6363}
  • code/trunk/src/orxonox/gamestates/GSMainMenu.cc

    r6105 r6417  
    3636#include "core/Game.h"
    3737#include "core/ConsoleCommand.h"
     38#include "core/ConfigValueIncludes.h"
     39#include "core/CoreIncludes.h"
    3840#include "core/GraphicsManager.h"
    3941#include "core/GUIManager.h"
     
    4951        , inputState_(0)
    5052    {
     53        RegisterRootObject(GSMainMenu);
    5154        inputState_ = InputManager::getInstance().createInputState("mainMenu");
    5255        inputState_->setMouseMode(MouseMode::Nonexclusive);
     
    6467            // Load sound
    6568            this->ambient_ = new AmbientSound(0);
    66             this->ambient_->setSource("ambient/mainmenu.wav");
     69            this->ambient_->setSyncMode(0x0);
    6770        }
    6871    }
     
    7174    {
    7275        if (GameMode::playsSound())
    73             delete this->ambient_;
     76            this->ambient_->destroy();
    7477
    7578        InputManager::getInstance().destroyState("mainMenu");
     
    8285    {
    8386        // show main menu
    84         GUIManager::getInstance().showGUI("MainMenu");
     87        GUIManager::getInstance().showGUI("MainMenu", true, GraphicsManager::getInstance().isFullScreen());
    8588        GUIManager::getInstance().setCamera(this->camera_);
     89        GUIManager::getInstance().setBackground("MainMenuBackground");
     90//         GUIManager::getInstance().setBackground("");
    8691        GraphicsManager::getInstance().setCamera(this->camera_);
    8792
     
    9297        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::startMainMenu), "startMainMenu"));
    9398
     99        // create command to change sound path
     100        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&GSMainMenu::setMainMenuSoundPath, this), "setMMSoundPath"));
     101
    94102        KeyBinderManager::getInstance().setToDefault();
    95103        InputManager::getInstance().enterState("mainMenu");
    96104
     105        this->setConfigValues();
     106
    97107        if (GameMode::playsSound())
    98108        {
    99             this->ambient_->setLoop(true);
    100             this->ambient_->play();
     109            this->ambient_->setLooping(true);
     110            this->ambient_->play(); // works without source
    101111        }
    102112    }
     
    112122
    113123        GUIManager::getInstance().setCamera(0);
     124        GUIManager::getInstance().setBackground("");
     125        GUIManager::hideGUI("MainMenu");
    114126        GraphicsManager::getInstance().setCamera(0);
    115127    }
     
    117129    void GSMainMenu::update(const Clock& time)
    118130    {
     131    }
     132
     133    void GSMainMenu::setConfigValues()
     134    {
     135        SetConfigValue(soundPathMain_, "mainmenu.ogg")
     136            .description("Contains the path to the main menu sound file.")
     137            .callback(this, &GSMainMenu::reloadSound);
     138    }
     139
     140    void GSMainMenu::reloadSound()
     141    {
     142        if (GameMode::playsSound())
     143        {
     144            this->ambient_->setAmbientSource(soundPathMain_);
     145        }
     146    }
     147
     148    const std::string& GSMainMenu::getMainMenuSoundPath()
     149    {
     150        return soundPathMain_;
     151    }
     152
     153    void GSMainMenu::setMainMenuSoundPath(const std::string& path)
     154    {
     155        ModifyConfigValue(soundPathMain_, set, path);
    119156    }
    120157
  • code/trunk/src/orxonox/gamestates/GSMainMenu.h

    r5929 r6417  
    3434#include "util/OgreForwardRefs.h"
    3535#include "core/GameState.h"
     36#include "core/OrxonoxClass.h"
    3637
    3738namespace orxonox
    3839{
    39     class _OrxonoxExport GSMainMenu : public GameState
     40    class _OrxonoxExport GSMainMenu : public GameState, public OrxonoxClass
    4041    {
    4142    public:
     
    4647        void deactivate();
    4748        void update(const Clock& time);
     49
     50        void setConfigValues();
     51        void reloadSound();
     52        const std::string& getMainMenuSoundPath();
     53        void setMainMenuSoundPath(const std::string& path);
    4854
    4955        static void startStandalone();
     
    6167        // ambient sound for the main menu
    6268        AmbientSound*     ambient_;
     69        std::string       soundPathMain_;
    6370    };
    6471}
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r6105 r6417  
    3030
    3131#include "util/Clock.h"
     32#include "core/BaseObject.h"
    3233#include "core/ConsoleCommand.h"
    3334#include "core/Game.h"
     
    4546    GSRoot::GSRoot(const GameStateInfo& info)
    4647        : GameState(info)
    47         , timeFactor_(1.0f)
    4848        , bPaused_(false)
    4949        , timeFactorPauseBackup_(1.0f)
     
    5555        NetworkFunctionBase::destroyAllNetworkFunctions();
    5656    }
    57    
     57
    5858    void GSRoot::printObjects()
    5959    {
    6060        unsigned int nr=0;
    61         for(ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it){
    62             if( dynamic_cast<Synchronisable*>(*it) )
     61        for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it)
     62        {
     63            if (dynamic_cast<Synchronisable*>(*it))
    6364                COUT(0) << "object: " << it->getIdentifier()->getName() << " id: " << dynamic_cast<Synchronisable*>(*it)->getObjectID() << std::endl;
    6465            else
     
    6768        }
    6869        COUT(0) << "currently got " << nr << " objects" << std::endl;
    69    
    7070    }
    7171
     
    7373    {
    7474        // reset game speed to normal
    75         this->timeFactor_ = 1.0f;
     75        TimeFactorListener::setTimeFactor(1.0f);
    7676
    7777        // time factor console command
     
    9191    {
    9292        for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; )
    93             (it++)->tick(time);
     93        {
     94            Timer* object = *it;
     95            ++it;
     96            object->tick(time);
     97        }
    9498
    9599        /*** HACK *** HACK ***/
     
    101105            leveldt = 0.0f;
    102106        }
     107        float realdt = leveldt * TimeFactorListener::getTimeFactor();
    103108        for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; )
    104             (it++)->tick(leveldt * this->timeFactor_);
     109        {
     110            Tickable* object = *it;
     111            ++it;
     112            object->tick(realdt);
     113        }
    105114        /*** HACK *** HACK ***/
    106115    }
     
    119128            if (!this->bPaused_)
    120129            {
    121                 TimeFactorListener::timefactor_s = factor;
    122 
    123                 for (ObjectList<TimeFactorListener>::iterator it = ObjectList<TimeFactorListener>::begin(); it != ObjectList<TimeFactorListener>::end(); ++it)
    124                     it->changedTimeFactor(factor, this->timeFactor_);
    125 
    126                 this->timeFactor_ = factor;
     130                TimeFactorListener::setTimeFactor(factor);
    127131            }
    128132            else
     
    137141            if (!this->bPaused_)
    138142            {
    139                 this->timeFactorPauseBackup_ = this->timeFactor_;
     143                this->timeFactorPauseBackup_ = TimeFactorListener::getTimeFactor();
    140144                this->setTimeFactor(0.0f);
    141145                this->bPaused_ = true;
     
    148152        }
    149153    }
     154
     155    float GSRoot::getTimeFactor()
     156    {
     157        return TimeFactorListener::getTimeFactor();
     158    }
    150159}
  • code/trunk/src/orxonox/gamestates/GSRoot.h

    r5929 r6417  
    5151        void setTimeFactor(float factor);
    5252        void pause();
    53         float getTimeFactor() { return this->timeFactor_; }
     53        float getTimeFactor();
    5454
    5555    private:
    56         float                 timeFactor_;              //!< A factor that sets the gamespeed. 1 is normal.
    5756        bool                  bPaused_;
    5857        float                 timeFactorPauseBackup_;
Note: See TracChangeset for help on using the changeset viewer.