Skip to content

Instantly share code, notes, and snippets.

@jeffcrouse
Created October 31, 2017 19:38
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 jeffcrouse/8d91d3318505899138118b9dea7c8b65 to your computer and use it in GitHub Desktop.
Save jeffcrouse/8d91d3318505899138118b9dea7c8b65 to your computer and use it in GitHub Desktop.
#include "ofApp.h"
string input;
string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ()";
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(0);
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(255);
ofDrawBitmapString(input, 10, 20);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
if(key == OF_KEY_RETURN)
{
if(input == "ofDrawCircle()") {
ofLogNotice() << "drawCircle";
}
if(input == "ofDrawRectangle()") {
ofLogNotice() << "drawRectangle";
}
input = "";
}
else if(key == OF_KEY_BACKSPACE)
{
input = input.substr(0, input.size()-1);
}
else if( valid.find(key) != string::npos)
{
input += char(key);
}
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment