本文整理汇总了C++中ofPtr::getReactions方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPtr::getReactions方法的具体用法?C++ ofPtr::getReactions怎么用?C++ ofPtr::getReactions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofPtr
的用法示例。
在下文中一共展示了ofPtr::getReactions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: implementReactions
void nodeManager::implementReactions(ofPtr<clamourNode> n, ofPtr<clamourNode> tgt) {
vector<reaction> r = n->getReactions();
vector<reaction>::iterator it = r.begin();
while(it != r.end()) {
if(it->trig != "COLLIDE") {
++it;
continue;
}
if(it->floatParams.find("DELAY_SECS") != it->floatParams.end()) {
eventComm e;
int delFrames = it->floatParams["DELAY_SECS"] * ofGetFrameRate();
e.execAt = ofGetFrameNum() + delFrames;
if(it->intParams.find("ENV_INDEX") != it->intParams.end())e.eventIndex = it->intParams["ENV_INDEX"];
e.ownerIndex = tgt->getName();
e.r = *it;
mFutureEvents.push_back(e);
} else {
//implement immediately
implementReaction(*it, tgt);
}
++it;
}
}
示例2: implementReactions
void zoneManager::implementReactions(ofPtr<zone> z, bool isOn) {
vector<reaction> r = z->getReactions(); //TODO copy the reactions out and replace them at the end of this method
// ptrs don't work here
vector<reaction>::iterator it = r.begin();
while(it != r.end()) {
if((it->trig == "ON" && !isOn) ||
(it->trig == "OFF" && isOn)) {
++it;
continue;
}
bool isReverse = (it->trig == "ON_OFF" && !isOn);
vector<ofPtr<zone> > zt;
if(it->zTargets.size() == 0){
zt.push_back(z);
}else{
for(int i = 0; i < it->zTargets.size(); i++) {
if(mZones.find(it->zTargets[i]) != mZones.end())zt.push_back(mZones[it->zTargets[i]]);
}
}
for(int i = 0; i < zt.size(); i++) {
if(it->floatParams.find("DELAY_SECS") != it->floatParams.end()) {
//ON_OFF events not available for these
//very messy definitely needs reworking
eventComm e;
int delFrames = it->floatParams["DELAY_SECS"] * ofGetFrameRate();
e.execAt = ofGetFrameNum() + delFrames;
if(it->intParams.find("ENV_INDEX") != it->intParams.end())e.eventIndex = it->intParams["ENV_INDEX"];
e.ownerIndex = zt[i]->getName();
e.r = *it;
mFutureEvents.push_back(e);
}else{
//implement immediately
implementReaction(*it, zt[i], isReverse);
}
}
++it;
}
//z->setReactions(r); NOT CURRENTLY STORING DATA
};