void CCTouchInjector::cleanup() { if (m_Enabled) { CCTouchDispatcher* td = CCTouchDispatcher::sharedDispatcher(); td->injectTouches(m_Touches, CCTOUCHCANCELLED); td->unholdUserTouch(); m_Enabled = false; } setEnabled(false); CCNode::cleanup(); }
void CCTouchInjector::setEnabled(bool flag) { if (m_Enabled == flag) return; CCTouchDispatcher* td = CCTouchDispatcher::sharedDispatcher(); if (flag) { td->holdUserTouch(); td->injectTouches(m_Touches, CCTOUCHBEGAN); } else { td->injectTouches(m_Touches, CCTOUCHENDED); td->unholdUserTouch(); } }