Skip to content

Instantly share code, notes, and snippets.

@crecord
Forked from j3ffgray/Multiples
Last active February 20, 2016 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crecord/84bc8440173348c5b22b to your computer and use it in GitHub Desktop.
Save crecord/84bc8440173348c5b22b to your computer and use it in GitHub Desktop.
Text Overlay Template, openFrameworks Examples
// in the ofApp.h
// ... additional initialization code ...
//boolean to toggle help text
bool bHelpText;
// in the ofApp.cpp
void ofApp::setup(){
//set help text to display by default
bHelpText = true;
// ... additional example code ...
}
void ofApp::draw(){
// ... additional example code ...
// display help text if it is enable
if(bHelpText) {
stringstream ss;
ss << "FPS: " << ofToString(ofGetFrameRate(),0) << endl << endl;
ss << "(f): Toggle Fullscreen"<<endl;
ss <<"(s): Draw Solid Shapes"<<endl;
ss <<"(h): Toggle help."<<endl;
ofDrawBitmapString(ss.str().c_str(), 20, 20);
}
}
void ofApp::keyPressed(int key){
switch(key){
case 'h':
//toggle help text
bHelpText = !bHelpText;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment