Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 25, 2009, 5:23:00 PM (16 years ago)
Author:
rgrieder
Message:

Implemented new GameState concept. It doesn't differ that much from the old one, but there's still lots of changes.
The most important change is that one GameState can occur multiple times in the hierarchy.

Short log:

  • No RootGameState anymore. Simply the highest is root.
  • Game::requestGameState(name) can refer to the parent, grandparent, great-grandparent, etc. or one of the children.
  • Requested states are saved. So if you select "level", the next request (even right after the call) will be relative to "level"
  • Game::popState() will simply unload the current one
  • Re added Main.cc again because Game as well as GameState have been moved to the core
  • Adapted all GameStates to the new system

Things should already work, except for network support because standalone only works with a little hack.
We can now start creating a better hierarchy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/gamestates/GSLevel.cc

    r2817 r2844  
    4747#include "LevelManager.h"
    4848#include "PlayerManager.h"
     49#include "core/Game.h"
    4950
    5051namespace orxonox
    5152{
     53    AddGameState(GSLevel, "level");
     54
    5255    SetCommandLineArgument(level, "presentation.oxw").shortcut("l");
    5356
    54     GSLevel::GSLevel()
    55 //        : GameState(name)
    56         : keyBinder_(0)
     57    GSLevel::GSLevel(const std::string& name)
     58        : GameState(name)
     59        , keyBinder_(0)
    5760        , inputState_(0)
    5861        , radar_(0)
     
    6568        this->ccKeybind_ = 0;
    6669        this->ccTkeybind_ = 0;
    67 
     70    }
     71
     72    GSLevel::~GSLevel()
     73    {
     74    }
     75
     76    void GSLevel::setConfigValues()
     77    {
     78        SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName=");
     79    }
     80
     81    void GSLevel::activate()
     82    {
    6883        setConfigValues();
    69     }
    70 
    71     GSLevel::~GSLevel()
    72     {
    73     }
    74 
    75     void GSLevel::setConfigValues()
    76     {
    77         SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName=");
    78     }
    79 
    80     void GSLevel::enter()
    81     {
     84
    8285        if (Core::showsGraphics())
    8386        {
     
    126129    }
    127130
    128     void GSLevel::leave()
     131    void GSLevel::deactivate()
    129132    {
    130133        // destroy console commands
     
    188191    }
    189192
    190     void GSLevel::ticked(const Clock& time)
    191     {
    192         // Commented by 1337: Temporarily moved to GSGraphics.
     193    void GSLevel::update(const Clock& time)
     194    {
     195        // Note: Temporarily moved to GSGraphics.
    193196        //// Call the scene objects
    194197        //for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
     
    233236        Command string that can be executed by the CommandExecutor
    234237        OR: Internal string "KeybindBindingStringKeyName=" used for the second call to identify
    235         the key/button/axis that has been activated. This is configured above in enter().
     238        the key/button/axis that has been activated. This is configured above in activate().
    236239    */
    237240    void GSLevel::keybindInternal(const std::string& command, bool bTemporary)
Note: See TracChangeset for help on using the changeset viewer.