⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cnetclock.h

📁 <B>DirectX9.0 3D游戏编程</B>
💻 H
字号:
/*******************************************************************
 *         Advanced 3D Game Programming using DirectX 9.0
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * copyright (c) 2003 by Peter A Walsh and Adrian Perez
 * See license.txt for modification and distribution information
 ******************************************************************/
// cNetClock.h: interface for the cNetClock class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CNETCLOCK_H__1E011A05_D341_11D3_AE4F_00E029031C67__INCLUDED_)
#define AFX_CNETCLOCK_H__1E011A05_D341_11D3_AE4F_00E029031C67__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include "cMonitor.h"


struct cTimePair
{
public:
  DWORD d_actual,  // The actual time as reported by GetTickCount()
        d_clock;  // The clock time as determined by the server.
};


class cNetClock : public cMonitor  
{
  cTimePair d_start,  // The first time set by the server.
            d_lastUpdate;  // the last updated time set by the server.
  bool      d_bInitialized;  // first time has been received.
  double    d_ratio;
  // The difference as measured by
  //  d_lastUpdated.d_clock - d_start.d_clock
  // -----------------------------------------
  // d_lastUpdated.d_actual - d_start.d_actual

public:
	cNetClock();
	virtual ~cNetClock();

  void  Init();
  void  Synchronize( DWORD serverTime, DWORD packetSendTime, DWORD packetACKTime, float ping );
  DWORD GetTime() const;
  DWORD TranslateTime( DWORD time ) const;
};

#endif // !defined(AFX_CNETCLOCK_H__1E011A05_D341_11D3_AE4F_00E029031C67__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -