virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo) { switch (event) { case eFE_Initialize : { current_values = new float[5]; for(int i = 0 ;i<5;i++) current_values[i]= 0; break; } case eFE_Activate: { if (IsPortActive(pActInfo, EIP_Enable)) { if (udpListener->IsWorking()) udpListener->EndSocket(); m_bEnabled = true; udpListener->StartSocket(GetPortInt(pActInfo, EIP_Port)); Execute(pActInfo); pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, true); } if (IsPortActive(pActInfo, EIP_Disable)) { m_bEnabled = false; udpListener->EndSocket(); pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID, false); } } break; case eFE_Update: { CTimeValue currTime(gEnv->pTimer->GetCurrTime()); float delay = 0; // processing delay delay -= (currTime-m_lastTime).GetSeconds(); m_lastTime = currTime; if (delay <= 0.0f) { Execute(pActInfo); } } break; } }
virtual ~CryVR_AndroidDevice(void) { if (udpListener->IsWorking())udpListener->EndSocket(); }