bool Diving::play(uint16 playerCount, bool hasPearlLocation) { init(); initScreen(); initCursor(); _vm->_draw->blitInvalidated(); _vm->_video->retrace(); while (!_vm->shouldQuit()) { evilFishEnter(); checkShots(); updateAnims(); _vm->_draw->animateCursor(1); _vm->_draw->blitInvalidated(); _vm->_util->waitEndFrame(); _vm->_util->processInput(); int16 mouseX, mouseY; MouseButtons mouseButtons; int16 key = checkInput(mouseX, mouseY, mouseButtons); if (key == kKeyEscape) break; if (mouseButtons == kMouseButtonsLeft) shoot(mouseX, mouseY); if ((_whitePearlCount >= 20) || (_blackPearlCount >= 2)) break; } deinit(); return _blackPearlCount >= 2; }
//-------------------------------------------------------------- void testApp::update(){ int cardId = m_sliCardId; nodeKey = ofToString(cardId); updateAnims(); updateGui(); if(m_btAnimDropOnPin2==true){ m_oXbees.sendNodeDrop(nodeKey, 2, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 2, m_pxDropDuration); } if(m_btAnimDropOffPin2==true){ m_oXbees.sendNodeDrop(nodeKey, 2, 0); m_oXbees.setNodeDrop(nodeKey, 2, 0); } if(m_btAnimPwmOnPin2==true){ m_oXbees.sendNodePwm(nodeKey, 2, 1); m_oXbees.setNodeAllStrip(nodeKey, 2, 1); } if(m_btAnimPwmOffPin2==true){ m_oXbees.sendNodePwm(nodeKey, 2, 0); m_oXbees.setNodeAllStrip(nodeKey, 2, 0); } /* if(m_aAnims[nodeKey + ":2:Drop"].isAnimating()){ m_sliAllPin2 = 0; m_oXbees.sendNodeDrop(nodeKey, 2, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 2, m_pxDropDuration); }else{ m_oXbees.sendNodeDrop(nodeKey, 2, 0); m_oXbees.setNodeDrop(nodeKey, 2, 0); if(m_sliDropPin2>0.5){ m_oXbees.sendNodePwm(nodeKey, 2, 1); m_oXbees.setNodeAllStrip(nodeKey, 2, 1); }else{ m_oXbees.sendNodePwm(nodeKey, 2, 0); m_oXbees.setNodeAllStrip(nodeKey, 2, 0); } } */ if(m_aAnims[nodeKey + ":3:Drop"].isAnimating()){ m_sliAllPin3 = 0; m_oXbees.sendNodeDrop(nodeKey, 3, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 3, m_pxDropDuration); }else{ m_oXbees.sendNodeDrop(nodeKey, 3, 0); m_oXbees.setNodeDrop(nodeKey, 3, 0); } if(m_aAnims[nodeKey + ":4:Drop"].isAnimating()){ m_sliAllPin4 = 0; m_oXbees.sendNodeDrop(nodeKey, 4, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 4, m_pxDropDuration); }else{ m_oXbees.sendNodeDrop(nodeKey, 4, 0); m_oXbees.setNodeDrop(nodeKey, 4, 0); } if(m_aAnims[nodeKey + ":5:Drop"].isAnimating()){ m_sliAllPin5 = 0; m_oXbees.sendNodeDrop(nodeKey, 5, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 5, m_pxDropDuration); }else{ m_oXbees.sendNodeDrop(nodeKey, 5, 0); m_oXbees.setNodeDrop(nodeKey, 5, 0); } if(m_aAnims[nodeKey + ":6:Drop"].isAnimating()){ m_sliAllPin6 = 0; m_oXbees.sendNodeDrop(nodeKey, 6, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 6, m_pxDropDuration); }else{ m_oXbees.sendNodeDrop(nodeKey, 6, 0); m_oXbees.setNodeDrop(nodeKey, 6, 0); } if(m_aAnims[nodeKey + ":7:Drop"].isAnimating()){ m_sliAllPin7 = 0; m_oXbees.sendNodeDrop(nodeKey, 7, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 7, m_pxDropDuration); }else{ m_oXbees.sendNodeDrop(nodeKey, 7, 0); m_oXbees.setNodeDrop(nodeKey, 7, 0); } if(m_aAnims[nodeKey + ":8:Drop"].isAnimating()){ m_sliAllPin8 = 0; m_oXbees.sendNodeDrop(nodeKey, 8, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 8, m_pxDropDuration); }else{ m_oXbees.sendNodeDrop(nodeKey, 8, 0); m_oXbees.setNodeDrop(nodeKey, 8, 0); } if(m_aAnims[nodeKey + ":9:Drop"].isAnimating()){ m_sliAllPin9 = 0; m_oXbees.sendNodeDrop(nodeKey, 9, m_pxDropDuration); m_oXbees.setNodeDrop(nodeKey, 9, m_pxDropDuration); }else{ m_oXbees.sendNodeDrop(nodeKey, 9, 0); m_oXbees.setNodeDrop(nodeKey, 9, 0); } m_oXbees.update(false, true); }