Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 1, 2008, 7:04:09 PM (16 years ago)
Author:
landauf
Message:

merged objecthierarchy branch back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r1907 r2087  
    3232#include "core/input/InputManager.h"
    3333#include "core/CommandLine.h"
     34#include "core/Core.h"
    3435#include "network/Client.h"
    35 #include "Settings.h"
    3636
    3737namespace orxonox
    3838{
    39     SetCommandLineArgument(ip, "127.0.0.1").setInformation("#.#.#.#");
     39    SetCommandLineArgument(ip, "127.0.0.1").information("#.#.#.#");
    4040
    4141    GSClient::GSClient()
    42         : GSLevel("client")
     42        : GameState<GSGraphics>("client")
    4343        , client_(0)
    4444    {
     
    5151    void GSClient::enter()
    5252    {
    53         Settings::_getInstance().bIsClient_ = true;
     53        Core::setIsClient(true);
    5454
    55         GSLevel::enter();
    56 
    57         int serverPort = CommandLine::getArgument<int>("port")->getValue();
    58         std::string serverIP = CommandLine::getArgument<std::string>("ip")->getValue();
    59         this->client_ = new network::Client(serverIP, serverPort);
     55        this->client_ = new network::Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port"));
    6056
    6157        if(!client_->establishConnection())
    6258            ThrowException(InitialisationFailed, "Could not establish connection with server.");
    6359
     60        GSLevel::enter(this->getParent()->getViewport());
     61
    6462        client_->tick(0);
    65 
    66         // level is loaded: we can start capturing the input
    67         InputManager::getInstance().requestEnterState("game");
    6863    }
    6964
    7065    void GSClient::leave()
    7166    {
    72         InputManager::getInstance().requestLeaveState("game");
    73 
    74         // TODO: How do we unload the level in client mode?
     67        GSLevel::leave();
    7568
    7669        client_->closeConnection();
     
    7972        delete this->client_;
    8073
    81         GSLevel::leave();
    82 
    83         Settings::_getInstance().bIsClient_ = false;
     74        Core::setIsClient(false);
    8475    }
    8576
Note: See TracChangeset for help on using the changeset viewer.