Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 27, 2008, 10:21:39 PM (17 years ago)
Author:
rgrieder
Message:
  • Changed GameState so that the new RootGameState can override 2 virtual methods
  • added RootGameState that takes care of state transitions (can only happen between ticks)
  • moved main loop to GSRoot instead of GSGraphics
  • network GameStates not yet finished
  • GraphicsEngine not yet merged into GSGraphics
File:
1 edited

Legend:

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

    r1670 r1672  
    4141#include "core/Core.h"
    4242#include "core/CommandLine.h"
     43#include "core/TclThreadManager.h"
    4344#include "GraphicsEngine.h"
    4445#include "Settings.h"
     
    4950
    5051    GSRoot::GSRoot()
    51         : GameState("root")
     52        : RootGameState("root")
    5253        , settings_(0)
    5354        , graphicsEngine_(0)
    54         , bExit_(false)
    5555    {
    5656    }
     
    113113        // initialise TCL
    114114        TclBind::getInstance().setDataPath(Settings::getDataPath());
     115        TclThreadManager::getInstance();
    115116
    116117        // initialise graphics engine. Doesn't load the render window yet!
     
    118119        graphicsEngine_->setup();       // creates ogre root and other essentials
    119120
    120         // console commands
    121         FunctorMember<GSRoot>* functor = createFunctor(&GSRoot::loadGame);
    122         functor->setObject(this);
    123         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "loadGame"));
     121        // add console commands
     122        FunctorMember<GSRoot>* functor1 = createFunctor(&GSRoot::exitGame);
     123        functor1->setObject(this);
     124        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor1, "exit"));
    124125
    125126        // add console commands
    126         functor = createFunctor(&GSRoot::exitGame);
    127         functor->setObject(this);
    128         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor, "exit"));
     127        FunctorMember01<GameState, const std::string&>* functor2 = createFunctor(&GameState::requestState);
     128        functor2->setObject(this);
     129        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(functor2, "selectGameState"));
    129130    }
    130131
     
    137138    }
    138139
    139     void GSRoot::ticked(float dt)
     140    void GSRoot::ticked(float dt, uint64_t time)
    140141    {
    141         this->tickChild(dt);
    142     }
     142        TclThreadManager::getInstance().tick(dt);
    143143
    144     /**
    145     @brief
    146         Requests a state.
    147     */
    148     void GSRoot::loadGame(const std::string& name)
    149     {
    150         this->requestState(name);
     144        this->tickChild(dt, time);
    151145    }
    152146}
Note: See TracChangeset for help on using the changeset viewer.