|
|
发表于 2007-4-29 21:30:00
|
显示全部楼层
Re:DirectPlay中的图象抖动问题
多线程程序在设计上有一定难度,建议你先用单线程实现。
然后分析模型,再修改代码成为多线程。
我的c/s程序中客户端用的单线程模型
//init directplay
hr = CoCreateInstance( CLSID_DirectPlay8ThreadPool, NULL,
CLSCTX_INPROC_SERVER,
IID_IDirectPlay8ThreadPool,
(LPVOID*) &g_pThreadPool );
hr = g_pThreadPool->Initialize(NULL, DirectPlayMessageHandler, 0 );
if( FAILED( hr = g_pThreadPool->SetThreadCount( (DWORD) -1, 0, 0 ) ) )
{
DXTRACE_ERR_MSGBOX( TEXT("Failed calling SetThreadCount"), hr );
}
//end init directplay
//frame move
g_pThreadPool->DoWork( 100, 0 );
//end frame move |
|