本文整理汇总了C++中ofTrueTypeFont类的典型用法代码示例。如果您正苦于以下问题:C++ ofTrueTypeFont类的具体用法?C++ ofTrueTypeFont怎么用?C++ ofTrueTypeFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ofTrueTypeFont类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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:
void PMSc10Thanks::drawRightAlignString(ofTrueTypeFont &font, string s, int x, int y)
{
int halfStringHeight = font.stringHeight(s) / 2;
int stringWidth = font.stringWidth(s);
font.drawString(s, x - stringWidth, y + halfStringHeight);
}
开发者ID:xavibove,项目名称:Cancons-Visuals,代码行数:6,代码来源:PMSc10Thanks.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: 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
示例15: 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
示例16: 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
示例17: 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
示例18: 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
示例19: setup
//--------------------------------------------------------------
void ofApp::setup()
{
for (int i = 0; i < ArrayCount(population); i++)
{
population[i] = DNA();
}
myFont.loadFont("LiberationMono-Regular.ttf", 12);
}
开发者ID:Velro,项目名称:Nature-Of-Code-Projects,代码行数:9,代码来源:ofApp.cpp
示例20: draw
void draw() {
ofPushStyle();
ofSetColor(255, 128);
if(messages.size()) {
font.drawString(joined.str(), 10, 20);
}
ofPopStyle();
}
开发者ID:I33N,项目名称:ofxSick,代码行数:8,代码来源:testApp.cpp
注:本文中的ofTrueTypeFont类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论