void update() { processHandlerState(); setDriveMotors(); setFlipMotor(); updateDashboard(handlerState, armState); }
bool LmGameManager::init() { if (!m_pLmServerManager->init()) { CCLOG("Initialization Server Manager failed"); return false; } //init splashscreen if (!initSplashScreen()) { CCLOG("Initialization splash screen failed"); return false; } //get the vector of scene through the serverManager and indicate if it's for child or parent m_aInteractionSceneOfTheGame = m_pLmServerManager->getInteractionSceneOfTheGame( m_pUser1->isBParent()); //init callback method of the custom event (use to know when an interactionScene want to communicate with this) auto InteractionSceneFinished = [=](EventCustom * event) { //TODO //check if t's done and win etc and update sprite (for now its everytime done) m_aSpritesInteractions.at(m_iIndexInteractionScene)->setTexture("Ludomuse/GUIElements/interactionDone.png"); m_iInteractionDone++; //update index m_iIndexInteractionScene++; //update label of dashboard updateDashboard(); //it's not a back to dashboard m_bBackToDashboard=false; //reset touch enable removeListeners(false); }; auto BackToDashboard = [=](EventCustom * event) { m_bBackToDashboard=true; //reset touch enable removeListeners(false); }; //add the custom event to the event dispatcher Director::getInstance()->getEventDispatcher()->addCustomEventListener( "InteractionSceneFinished", InteractionSceneFinished); Director::getInstance()->getEventDispatcher()->addCustomEventListener( "BackToDashboard", BackToDashboard); return true; }