void InputLabel::editBoxEditingDidBegin(ui::EditBox* editBox) { if(locks.size() > 0) { closeKeyboard(EventCustom::create("CloseKeyboard", DcreateP(Icreate(this->getID()), Screate("Sender"), NULL))); return; } if(!isOpened && delegate->isEnabled()) { isOpened = true; Director::getInstance()->getEventDispatcher()->dispatchCustomEvent("InputLabelBeginEdit", DcreateP(Icreate(identifier), Screate("Sender"), NULL)); } }
void SelectionRecognizer::checkForSelection(CCObject* obj) { CCTouch* touch = (CCTouch*)obj; //the touch could have been discarded in the meantime if(isTouchInSelection(touch)) { CCPoint currentLocation = Scene::touchPosition(touch); CCPoint touchOrigin = TOPOINT(storedTouches->objectForKey(touch->getID())); CCObject* target = mainLinker->linkedObjectOf(touch); if(ccpDistance(Scene::touchPosition(touch), touchOrigin) <= maxMovement) { CCNotificationCenter::sharedNotificationCenter()->postNotification("SelectionRecognized", DcreateP(touch, Screate("Touch"), target, Screate("Target"), NULL)); } else { CCNotificationCenter::sharedNotificationCenter()->postNotification("SelectionCanceled", DcreateP(touch, Screate("Touch"), storedTouches->objectForKey(touch->getID()), Screate("Origin"), target, Screate("Target"), NULL)); } storedTouches->removeObjectForKey(touch->getID()); } }
void SelectionRecognizer::cancelSelectionForTouch(CCTouch* touch) { if(isTouchInSelection(touch)) { CCNotificationCenter::sharedNotificationCenter()->postNotification("SelectionCanceled", DcreateP(touch, Screate("Touch"), storedTouches->objectForKey(touch->getID()), Screate("Origin"), NULL)); storedTouches->removeObjectForKey(touch->getID()); } }
void SelectionRecognizer::ccTouchMoved(CCTouch *touch, CCEvent *pEvent) { if(isTouchInSelection(touch)) { CCPoint touchOrigin = TOPOINT(storedTouches->objectForKey(touch->getID())); if(ccpDistance(Scene::touchPosition(touch), touchOrigin) > maxMovement) { cancelSelectionForTouch(touch); } else { CCNotificationCenter::sharedNotificationCenter()->postNotification("SelectionMoved", DcreateP(touch, Screate("Touch"), NULL)); } } }
bool SelectionRecognizer::ccTouchBegan(CCTouch *touch, CCEvent *pEvent) { storedTouches->setObject(Pcreate(Scene::touchPosition(touch)), touch->getID()); performSelectorAfterDelay(this, callfuncO_selector(SelectionRecognizer::checkForSelection), duration, touch); CCNotificationCenter::sharedNotificationCenter()->postNotification("SelectionStarted", DcreateP(touch, Screate("Touch"), NULL)); return true; }
void notifyLicenseStatusNative(bool authorized) { LOGD("Notifying license status : %s", authorized ? "Authorized" : "Locked"); DelayedDispatcher::eventAfterDelay("LicenseStatusUpdate", DcreateP(Bcreate(authorized), Screate("Authorized"), NULL), 0.01); }
void notifyInAppEventNative(std::string name, std::string argument) { LOGD("Notifying in app event : %s", name.c_str()); DelayedDispatcher::eventAfterDelay(name, DcreateP(Screate(argument), Screate("ProductID"), NULL), 0.01); }