Advertisement
Guest User

Untitled

a guest
Jan 8th, 2014
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. testapp.cpp
  2.  
  3. void testApp::setup(){
  4. font.loadFont("mentone-semibol.otf",35,true,true,true);
  5. text=nodeString("Hello world");
  6. text.setPosition(ofGetWidth()/2, ofGetHeight()/2,0);
  7. //ofSetFrameRate(60);
  8. }
  9.  
  10. void testApp::draw(){
  11. text.draw(font, ofColor(0,128,0));
  12. ofSetColor(0);
  13. font.drawString(ofToString(ofGetFrameRate(),2),50,50);
  14. }
  15.  
  16.  
  17.  
  18. nodestring.cpp
  19.  
  20. void nodeString::draw(ofTrueTypeFont font, ofColor c)
  21. {
  22. //m is a ofmesh
  23. m=font.getStringMesh(text,0,0);
  24. texture=font.getFontTexture();
  25. //save wold matrix
  26. ofPushMatrix();
  27. //translate to desired position
  28. ofTranslate(this->getX(),this->getY(), this->getZ());
  29. //scale
  30. ofScale(this->getScale().x,this->getScale().y,this->getScale().z);
  31. //rotate
  32. //ofRotate(ofGetElapsedTimef()*50,1,0,0);
  33.  
  34. ofSetColor(c);
  35. //m.enableTextures();
  36. texture.bind();
  37. m.draw();
  38. texture.unbind();
  39.  
  40. ofPopMatrix();
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement