cdatapacket.cpp

来自「<B>DirectX9.0 3D游戏编程</B>」· C++ 代码 · 共 50 行

CPP
50
字号
/*******************************************************************
 *         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
 ******************************************************************/
// cDataPacket.cpp: implementation of the cDataPacket class.
//
//////////////////////////////////////////////////////////////////////

#include "cDataPacket.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

cDataPacket::cDataPacket()
{
  d_timesSent = 1;
}

cDataPacket::~cDataPacket()
{

}


void cDataPacket::Init( DWORD time, DWORD id, unsigned short len, char *pData )
{
  d_firstTime = time;
  d_lastTime = time;
  d_id = id;
  d_length = len;
  memcpy( d_data, pData, len );
}


cDataPacket &cDataPacket::operator=( const cDataPacket &otherPacket )
{
  d_timesSent = otherPacket.d_timesSent;
  d_firstTime = otherPacket.d_firstTime;
  d_lastTime = otherPacket.d_lastTime;
  d_id = otherPacket.d_id;
  d_length = otherPacket.d_length;
  memcpy( d_data, otherPacket.d_data, d_length );

  return *this;
}

⌨️ 快捷键说明

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