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:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • 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)
Note: See TracChangeset for help on using the changeset viewer.