//-------------------------------------------------------------------------------- void ofxTLUIHeader::onButtonEvent(ofxDatGuiButtonEvent e) { // we have a couple ways to figure out which button was clicked // // we can compare our button pointer to the target of the event // // if (e.target == guiTrackName) // { // // // } // else // or we can check against the label of the event target // cout << "ofxTLUIHeader :: button event from : " << e.target->getLabel() <<endl; if(e.target == guiTrackName) { string newTrackName = ofSystemTextBoxDialog("Track name ?"); if(newTrackName!="") { guiTrackName->setLabel(newTrackName); getTrack()->setDisplayName(newTrackName); } } if (e.target->getLabel() == "OSC OUT") { modified = true; } else if(e.target->getLabel() == "OSC IN") { modified = true; } else if(e.target->getLabel() == "PLAY SOLO") { //if(e.target->getEnabled()) { cout << "PLAY SOLO PRESSED" << endl; modified = true; getTrack()->togglePlay(); } } else if(e.target->getLabel() == "DELETE") { setShouldDelete(true); modified = true; } else if(e.target->getLabel()=="OSC ADDRESS ::") { cout << "TLUHeader:: OSC Folder Event"; string add = ofSystemTextBoxDialog("OSC address ?"); if(add!="") guiOscAddressLabel->setLabel(add); } }
void Explosion::think(const double elapsedTime) { //Run entity think routines. Entity::think(elapsedTime); //Check if Explosion lifetime is over. if(mLifeTimer.getElapsedTime() > 1000) setShouldDelete(true); }
XFStaticEvent::XFStaticEvent(int id, IXFReactive * pBehavior) : IXFEvent(IXFEvent::Event, id, pBehavior) { // Clear the shouldDelete flag in the _eventStatus attribute. setShouldDelete(false); }
void Grenade::think(const double elapsedTime) { //Run entity think routines. Entity::think(elapsedTime); //Check if Grenade lifetime is over. if(mLifeTimer.getElapsedTime() > ttl) { game->getEntityManager()->add(New Explosion(mPosition,3.0f)); setShouldDelete(true); } mVelocity.Y -= 0.001; if(mPosition.Y < -1.f) { mVelocity.Y = -mVelocity.Y; mVelocity.Y *= GRENADE_DAMPING; //if(abs(mVelocity.Y) > 0.01f) //game->getSoundEngine()->play3DSound(game->getResourceManager()->get("squishsound"), mPosition, 3.0, randomFloat(0.75,1.25)); if(rotator < 0) { rotator += 5; if(rotator > 0) { rotator = 0; } } else if(rotator > 0) { rotator -= 5; if(rotator < 0) rotator = 0; } game->getSoundEngine()->play3DSound(game->getResourceManager()->get("grenade_clink"), mPosition, 0.8f, randomFloat(0.75,1.25)); } if(game->getCurrentMap()->getTile(int(mPosition.X + mVelocity.X), int(mPosition.Z)).type == TYPE_WALL) { mVelocity.X = -mVelocity.X; mVelocity *= GRENADE_DAMPING; game->getSoundEngine()->play3DSound(game->getResourceManager()->get("grenade_clink"), mPosition, 0.8f, randomFloat(0.75,1.25)); } if(game->getCurrentMap()->getTile(int(mPosition.X), int(mPosition.Z + mVelocity.Z)).type == TYPE_WALL) { mVelocity.Z = -mVelocity.Z; mVelocity *= GRENADE_DAMPING; game->getSoundEngine()->play3DSound(game->getResourceManager()->get("grenade_clink"), mPosition, 0.8f, randomFloat(0.75,1.25)); } //Add velocity to current position. mPosition += mVelocity; mpAnim->setRotation(mpAnim->getRotation() + rotator); if(mVoice) mVoice->setPosition(mPosition); }