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


C++ ofTrueTypeFont::drawString方法代码示例

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


在下文中一共展示了ofTrueTypeFont::drawString方法的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: 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

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

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

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

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

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

	void draw() {
		ofPushStyle();
		ofSetColor(255, 128);
		if(messages.size()) {
			font.drawString(joined.str(), 10, 20);
		}
		ofPopStyle();
	}
开发者ID:I33N,项目名称:ofxSick,代码行数:8,代码来源:testApp.cpp

示例9: drawStimulus

void drawStimulus(string letter, bool showInstructions) {
	ofBackground(backgroundColor);
	ofSetColor(textColor);
	Draw::centeredString(Disp.getCenter(), letter, bigFont);

	if (showInstructions) {
		smallFont.drawString(keyReminderInstructions, 30, Disp.getResolution().y - 30);
	}
}
开发者ID:hardmanko,项目名称:ofxCX,代码行数:9,代码来源:advancedNBack.cpp

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

示例11: draw

void ofApp::draw(){

	font.drawString(appInfo, 2, 12);	
	drawTrunk(frameNumber, rotationAngle);
}
开发者ID:IlyaMelnix,项目名称:fractalTree,代码行数:5,代码来源:ofApp.cpp

示例12: draw

//------------------------------------------------------------------
void uiPresent::draw(ofTrueTypeFont& basicFont) {

    sprintf (timeString, "time: %0.2i:%0.2i:%0.2i \nelapsed time %i", ofGetHours(), ofGetMinutes(), ofGetSeconds(), ofGetElapsedTimeMillis());
	
    ofSetHexColor(0x000000);
	basicFont.drawString(timeString, 10,ofGetHeight()-90);
	basicFont.drawString(eventString, 10,ofGetHeight()-20);
    
    ofEnableAlphaBlending();
    
    ofSetColor(170, 170, 170);
    ofRect(*pencilBox);
    ofRect(*fontBox);
    ofRect(*tableBox);
    ofRect(*okSaveBox);
    
    ofSetHexColor(0x000000);

    pencil->draw(10, 310);
    font->draw(10, 355);
    table->draw(10, 400);
    okSave->draw(10, 445);

    if (*fontSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        basicFont.drawString("text selected", 10, ofGetHeight()/3);
        
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }

    }
    
    if (*pencilSelected) {

        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        basicFont.drawString("pencil selected", 10, ofGetHeight()/3);
        
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }
        
        if (currentDrawing.size()>0) {
            for (int i = 1; i < currentDrawing.size(); i++) {
                ofLine(currentDrawing[i-1].x, currentDrawing[i-1].y, currentDrawing[i].x, currentDrawing[i].y);
            }
        }
    }
    
    if (*tableSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }
        basicFont.drawString("table selected", 10, ofGetHeight()/3);
    }

    if (*okSaveSelected) {
        basicFont.drawString(theText, 40, 40);
        thisText->draw(basicFont);
        for (int i = 0; i < drawThese.size(); i++) {
            drawThese[i].draw();
        }

        basicFont.drawString("ok save selected", 10, ofGetHeight()/3);
    }

    
    ofDisableAlphaBlending();

}
开发者ID:rjraffa,项目名称:wordProblematator,代码行数:75,代码来源:uiPresent.cpp

示例13: draw

void Player::draw( ofTrueTypeFont _font, vector< Object > _recordedList ) {
    
    // We want to do something when the vector is empty, but not during the action that empties it, so we use a boolean that activates only after that last action is complete.
    if ( _recordedList.size() > 0 ) {
        bIsEmpty = false;
    } else if ( !bIsActing ) {
        bIsEmpty = true;
    }
    // We want to do something when the vector is full, but not during the action that fills it, so we use a boolean that activates only after that last action is complete.
    if ( _recordedList.size() < capacity ) {
        bIsFull = false;
    } else if ( !bIsActing ) {
        bIsFull = true;
    }
    
    // Display an outline of the next replayable note (drawn from the center).
    if ( _recordedList.size() > 0 ) {
        
        ofSetRectMode( OF_RECTMODE_CENTER );
        ofNoFill();
        ofRect( pos.x, _recordedList[ 0 ].pos.y, _recordedList[ 0 ].wide, _recordedList[ 0 ].tall );
        ofFill();
    }
    
    // Draw the player.
    ofSetRectMode( OF_RECTMODE_CENTER );
    ofSetColor( 0 );
    //ofRect( pos, wide, tall );
    
    // Draw the health. Taken from my Space Odyssey 2 code.
    ofPushMatrix();{
        
        ofTranslate( pos.x, pos.y);
        
        
        { // Matt
            // Draw the health bar
            ofSetRectMode( OF_RECTMODE_CORNER );
            float offset = 1;
            float offsetBar = 10;
            float barHeight = 10;
            float barLength = wide * 2;
            float currentHealth = ofMap( fHealth, 0, fHealthMax, 0, barLength - offset * 2 );
            // The border.
            ofSetColor( 255 );
            ofNoFill();
            ofRect( -wide, wide / 2 + offsetBar, barLength, barHeight );
            ofFill();
            // The current health.
            ofSetColor( 0, 255, 0 );
            ofRect( -wide + offset, wide / 2 + offsetBar + offset, currentHealth, barHeight - offset * 2 );
        } // End Matt
         
        
    }ofPopMatrix();
    
    ofSetColor( 255 );
    ofSetRectMode( OF_RECTMODE_CORNER );
    //headphones.draw( pos, 50, 50 );
    hand.draw( pos.x - wide / 2, pos.y - tall / 2, wide, tall );
    
    // Display a visual indicator of recorded capacity.
    if ( _recordedList.size() > 1 ) {
        for ( int i = 0; i < _recordedList.size(); i++ ) {
            float rad, tmpPosX, tmpPosY, hOffset, vOffset;
            rad = 3;
            //hOffset = ( wide - ( rad * 3 ) ) / 4;
            hOffset = wide / 4;
            vOffset = tall / 4;
            if ( i < 3 ) {
                tmpPosX = pos.x - wide / 2 + hOffset + hOffset * i;
                tmpPosY = pos.y - tall / 2 + vOffset;
            } else if ( i >= 3 && i < 6 ) {
                tmpPosX = pos.x - wide / 2 + hOffset + hOffset * ( i - 3 );
                tmpPosY = pos.y - tall / 2 + vOffset * 2;
            } else if ( i >= 6 && i < 9 ) {
                tmpPosX = pos.x - wide / 2 + hOffset + hOffset * ( i - 6 );
                tmpPosY = pos.y - tall / 2 + vOffset * 3;
            }
            ofNoFill();
            ofSetColor( 255 );
            ofCircle( tmpPosX, tmpPosY, rad );
            ofFill();
        }
    }
    
    // Draw the action if called, orbiting around the player's pos.
    if ( bIsActing ) {
        if ( bIsRecording ) {
            // Feedback for no capacity.
            if ( bIsFull ) {
                ofSetColor( 0 );
                _font.drawString("X", pos.x + 30, pos.y - 30 );
            }
            ofSetColor( 0, 255, 0 );
        }
        else if ( bIsReplaying ) {
            // Feedback for nothing to replay.
            if ( bIsEmpty ) {
                ofSetColor( 0 );
//.........这里部分代码省略.........
开发者ID:jmatthewgriffis,项目名称:Thesis,代码行数:101,代码来源:Player.cpp

示例14:

void PMSc10Thanks::drawLeftAlignString(ofTrueTypeFont &font, string s, int x, int y)
{
    int halfStringHeight = font.stringHeight(s) / 2;
    font.drawString(s, x, y + halfStringHeight);
}
开发者ID:xavibove,项目名称:Cancons-Visuals,代码行数:5,代码来源:PMSc10Thanks.cpp

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


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