00001 #ifndef _MERCURY_NET_CLIENT 00002 #define _MERCURY_NET_CLIENT 00003 00004 #include "MercuryMessages.h" 00005 #include "MercuryTimer.h" 00006 #include "ezSockets.h" 00007 #include "MercuryNetServer.h" 00008 00009 class MercuryODEWorld; 00010 00011 class MercuryNetClient : public MercuryMessageHandler 00012 { 00013 public: 00014 MercuryNetClient(); 00015 ~MercuryNetClient(); 00016 00017 bool Connect( const MString & sHost, int iPort ); 00018 void LinkODE( MercuryODEWorld * pWorld ) { m_pWorld = pWorld; } 00019 void Update( const float fDTime ); 00020 00021 static void * CoreThreadCaller( void * NetClient); 00022 void CoreThread(); 00023 00024 void SendCommand( const MString & sCommandName, const PStack & kParameters ); 00025 void SetNetClass( MercuryObject * pNetClass ) { m_pNetClass = pNetClass; } 00026 00027 void Message( int Message, PStack & data, const MString & name ); 00028 protected: 00029 MercuryObject * m_pNetClass; 00030 float m_fLDeltaMax; //20 good value? Should it be based on speed & position? 00031 00032 ezSockets * m_pSocket; 00033 MercuryODEWorld * m_pWorld; 00034 MercuryThread m_thdMain; 00035 00036 MercuryTimer m_tmrSync; 00037 double m_delTime; //offset time from server 00038 int m_delTimeID; 00039 00040 double fDeltaSync; 00041 }; 00042 00043 #endif