コード例 #1
0
ファイル: Client.cpp プロジェクト: BillXu/NewProject
void CClientRobot::Run()
{
    clock_t nTick = clock();
    while ( 1  )
    {
        m_pNetWork.ReciveMessage();

        float fElasp = (float)(clock() - nTick ) / (float)CLOCKS_PER_SEC ;
        nTick = clock();
        if ( m_pCurentScene)
        {
            m_pCurentScene->OnUpdate(fElasp);
        }

        processReconnect(fElasp);
        Sleep(2);
        if ( m_pLastScene )
        {
            delete m_pLastScene ;
            m_pLastScene = NULL ;
        }


    }
    m_pNetWork.ShutDown();
}
コード例 #2
0
ファイル: ClientController.cpp プロジェクト: adderly/coconut
void ClientController::onSocket_Close() {
	boost::shared_ptr<ClientController> SELF = sharedMyself();
	ioService()->deferredCall(boost::bind(&ClientController::fire_onClosed, SELF));
	processReconnect();
	eventClosedConnection()->fireObservers(SELF, 0);
}
コード例 #3
0
ファイル: ClientController.cpp プロジェクト: adderly/coconut
void ClientController::onSocket_Error(int error, const char*strerror) {
	boost::shared_ptr<ClientController> SELF = sharedMyself();
	ioService()->deferredCall(boost::bind(&ClientController::fire_onError, SELF, error, std::string(strerror)));
	processReconnect();
	eventClosedConnection()->fireObservers(shared_from_this(), error);
}