Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2845 for code/branches/gui/src


Ignore:
Timestamp:
Mar 25, 2009, 5:33:58 PM (16 years ago)
Author:
rgrieder
Message:
  • Moved some code from Game to Main and GSRoot
  • Renamed "gui" GameState to "mainMenu"
Location:
code/branches/gui/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/core/Game.cc

    r2844 r2845  
    5050namespace orxonox
    5151{
    52     void stop_game()
    53     {
    54         Game::getInstance().stop();
    55     }
     52    static void stop_game()
     53        { Game::getInstance().stop(); }
     54    SetConsoleCommandShortcutExternAlias(stop_game, "exit");
    5655
    5756    struct _CoreExport GameStateTreeNode
     
    6160        std::vector<GameStateTreeNode*> children_;
    6261    };
    63 
    64     SetCommandLineArgument(state, "gui").shortcut("s");
    65     SetCommandLineSwitch(startWithConsole);
    66     SetConsoleCommandShortcutExternAlias(stop_game, "exit");
    6762
    6863    std::map<std::string, GameState*> Game::allStates_s;
     
    132127    void Game::run()
    133128    {
    134         // </EXPORT THIS>
    135         this->setStateHierarchy(
    136         "root"
    137         " graphics"
    138         "  gui"
    139         "  standalone"
    140         "   level"
    141         "  server"
    142         "   level"
    143         "  client"
    144         "   level"
    145         " dedicated"
    146         "  level"
    147         " ioConsole"
    148         );
    149         // </EXPORT THIS>
    150 
    151 
    152         // Always start with the root state
     129        // Always start with the ROOT state
    153130        this->requestedStateNodes_.push_back(this->rootStateNode_);
    154131        this->activeStateNode_ = this->rootStateNode_;
    155132        this->loadState(this->rootStateNode_->state_);
    156133
    157         // <EXPORT THIS>
    158         if (CommandLine::getValue("startWithConsole").getBool())
    159         {
    160             // Start the game in the console
    161             this->requestState("ioConsole");
    162         }
    163         else
    164         {
    165             // Start in GUI main menu
    166             this->requestState("graphics");
    167             this->requestState("gui");
    168         }
    169         // </EXPORT THIS>
    170 
     134        // START GAME
    171135        this->gameClock_->capture(); // first delta time should be about 0 seconds
    172136        while (!this->abort_ && !this->activeStates_.empty())
     
    224188        }
    225189
    226         // Unload all remaining states
     190        // UNLOAD all remaining states
    227191        while (!this->activeStates_.empty())
    228192            this->unloadState(this->activeStates_.back());
  • code/branches/gui/src/orxonox/Main.cc

    r2844 r2845  
    4848    {
    4949        orxonox::Game orxonox(argc, argv);
     50
     51        orxonox.setStateHierarchy(
     52        "root"
     53        " graphics"
     54        "  mainMenu"
     55        "  standalone"
     56        "   level"
     57        "  server"
     58        "   level"
     59        "  client"
     60        "   level"
     61        " dedicated"
     62        "  level"
     63        " ioConsole"
     64        );
     65
    5066        orxonox.run();
    5167    } // orxonox gets destroyed right here!
  • code/branches/gui/src/orxonox/gamestates/GSGUI.cc

    r2844 r2845  
    4141namespace orxonox
    4242{
    43     AddGameState(GSGUI, "gui");
     43    AddGameState(GSGUI, "mainMenu");
    4444
    4545    GSGUI::GSGUI(const std::string& name)
  • code/branches/gui/src/orxonox/gamestates/GSRoot.cc

    r2844 r2845  
    3434#include "core/Clock.h"
    3535#include "core/Core.h"
     36#include "core/CommandLine.h"
    3637#include "core/ConsoleCommand.h"
    3738#include "tools/TimeFactorListener.h"
     
    4344{
    4445    AddGameState(GSRoot, "root");
     46    SetCommandLineSwitch(startWithConsole);
    4547
    4648    GSRoot::GSRoot(const std::string& name)
     
    7880            CommandExecutor::addConsoleCommandShortcut(this->ccPause_).accessLevel(AccessLevel::Offline);
    7981        }
     82
     83        // Determine where to start
     84        if (CommandLine::getValue("startWithConsole").getBool())
     85        {
     86            // Start the game in the console
     87            Game::getInstance().requestState("ioConsole");
     88        }
     89        else
     90        {
     91            // Start in GUI main menu
     92            Game::getInstance().requestState("graphics");
     93            Game::getInstance().requestState("mainMenu");
     94        }
     95
    8096    }
    8197
Note: See TracChangeset for help on using the changeset viewer.