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


C++ ofTrueTypeFont类代码示例

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


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

示例1: drawStringShadowed

	// ---------------------------------------------------------------------------------------
	//
	static void drawStringShadowed( ofTrueTypeFont& _font, string _s, float _x, float _y,
								   ofColor _frontColor = ofColor(255,255,255), ofColor _backColor = ofColor(0,0,0) )
	{
		ofSetColor( _backColor );
		_font.drawString( _s, _x + 1, _y + 1 );
		
		ofSetColor( _frontColor );
		_font.drawString( _s, _x, _y );
	}
开发者ID:andreasmuller,项目名称:ofxCL,代码行数:11,代码来源:ofApp.cpp

示例2: getFinalTarget

void gpuPictoChar::getFinalTarget(ofTrueTypeFont& font, float fontScale, float res, float rand, vector<float>& data){

    firstIndex = gpuPicto::totalPicto;
    
    charProps cp = font.getCharProps(c);
    
    float lineHeight = font.getLineHeight() * fontScale;
    float setWidth   = cp.setWidth * fontScale;
    //float height     = cp.height;
    //float topExtent  = cp.topExtent;
    //float width      = cp.width;
    //float leftExtent = cp.leftExtent;
    
    int pixW = setWidth;
    int pixH = lineHeight * 1.5;
    
//    printf("\n%c\nwidth= %0.1f\nsetWidth= %0.1f\nheight= %0.1f\ntopExtent= %0.1f\nleftExtent%0.1f\n",
//    c, w, fw, fh, te, le);
    
//    ofFbo * fbo = new ofFbo();
    {
        fbo.allocate(pixW, pixH);
        fbo.begin();
        ofFill();
        ofSetColor(0, 0, 0);
        ofRect(0, 0, pixW, pixH);
        ofSetColor(250, 0, 0);
        ofScale(fontScale, fontScale);
        font.drawStringAsShapes(ofToString(c), 0, lineHeight*1.2/fontScale);
        fbo.end();
    }
    
    ofPixels pix;
    ofTexture tex;
    pix.allocate(pixW, pixH, OF_PIXELS_RGBA);
    tex.allocate(pix);
    fbo.readToPixels(pix);
    tex.loadData(pix);
    
    int count = 0;
    for(int sy=res/2; sy<pixH; sy+=res){
        for(int sx=res/2; sx<pixW; sx+=res){
            ofColor col = pix.getColor(sx, sy);
            if(col.r > 50) {
                data.push_back(sx+ ofRandom(-rand, rand));
                data.push_back(sy+ ofRandom(-rand, rand));
                data.push_back(0);
                count++;
//                gpuPicto::totalPicto++;
            }
        }
    }
    
//    delete fbo;

    numPicto = count;
}
开发者ID:hiroMTB,项目名称:picto,代码行数:57,代码来源:gpuPictoChar.cpp

示例3: showHandCoord

void ofARoom::showHandCoord(double xr, double yr, double zr, double xl, double yl, double zl, ofTrueTypeFont	verdana14)
{
    ostringstream s;
    s<<"xr : "<<xr<<" yr : "<<yr<<" zr : "<<zr;
    ofSetColor(0, 0, 0);
    verdana14.drawString(s.str(), 20, 20);

    ostringstream s2;
    s2<<"xl : "<<xl<<" yl : "<<yl<<" zl : "<<zl;
    ofSetColor(0, 0, 0);
    verdana14.drawString(s2.str(), ofGetWidth()-300, 20);

}
开发者ID:ThierryTournier,项目名称:ofxAirDigital,代码行数:13,代码来源:ofARoom.cpp

示例4: draw

void simpleToggle::draw(ofTrueTypeFont &font){
    ofPushStyle();

    ofSetColor(guiColor);
    if (!isOn) {
        ofNoFill();
        ofSetColor(255, 255, 255);
        roundedRect(pos.x, pos.y, width, height,6);
       /* ofFill();
        ofSetColor(150, 150, 150,200);
        roundedRect(pos.x, pos.y, width, height,6);
        ofSetColor(100, 100, 100,200);
        roundedRect(pos.x, pos.y+(height*0.5), width, height*0.5,6);*/

    }
    else{
        ofNoFill();
        ofSetColor(255, 255, 255);
        int rounding = 2;
        roundedRect(pos.x, pos.y, width, height,6);
        ofFill();
        ofSetColor(255, 255, 255,200);
        roundedRect(pos.x, pos.y, width, height,6);
        ofSetColor(150, 150, 150,200);
        roundedRect(pos.x, pos.y+(height*0.5), width, height*0.5,6);
    }
    ofSetColor(255, 255, 255);
    font.drawString(name, pos.x+width+5, pos.y+height);
    ofPopStyle();
    //isOn=false;
}
开发者ID:tomschofield,项目名称:nullByMorse,代码行数:31,代码来源:simpleToggle.cpp

示例5: showMovementName

void ofARoom::showMovementName(string movementName,	ofTrueTypeFont	verdana14)
{
    if (movementName=="")
    {
        ofSetColor(245, 58, 135);
        verdana14.drawString("Dernier mouvement effectué : ", 20, ofGetHeight()-50);

    }
    else
    {

        ofSetColor(245, 58, 135);
        verdana14.drawString("Dernier mouvement effectué : "+movementName, 20, ofGetHeight()-50);
    }

}
开发者ID:ThierryTournier,项目名称:ofxAirDigital,代码行数:16,代码来源:ofARoom.cpp

示例6: defined

//------------------------------------------------------------------
ofTrueTypeFont::ofTrueTypeFont(const ofTrueTypeFont& mom)
:settings(mom.settings){
#if defined(TARGET_ANDROID)
	if(mom.isLoaded()){
		ofAddListener(ofxAndroidEvents().unloadGL,this,&ofTrueTypeFont::unloadTextures);
		ofAddListener(ofxAndroidEvents().reloadGL,this,&ofTrueTypeFont::reloadTextures);
	}
#endif
	bLoadedOk = mom.bLoadedOk;

	charOutlines = mom.charOutlines;
	charOutlinesNonVFlipped = mom.charOutlinesNonVFlipped;
	charOutlinesContour = mom.charOutlinesContour;
	charOutlinesNonVFlippedContour = mom.charOutlinesNonVFlippedContour;

	lineHeight = mom.lineHeight;
	ascenderHeight = mom.ascenderHeight;
	descenderHeight = mom.descenderHeight;
	glyphBBox = mom.glyphBBox;
	letterSpacing = mom.letterSpacing;
	spaceSize = mom.spaceSize;
	fontUnitScale = mom.fontUnitScale;

	cps = mom.cps; // properties for each character
	settings = mom.settings;
	glyphIndexMap = mom.glyphIndexMap;
	texAtlas = mom.texAtlas;
	face = mom.face;
}
开发者ID:ayafuji,项目名称:openFrameworks,代码行数:30,代码来源:ofTrueTypeFont.cpp

示例7: drawArgs

void drawArgs(ofTrueTypeFont font, vector<string> args) {
    string allArgs = "Args: ";
    for(string arg : args) {
        allArgs += arg;
        allArgs += "\n";
    }
    font.drawString(allArgs, GUTTER, TEXT_Y);
}
开发者ID:bmt,项目名称:photobooth,代码行数:8,代码来源:view.cpp

示例8: wrapString

//------------------------------------------------------------
string wrapString(string text, ofTrueTypeFont &ofttf_object, int width) {
	
	string typeWrapped = "";
	string tempString = "";
	vector <string> words = ofSplitString(text, " ");
	for(int i=0; i<words.size(); i++) {
		
		string wrd = words[i];
		//cout << wrd << endl;
		
		tempString += wrd + " ";
		int stringwidth = ofttf_object.stringWidth(tempString);
		if(stringwidth >= width) {
			tempString = "";
			typeWrapped += "\n";
		}
		
		typeWrapped += wrd + " ";
	}
	
	return typeWrapped;
	
}
开发者ID:thinkaxelthink,项目名称:Skirmish,代码行数:24,代码来源:GameUtils.cpp

示例9: draw

void BossBattle::draw( ofTrueTypeFont _font ) {
    _font.drawString( "This is not yet fully implemented. :(\nCheck back later.", iScaler * 8, iScaler * 4 );
}
开发者ID:jmatthewgriffis,项目名称:Thesis,代码行数:3,代码来源:BossBattle.cpp

示例10: setWord

void MovingFont::setWord(string keyword, ofTrueTypeFont& ttf) {
    vecTtf = ttf.getStringAsPoints(keyword);
    
    x = ofRandom(ofGetWidth());
    y = -50;
}
开发者ID:aquaring,项目名称:polylineStudy,代码行数:6,代码来源:MovingFont.cpp

示例11: drawMindsetStatus

void drawMindsetStatus(ofxThinkgearEventArgs& data){
    // ofPushStyle(); // fucking bug
    ofSetRectMode(OF_RECTMODE_CENTER);
    ofPushMatrix();
    ofTranslate(ofGetWidth() - 100, 100);
    ofFill();
    ofSetCircleResolution(100);
    ofSetColor(0, 0, 0, 128);
    ofCircle(0, 0, 52);
    // Show connection state
    switch (tgState){
        case NONE:
            ofSetColor(0, 0, 0);
            break;
        case CONNECTING:
            ofSetColor(200, 200, 0);
            break;
        case BAD_SIGNAL:
            ofSetColor(200, 0, 0);
            break;
        case READY:
            ofSetColor(0, 200, 0);
            break;
    }
    ofRect(0, 0, 10, 10);
    if (true || tgState == READY){
        // MindSet info pad
        ofSetColor(200, 200, 200);

        float w = smallFont.stringWidth(ofToString(data.raw));
        smallFont.drawString(ofToString(data.raw), -w/2, -38);

        ofSetColor(200+55*(medScore/200), 200, 200);
        ofCircle(20, -20, min(1.0, data.meditation/100.0) * 16);

        ofSetColor(200+55*(attScore/200), 200, 200);
        ofCircle(-20, -20, min(1.0, data.attention/100.0) * 16);

        ofSetColor(200, 200, 200);
        ofRect(40-15*eegData.midGamma.ratio, 0, 30*eegData.midGamma.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.lowGamma.ratio, 0, 30*eegData.lowGamma.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.highBeta.ratio, 0, 30*eegData.highBeta.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.lowBeta.ratio, 0, 30*eegData.lowBeta.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.highAlpha.ratio, 0, 30*eegData.highAlpha.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.lowAlpha.ratio, 0, 30*eegData.lowAlpha.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.theta.ratio, 0, 30*eegData.theta.ratio, 10);
        ofRotate(25.7, 0, 0, 1);
        ofRect(40-15*eegData.delta.ratio, 0, 30*eegData.delta.ratio, 10);
    }
    ofPopMatrix();
    // ofPopStyle(); // fucking bug
    ofSetRectMode(OF_RECTMODE_CORNER); // fucking bug
}
开发者ID:labe-me,项目名称:MindPaint,代码行数:59,代码来源:MindPaint.cpp

示例12: handleDefaultTextFont

 void handleDefaultTextFont(float size)
 {
     if( m_currentTextFont.isLoaded() == false )
     {
         m_currentTextFont.load("verdana.ttf", size, true, true);
     }
     else if( m_currentTextFont.getSize() != size)
     {
         m_currentTextFont.load("verdana.ttf", size, true, true);
     }
 }
开发者ID:JosephLaurino,项目名称:ofx-experiments,代码行数:11,代码来源:processing.cpp

示例13: drawString

void Graph::drawString(string text, int x, int y) const {
	ofPushStyle();
	ofFill();
	ofRectangle box = font.getStringBoundingBox(text, x, y);
	box.x -= 1;
	box.y -= 1;
	box.width += 2;
	box.height += 2;
	ofSetColor(noData ? 64 : 0);
	ofRect(box);
	ofSetColor(noData ? 192 : 255);
	font.drawString(text, x, y);
	ofPopStyle();
}
开发者ID:ofZach,项目名称:hwTTStoColor,代码行数:14,代码来源:Graph.cpp

示例14: setup

void MindPaint::setup(){
    smallFont.loadFont("Arial.ttf", 10);
    // ofSetBackgroundAuto(false); // disable auto clear, there's a bug there
    ofBackground(230, 220, 220, 255);
    ofEnableAlphaBlending();
    ofEnableSmoothing();
    ofSetFrameRate(FPS);
    //useMouse = false;
    tgState = NONE;
    appState = SELECT_BG;
    tg.addEventListener(this);
    brush = new EllipseBrush();
    screenshotCount = 0;
    back = RYBWheel::pick(backRybAngle);
    back = ofFloatColor(250, 250, 230);
    mood = RYBWheel::pick(backRybAngle - 0.5);
    mood.a = 0.4;
    attBonus = 0;
    attScore = 0;
    medBonus = 0;
    medScore = 0;
    score = 0;
    //setMoverController(new EvadeController());
    setMoverController(new SpiralController());
    tgEmu.setup();
    Buffer::init(buffer, ofColor(220,220,220,255));
}
开发者ID:labe-me,项目名称:MindPaint,代码行数:27,代码来源:MindPaint.cpp

示例15: draw

//--------------------------------------------------------------
void ofApp::draw()
{
	if (!foundSolution)
	{
		for (int i = 0; i < ArrayCount(population); i++)
		{
			population[i].Fitness();
		}

		vector<DNA> matingPool = vector<DNA>();
		for (int i = 0; i < ArrayCount(population); i++)
		{
			int n = int(population[i].fitness * ArrayCount(population));
			for (int k = 0; k < n; k++)
			{
				matingPool.push_back(population[i]);
			}
		}

		for (int i = 0; i < ArrayCount(population); i++)
		{
			int a = int(ofRandom(0, matingPool.size()));
			int b = int(ofRandom(0, matingPool.size()));

			DNA parentA = matingPool[a];
			DNA parentB = matingPool[b];

			DNA child = parentA.crossover(parentB);
			child.mutate();

			population[i] = child;
		}
	}

	ofClear(ofColor::white);

	ofSetColor(ofColor::black);
	for (int i = 0; i < ArrayCount(population); i++)
	{
		//string str = population[i].genes;
		population[i].genes[ArrayCount(population[i].genes)] = '\0';

		if (population[i].genes == target)
		{
			foundSolution = true;
			ofNoFill();
			ofSetLineWidth(6);
			ofSetCurveResolution(200);
			ofCircle(ofPoint((int(i / POPULATION_PER_COLUMN) * Y_SPACING) + 100, 
								((i % POPULATION_PER_COLUMN) * X_SPACING) + BUFFER_SPACING), 120);
		}
		

		myFont.drawString(population[i].genes, 
							(int(i / POPULATION_PER_COLUMN) * Y_SPACING) + BUFFER_SPACING, 
							((i % POPULATION_PER_COLUMN) * X_SPACING) + BUFFER_SPACING);

	}

}
开发者ID:Velro,项目名称:Nature-Of-Code-Projects,代码行数:61,代码来源:ofApp.cpp


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