-
-
Save crecord/84bc8440173348c5b22b to your computer and use it in GitHub Desktop.
Text Overlay Template, openFrameworks Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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