void ofxUISuperCanvas::onMousePressed(ofMouseEventArgs& data) { if(rect->inside(data.x, data.y) && didHitHeaderWidgets(data.x, data.y)) { bTitleLabelHit = true; hitPoint.set(data.x - rect->getX(), data.y - rect->getY()); if((ofGetElapsedTimef() - lastHitTime) < deltaTime) { if(isMinified()) { setMinified(false); if(getTriggerType() & OFX_UI_TRIGGER_BEGIN) { triggerEvent(this); } } else { setMinified(true); if(getTriggerType() & OFX_UI_TRIGGER_END) { triggerEvent(this); } } return; } lastHitTime = ofGetElapsedTimef(); } mousePressed(data.x, data.y, data.button); }
void ofxUISuperCanvas::keyReleased(int key) { if(getIsBindedToKey(key) && bKeyHit) { bKeyHit = false; if((ofGetElapsedTimef() - lastHitTime) < deltaTime) { setMinified(false); lastPosition = ofxUIVec2f(ofGetMouseX(), ofGetMouseY()); if(getTriggerType() & OFX_UI_TRIGGER_BEGIN) { triggerEvent(this); } } else { setMinified(true); rect->setX(lastPosition.x); rect->setY(lastPosition.y); if(getTriggerType() & OFX_UI_TRIGGER_END) { triggerEvent(this); } } lastHitTime = ofGetElapsedTimef(); } ofxUICanvas::keyReleased(key); }
std::string TriggerSpellOnItem::getTooltipText() const { std::string toReturn = "chance to cast "; toReturn.append( getSpellToTrigger()->getName() ); if( getCastOnSelf() == true ) { toReturn.append( " on yourself when " ); } else { toReturn.append( " on your target when " ); } if( getTriggerType() == TriggerType::EXECUTING_ACTION ) { toReturn.append( "casting spells." ); } else if( getTriggerType() == TriggerType::TAKING_DAMAGE ) { toReturn.append( "taking damage." ); } return toReturn; }
void ofxUISuperCanvas::touchDoubleTap(float x, float y, int id) { if(rect->inside(x, y) && didHitHeaderWidgets(x, y)) { if(isMinified()) { setMinified(false); if(getTriggerType() & OFX_UI_TRIGGER_BEGIN) { triggerEvent(this); } } else { setMinified(true); if(getTriggerType() & OFX_UI_TRIGGER_END) { triggerEvent(this); } } return; } canvasTouchDoubleTap(x, y, id); }
void ofxUISuperCanvas::keyPressed(int key) { if(getIsBindedToKey(key) && !bKeyHit) { bKeyHit = true; lastPosition = ofxUIVec2f(rect->getX(), rect->getY()); setMinified(false); rect->setX(ofGetMouseX()); rect->setY(ofGetMouseY()); if(getTriggerType() & OFX_UI_TRIGGER_BEGIN) { triggerEvent(this); } } ofxUICanvas::keyPressed(key); }