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


C++ ofRectangle::inside方法代码示例

本文整理汇总了C++中ofRectangle::inside方法的典型用法代码示例。如果您正苦于以下问题:C++ ofRectangle::inside方法的具体用法?C++ ofRectangle::inside怎么用?C++ ofRectangle::inside使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ofRectangle的用法示例。


在下文中一共展示了ofRectangle::inside方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mousePressed

    void mousePressed(int x, int y, int button) {
        x /= globalScale;
        y /= globalScale;

        canvas.mousePressed(x, y, button);
        side.mousePressed(x, y, button);
//        cout << btnHelpPos.distance(ofPoint(x,y)) << endl;
        if (btnHelpPos.distance(ofPoint(x,y))<btnHelp.width/2) showHelp();
        if (btnNew.hitTest(x,y)) { files.cur=-1; canvas.clear(); files.unloadFile(); }
        if (btnSave.hitTest(x,y)) files.save();
        if (btnLoadPrevious.hitTest(x,y)) files.loadPrevious();
        if (btnLoadNext.hitTest(x,y)) files.loadNext();
        if (btnPrint.hitTest(x,y)) print();
        if (btnStop.hitTest(x,y)) stop();
        if (btnOops.hitTest(x,y)) { btnOops.selected=true; }
        if (btnZoomIn.hitTest(x,y)) btnZoomIn.selected=true;
        if (btnZoomOut.hitTest(x,y)) btnZoomOut.selected=true;
        if (btnHigher.hitTest(x,y)) btnHigher.selected=true;
        if (btnLower.hitTest(x,y)) btnLower.selected=true;
        if (btnTwistLeft.hitTest(x,y)) btnTwistLeft.selected=true;
        if (btnTwistRight.hitTest(x,y)) btnTwistRight.selected=true;

        if (shapeButtons.inside(x,y)) {
            int index = ofNormalize(x,shapeButtons.x,shapeButtons.x+shapeButtons.width) * shapeString.size();
            side.setShape(shapeString.at(index));
        }
    }
开发者ID:Doodle3D,项目名称:Doodle3D,代码行数:27,代码来源:main.cpp

示例2: mouseMoved

    void mouseMoved(int x, int y) {
        x /= globalScale;
        y /= globalScale;

        if (shapeButtons.inside(x,y)) {
            previewShape = shapeString.at(ofNormalize(x,shapeButtons.x,shapeButtons.x+shapeButtons.width) * shapeString.size());
        } else {
            previewShape = 0;
        }
    }
开发者ID:Doodle3D,项目名称:Doodle3D,代码行数:10,代码来源:main.cpp

示例3:

vector<MeshPoint*> MeshHelper::getHit(const ofRectangle &test) const
{
	vector<MeshPoint*> ret;
	const vector<MeshPoint*> &points = target_->getPoints();
	for(auto &p : points) {
		if(test.inside(p->point())) {
			ret.push_back(p);
		}
	}
	return ret;
}
开发者ID:danielmorena,项目名称:ofxMeshWarp,代码行数:11,代码来源:ofxMeshWarpController.cpp

示例4: applyVectorField

void ofxParticleSystem::applyVectorField(float * field, int fieldWidth, int fieldHeight, int numComponents, ofRectangle areaOfInfluence, float force) {
    for(list<ofxParticle*>::iterator it = particles.begin(); it != particles.end(); it++){
        ofxParticle & p = (**it);
        ofVec2f pos(p.position.x,p.position.y);
        if(areaOfInfluence.inside(pos)){
            int x = (int)ofMap(pos.x, areaOfInfluence.getMinX(), areaOfInfluence.getMaxX(), 0, fieldWidth-1);
            int y = (int)ofMap(pos.y, areaOfInfluence.getMinY(), areaOfInfluence.getMaxY(), 0, fieldHeight-1);
            int index = (x+y*fieldWidth)*numComponents;
            ofVec2f dir(field[index],field[index+1]);
            dir.scale(force);
            //                                    cout << "(" << dir.x << "," << dir.y << ")\n";
            p.applyForce(dir);
        }
    }
}
开发者ID:ccabrales,项目名称:ZoneRush,代码行数:15,代码来源:ofxParticles.cpp


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