当前位置: 首页>>代码示例>>C++>>正文


C++ ofPtr::getReactions方法代码示例

本文整理汇总了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;
    }



}
开发者ID:kimon-satan,项目名称:clamourMedia,代码行数:34,代码来源:nodeManager.cpp

示例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

};
开发者ID:kimon-satan,项目名称:clamourMedia,代码行数:55,代码来源:zoneManager.cpp


注:本文中的ofPtr::getReactions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。