本文整理汇总了C++中ofRectangle类的典型用法代码示例。如果您正苦于以下问题:C++ ofRectangle类的具体用法?C++ ofRectangle怎么用?C++ ofRectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ofRectangle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rectangle
// Temporary fix until OF 0.8.0
static void rectangle(ofPath & path, const ofRectangle & r){
path.moveTo(r.getTopLeft());
path.lineTo(r.getTopRight());
path.lineTo(r.getBottomRight());
path.lineTo(r.getBottomLeft());
path.close();
}
开发者ID:NickHardeman,项目名称:ofxBox2d,代码行数:8,代码来源:ofxBox2dRect.cpp
示例2: ofPushMatrix
void hlct::LivesDisplay::draw(const ofRectangle& stageRect, const int& livesLeft, const float& scale){
float iconW = full.getWidth() * scale;
float iconH = full.getHeight() * scale;
float rectW = stageRect.getWidth();
float rectH = stageRect.getHeight();
float rectX = rectW - iconW * totalLives;
float rectY = 0;
ofPushMatrix();
ofPushStyle();
ofTranslate(stageRect.getTopRight());
ofTranslate(-iconW * this->totalLives, -iconH / 2);
for (int i = 0; i < this->totalLives; i++){
ofPushMatrix();
ofTranslate(iconW * i, iconH/2);
if (i < livesLeft) {
ofSetColor(ofColor::white, 200);
full.draw(0, 0, iconW, iconH);
} else {
ofSetColor(ofColor::white, 200);
dead.draw(0, 0, iconW, iconH);
}
ofPopMatrix();
}
ofPopStyle();
ofPopMatrix();
}
开发者ID:serkansokmen,项目名称:hlct,代码行数:28,代码来源:LivesDisplay.cpp
示例3: rectangle
//----------------------------------------------------------
void ofPath::rectangle(const ofRectangle & r){
moveTo(r.getTopLeft());
lineTo(r.getTopRight());
lineTo(r.getBottomRight());
lineTo(r.getBottomLeft());
close();
}
开发者ID:6uclz1,项目名称:openFrameworks,代码行数:8,代码来源:ofPath.cpp
示例4: distributeHorz
void RectangleUtils::distributeHorz(RectanglePointers& rects,
const ofRectangle& boundingRect,
ofAlignHorz horzAnchor)
{
if(rects.size() >= 3 && horzAnchor != OF_ALIGN_HORZ_IGNORE) {
sortByHorzAnchor(rects,horzAnchor);
float nPos = rects.size() - 1;
// adjust to bounding bounding rect. if bounding rect is based on the group, nothing will change
rects[0]->translateX(boundingRect.getLeft() - rects[0]->getLeft());
rects[nPos]->translateX(boundingRect.getRight() - rects[nPos]->getRight());
float leftX = rects[0]->getHorzAnchor(horzAnchor);
float rightX = rects[nPos]->getHorzAnchor(horzAnchor);
float span = ( rightX - leftX ) / ( nPos );
for(size_t i = 1; i < nPos; i++) {
rects[i]->translateX((leftX - rects[i]->getHorzAnchor(horzAnchor)) + i * span);
}
} else {
if(horzAnchor == OF_ALIGN_HORZ_IGNORE) {
ofLogVerbose("ofDistributeHorizontal") << "OF_ALIGN_HORZ_IGNORE distribute requested, ignoring.";
} else {
ofLogWarning("ofDistributeHorizontal") << "Not enough rectangles to distribute.";
}
}
}
开发者ID:local-projects,项目名称:ofxRectangleUtils,代码行数:30,代码来源:ofxRectangleUtils.cpp
示例5: tensionEffect
void yeseulCooperMessages::tensionEffect(ofRectangle rec1, ofRectangle rec2) {
if (abs((dimensions.width/2+margin-redMove*1.1 - (0-dimensions.width/2-rec1.getWidth()-margin+redMove*1.6))) < rec1.getWidth()) {
redMove+=redTextSpeed/7;
}
else {
redMove+=redTextSpeed;
}
if (abs((dimensions.width/2+margin-greenMove) - (0-dimensions.width/2-rec1.getWidth()-margin+greenMove)) < rec1.getWidth()) {
greenMove+=greenTextSpeed/6;
}
else {
greenMove+=greenTextSpeed;
}
if (abs((0-dimensions.width/2-margin-rec1.getWidth()+purpleMove*1.7) - (dimensions.width/2+margin-150-purpleMove*1.4)) < rec1.getWidth()) {
purpleMove+=purpleTextSpeed/6;
}
else {
purpleMove+=purpleTextSpeed;
}
resetPosition();
}
开发者ID:decebel,项目名称:dayForNightSFPC,代码行数:26,代码来源:yeseulCooperMessages.cpp
示例6: R0
void DrawGame::drawScaledStringByFont(
string Txt,
ofTrueTypeFont* pFont,
ofRectangle Rect )
{
// debug
float sh = pFont->stringHeight(Txt);
float sw = pFont->stringWidth(Txt);
ofRectangle R0(0,0,sw,-sh);
ofVec2f Trans = Rect.getCenter()-R0.getCenter();
float sx,sy;
sx = Rect.getWidth()/R0.getWidth();
sy = -Rect.getHeight()/R0.getHeight();
ofMatrix4x4 Mat;
Mat.translate(-R0.getCenter());
Mat.scale(sx,sy,1.0f);
// Mat.translate(Rect.getCenter()/ofVec2f(sx,sy));
Mat.translate(Rect.getCenter());
ofMultMatrix(Mat);
pFont->drawString(Txt,0,0);
ofMatrix4x4 MatI;
MatI = Mat.getInverse();
ofMultMatrix(MatI);
}
开发者ID:magicbrush,项目名称:DrawGame,代码行数:28,代码来源:DrawGameUtils.cpp
示例7: distributeVert
void RectangleUtils::distributeVert(RectanglePointers& rects,
const ofRectangle& boundingRect,
ofAlignVert vertAnchor)
{
if(rects.size() >= 3 && vertAnchor != OF_ALIGN_VERT_IGNORE) {
sortByVertAnchor(rects,vertAnchor);
float nPos = rects.size() - 1;
// adjust to bounding bounding rect. if bounding rect is based on the group, nothing will change
rects[0]->translateY(boundingRect.getTop() - rects[0]->getTop());
rects[nPos]->translateY(boundingRect.getBottom() - rects[nPos]->getBottom());
float topY = rects[0]->getVertAnchor(vertAnchor);
float bottomY = rects[nPos]->getVertAnchor(vertAnchor);
float span = ( bottomY - topY ) / ( nPos );
for(size_t i = 1; i < nPos; i++) {
rects[i]->translateY((topY - rects[i]->getVertAnchor(vertAnchor)) + i * span);
}
} else {
if(vertAnchor == OF_ALIGN_VERT_IGNORE) {
ofLogVerbose("ofDistributeVertical") << "OF_ALIGN_VERT_IGNORE distribute requested, ignoring.";
} else {
ofLogWarning("ofDistributeVertical") << "Not enough rectangles to distribute.";
}
}
}
开发者ID:local-projects,项目名称:ofxRectangleUtils,代码行数:27,代码来源:ofxRectangleUtils.cpp
示例8: drawBrakets
void Dimentions::drawBrakets(ofRectangle _rect, float size, float margin){
ofPushStyle();
ofSetLineWidth(2);
ofPushMatrix();
ofTranslate(_rect.getTopLeft() + ofPoint(-margin,-margin));
ofLine(0, 0, size, 0);
ofLine(0, 0, 0, size);
ofPopMatrix();
ofPushMatrix();
ofTranslate(_rect.getTopRight() + ofPoint(margin,-margin));
ofLine(0, 0, -size, 0);
ofLine(0, 0, 0, size);
ofPopMatrix();
ofPushMatrix();
ofTranslate(_rect.getBottomLeft() + ofPoint(-margin,margin));
ofLine(0, 0, size, 0);
ofLine(0, 0, 0, -size);
ofPopMatrix();
ofPushMatrix();
ofTranslate(_rect.getBottomRight() + ofPoint(margin,margin));
ofLine(0, 0, -size, 0);
ofLine(0, 0, 0, -size);
ofPopMatrix();
ofPopStyle();
}
开发者ID:patriciogonzalezvivo,项目名称:ColumbiaLibrary,代码行数:31,代码来源:Dimentions.cpp
示例9: setSensorCrop
OMX_ERRORTYPE ofxRPiCameraVideoGrabber::setSensorCrop(ofRectangle& rectangle)
{
sensorCropConfig.xLeft = ((uint32_t)rectangle.getLeft() << 16)/100;
sensorCropConfig.xTop = ((uint32_t)rectangle.getTop() << 16)/100;
sensorCropConfig.xWidth = ((uint32_t)rectangle.getWidth() << 16)/100;
sensorCropConfig.xHeight = ((uint32_t)rectangle.getHeight() << 16)/100;
OMX_ERRORTYPE error = OMX_SetConfig(camera, OMX_IndexConfigInputCropPercentages, &sensorCropConfig);
OMX_TRACE(error);
if(error != OMX_ErrorNone)
{
ofLogError(__func__) << omxErrorToString(error);
if(error == OMX_ErrorBadParameter)
{
ofLogWarning(__func__) << "resetting cropRectangle to known good params (0, 0, 100, 100)";
cropRectangle.set(0, 0, 100, 100);
return updateSensorCrop();
}
}
return error;
}
开发者ID:AazibSafi,项目名称:ofxRPiCameraVideoGrabber,代码行数:25,代码来源:ofxRPiCameraVideoGrabber.cpp
示例10: ofVec4f
//----------
ofRectangle operator*(const ofRectangle & rectangle, const ofMatrix4x4 & transform) {
auto topLeft = rectangle.getTopLeft();
auto scale = ofVec4f(rectangle.getWidth(), rectangle.getHeight(), 0.0f, 0.0f); // w = 0 so no translate
topLeft = topLeft * transform;
scale = scale * transform;
return ofRectangle(topLeft.x, topLeft.y, scale.x, scale.y);
}
开发者ID:AbdelghaniDr,项目名称:ofxCvGui,代码行数:8,代码来源:Utils.cpp
示例11: drawVertAlignMark
//--------------------------------------------------------------
void testApp::drawVertAlignMark(const ofRectangle& rect, const ofColor& color, ofAlignVert vAlign) {
if(vAlign != OF_ALIGN_VERT_IGNORE) {
float vAnchor = rect.getVertAnchor(vAlign);
ofSetColor(color,120);
ofLine(rect.getLeft() - 13, vAnchor, rect.getLeft() - 3, vAnchor);
ofLine(rect.getRight() + 13, vAnchor, rect.getRight() + 3, vAnchor);
}
}
开发者ID:3snail,项目名称:openFrameworks,代码行数:9,代码来源:testApp.cpp
示例12: drawHorzAlignMark
//--------------------------------------------------------------
void testApp::drawHorzAlignMark(const ofRectangle& rect, const ofColor& color, ofAlignHorz hAlign) {
if(hAlign != OF_ALIGN_HORZ_IGNORE) {
float hAnchor = rect.getHorzAnchor(hAlign);
ofSetColor(color,120);
ofLine(hAnchor, rect.getTop() - 13, hAnchor, rect.getTop() - 3);
ofLine(hAnchor, rect.getBottom() + 13, hAnchor, rect.getBottom() + 3);
}
}
开发者ID:3snail,项目名称:openFrameworks,代码行数:9,代码来源:testApp.cpp
示例13: ofNoFill
void hlct::Game::drawLoadingBar(const ofRectangle& rect, const float& width){
ofNoFill();
ofDrawRectangle(rect);
ofFill();
ofDrawRectangle(rect.getTopLeft(),
rect.getWidth()*width,
rect.getHeight());
}
开发者ID:serkansokmen,项目名称:hlct,代码行数:8,代码来源:Game.cpp
示例14: growToInclude
//----------------------------------------------------------
void ofRectangle::growToInclude(const ofRectangle& rect){
float x0 = MIN(getMinX(),rect.getMinX());
float x1 = MAX(getMaxX(),rect.getMaxX());
float y0 = MIN(getMinY(),rect.getMinY());
float y1 = MAX(getMaxY(),rect.getMaxY());
float w = x1 - x0;
float h = y1 - y0;
set(x0,y0,w,h);
}
开发者ID:Tukamotosan,项目名称:openFrameworks,代码行数:10,代码来源:ofRectangle.cpp
示例15: setKinectROI
void KinectGrabber::setKinectROI(ofRectangle ROI){
minX = static_cast<int>(ROI.getMinX());
maxX = static_cast<int>(ROI.getMaxX());
minY = static_cast<int>(ROI.getMinY());
maxY = static_cast<int>(ROI.getMaxY());
ROIwidth = maxX-minX;
ROIheight = maxY-minY;
resetBuffers();
}
开发者ID:Harrisandwich,项目名称:Magic-Sand,代码行数:9,代码来源:KinectGrabber.cpp
示例16: center
//--------------------------------------------------------------
void center(const ofRectangle& rect, int angle) {
if (angle % 2 == 0) {
ofTranslate(ofGetWidth() * 0.5f - rect.getWidth() * 0.5f,
ofGetHeight() * 0.5f - rect.getHeight() * 0.5f);
}
else {
ofTranslate(ofGetWidth() * 0.5f - rect.getHeight() * 0.5f,
ofGetHeight() * 0.5f - rect.getWidth() * 0.5f);
}
}
开发者ID:ragnaringi,项目名称:Periscope,代码行数:11,代码来源:Input.cpp
示例17: toClipper
ClipperLib::IntRect Clipper::toClipper(const ofRectangle& rectangle,
ClipperLib::cInt scale)
{
ClipperLib::IntRect rect;
rect.left = rectangle.getLeft() * scale;
rect.right = rectangle.getRight() * scale;
rect.top = rectangle.getTop() * scale;
rect.bottom = rectangle.getBottom() * scale;
return rect;
}
开发者ID:bakercp,项目名称:ofxClipper,代码行数:10,代码来源:Clipper.cpp
示例18: animateText
void yeseulCooperMessages::animateText(ofRectangle rec1, ofRectangle rec2) {
ofRotate(315+rotation);
ofSetColor(ofColor::fromHsb(7, 255, 100));
ofFill();
for (int n = 0; n < 3; n++) {
font.drawStringAsShapes(text1, dimensions.width/2+margin-redMove*1.2, -rec1.getHeight());
font.drawStringAsShapes(text2, dimensions.width/2+margin-redMove*1.1, 0);
font.drawStringAsShapes(text1, 0-dimensions.width/2-rec1.getWidth()-margin+redMove*1.6, rec1.getHeight());
font.drawStringAsShapes(text2, 0-dimensions.width/2-rec2.getWidth()-margin-50+redMove*1.4, rec2.getHeight()*2);
}
ofRotate(90);
ofSetColor(ofColor::fromHsb(90, 255, 20));
ofFill();
for (int n = 0; n < 3; n++) {
font.drawStringAsShapes(text1, dimensions.width/2+margin-greenMove, -rec1.getHeight());
font.drawStringAsShapes(text2, dimensions.width/2+margin-greenMove, 0);
font.drawStringAsShapes(text1, 0-dimensions.width/2-rec1.getWidth()-margin+greenMove, rec1.getHeight());
font.drawStringAsShapes(text2, 0-dimensions.width/2-rec2.getWidth()-margin+greenMove, rec2.getHeight()*2);
}
ofRotate(90);
ofSetColor(ofColor::fromHsb(200, 255, 20));
ofFill();
for (int n = 0; n < 3; n++) {
font.drawStringAsShapes(text1, 0-dimensions.width/2-margin-rec1.getWidth()-150+purpleMove*1.7, rec1.getHeight());
font.drawStringAsShapes(text2, 0-dimensions.width/2-margin-rec2.getWidth()-150+purpleMove*1.5, rec2.getHeight()*2);
font.drawStringAsShapes(text1, dimensions.width/2+margin-purpleMove-70, -rec1.getHeight());
font.drawStringAsShapes(text2, dimensions.width/2+margin-purpleMove*1.4, 0); //
}
}
开发者ID:decebel,项目名称:dayForNightSFPC,代码行数:33,代码来源:yeseulCooperMessages.cpp
示例19: pbPushRect
//--------------------------------------------------------------
void pbPushRect( const ofPoint &p1, const ofPoint &p2, const ofPoint &p3, const ofPoint &p4,
const ofRectangle &texRect,
vector<ofPoint> &points, vector<ofVec2f> &texs ) {
points.push_back( p1 );
points.push_back( p2 );
points.push_back( p3 );
points.push_back( p4 );
texs.push_back( texRect.getTopLeft() );
texs.push_back( texRect.getTopRight() );
texs.push_back( texRect.getBottomRight() );
texs.push_back( texRect.getBottomLeft() );
}
开发者ID:kuflex,项目名称:KuStudio,代码行数:14,代码来源:pbGraphicUtils.cpp
示例20: ofRectangleTransform
ofRectangle ofRectangleTransform(const ofRectangle & rect, const ofMatrix4x4 & mat) {
ofVec3f tl = rect.getTopLeft();
ofVec3f br = rect.getBottomRight();
tl = mat.preMult(tl);
br = mat.preMult(br);
ofRectangle r;
r.setPosition(tl);
r.growToInclude(br);
return r;
}
开发者ID:julapy,项目名称:ofxJulapyUtils,代码行数:13,代码来源:ofxJulapyUtils.cpp
注:本文中的ofRectangle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论