Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 24, 2008, 11:00:30 PM (17 years ago)
Author:
scheusso
Message:

first success: client clones the servers universe and displays it with quite good performance

Location:
code/branches/network3/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network3/src/network/Client.cc

    r1168 r1184  
    4444namespace network
    4545{
     46  Client* Client::_sClient = 0;
     47 
     48  Client* Client::createSingleton(){
     49    if(!_sClient)
     50      _sClient = new Client();
     51    return _sClient;
     52  }
     53 
     54  Client* Client::createSingleton(std::string address, int port){
     55    if(!_sClient)
     56      _sClient = new Client(address, port);
     57    return _sClient;
     58  }
     59 
     60  Client* Client::createSingleton(const char *address, int port){
     61    if(!_sClient)
     62      _sClient = new Client(address, port);
     63    return _sClient;
     64  }
     65 
     66  void Client::destroySingleton(){
     67    if(_sClient){
     68      delete _sClient;
     69      _sClient = 0;
     70    }
     71  }
     72 
     73  Client* Client::getSingleton(){
     74    return _sClient;
     75  }
     76 
    4677  /**
    4778  * Constructor for the Client class
     
    71102  }
    72103
     104  Client::~Client(){
     105    if(isConnected)
     106      closeConnection();
     107  }
     108 
    73109  /**
    74110  * Establish the Connection to the Server
  • code/branches/network3/src/network/Client.h

    r1168 r1184  
    6565  class _NetworkExport Client : PacketDecoder, public orxonox::Tickable{
    6666  public:
    67     Client();
    68     Client(std::string address, int port);
    69     Client(const char *address, int port);
    70 
     67   
     68    static Client* createSingleton();
     69    static Client* createSingleton(std::string address, int port);
     70    static Client* createSingleton(const char *address, int port);
     71    static void destroySingleton();
     72    static Client *getSingleton();
     73   
    7174    bool establishConnection();
    7275    bool closeConnection();
     
    8487
    8588  private:
     89    Client();
     90    Client(std::string address, int port);
     91    Client(const char *address, int port);
     92    ~Client();
     93   
     94    static Client* _sClient;
     95   
    8696    ClientConnection client_connection;
    8797    PacketGenerator pck_gen;
  • code/branches/network3/src/network/Server.cc

    r1175 r1184  
    143143    updateGamestate();
    144144
    145     sleep(1); // TODO remove
     145    //sleep(1); // TODO remove
    146146    return;
    147147  }
Note: See TracChangeset for help on using the changeset viewer.