UINT WINAPI CPlayer::WaitNetworkPlayer(LPVOID pVoid) { CPlayer *player=(CPlayer*)pVoid; PSInstance *psInstance=player->getPSInstance(); MYTRACE("[%d]thread start",player->playerNum); // MYTRACE("isAlive:%d",player->isAlive?1:0); while(player->isAlive) { // EnterCriticalSection(&player->getCriticalSection()); if(player->isMessageWait && !player->isMessageReceived) { MYTRACE("[%d]recvData-start",player->playerNum); int ret=psInstance->recvData((char*)&(player->decisionInfo),sizeof(DECISION_INFO)); MYTRACE("[%d]recvData-end(ret:%d)",player->playerNum,ret); if(ret==0) { player->setDead(); break; } player->isMessageReceived=true; player->messageReceivedTime=DXUTGetTime(); } //LeaveCriticalSection(&player->getCriticalSection()); Sleep(10); } MYTRACE("[%d]thread end",player->playerNum); return 1; }
void MainHUD::Refresh() { CDXUTDialog::SetRefreshTime( (float) DXUTGetTime() ); CDXUTButton* pButton = m_Dialog.GetButton(MAINDLG_OPEN); if(pButton) { if(STATE_GET(MergeMode) ) pButton->SetText( L"Merge" ); else pButton->SetText( L"Open" ); } pButton = m_Dialog.GetButton(MAINDLG_REFRESH); if(pButton) pButton->SetEnabled( STATE_GET(ManualRefreshMode) ); pButton = m_Dialog.GetButton(MAINDLG_DXCHANGE); if(pButton) { pButton->SetEnabled( STATE_GET( AllowD3D10 ) ); if( STATE_GET(Version) == DXUT_D3D10_DEVICE ) pButton->SetText( L"Direct3D9 Mode" ); else if( STATE_GET(Version) == DXUT_D3D9_DEVICE ) pButton->SetText( L"Direct3D10 Mode" ); } }
void CPlayer::initialize(int pMode) { memset(&playInfo,0,sizeof(playInfo)); playInfo.turnNum=0; playInfo.nowCombo=0; playInfo.holdNum=0; playInfo.isOnHold=FALSE; playInfo.nowXPos=3; playInfo.nowYPos=0; playInfo.holdCount=0; playInfo.lineDeletionCount=0; playInfo.isBackToBack=FALSE; playInfo.holeRandomNum=0; //보드 초기화 //board.clearBoard(); int selectedBoard=((CState_CustomSetting*)CState_CustomSetting::instance())->GetSelectedMapNo(); memcpy(board.board,CBoard::initialBoard[selectedBoard],22*10); for(int i=0;i<6;i++) { keyboardInputLimitTime[i]=0; //다음 키 입력받기까지 얼마나 기다려야 하나? lastKeyboardTime[i]=0; isRepeated[i]=false; isKeyDown[i]=false; } lastDownTime=playStartTime=DXUTGetTime(); lastDownTime+=1; //1초 지연후 떨어지게 isAlive=true; isAutoMoving=false; isMessageWait=false; isMessageReceived=false; messageSendedTime=0; messageReceivedTime=0; eventQueue.clear(); //이름 설정 switch(pMode) { case PERSON: memset(playerName,0,sizeof(playerName)); memset(message,0,sizeof(message)); memcpy(playerName,L"신의 손가락",sizeof(L"신의 손가락")); break; case NONE: memset(playerName,0,sizeof(playerName)); memset(message,0,sizeof(message)); break; } }