diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 3e6fc7f..09e3018 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -14,8 +14,10 @@ Application::Application(){ ofHideCursor(); // TODO: Get rid of listeners, pipe application events from the example app + /* ofAddListener(ofEvents().keyPressed, this, &Application::onKeyPressed); ofAddListener(ofEvents().keyReleased, this, &Application::onKeyReleased); + */ /* ofAddListener(ofEvents().mousePressed, this, &Application::onMousePressed); diff --git a/src/ofxPiMapper.cpp b/src/ofxPiMapper.cpp index e6e81ca..aa2a3c7 100644 --- a/src/ofxPiMapper.cpp +++ b/src/ofxPiMapper.cpp @@ -14,6 +14,18 @@ void ofxPiMapper::draw(){ _application.draw(); } +void ofxPiMapper::keyPressed(int key){ + ofKeyEventArgs args; + args.key = key; + _application.onKeyPressed(args); +} + +void ofxPiMapper::keyReleased(int key){ + ofKeyEventArgs args; + args.key = key; + _application.onKeyReleased(args); +} + void ofxPiMapper::mousePressed(int x, int y, int button){ ofMouseEventArgs args; args.x = x; diff --git a/src/ofxPiMapper.h b/src/ofxPiMapper.h index c5f61ac..2c5411b 100644 --- a/src/ofxPiMapper.h +++ b/src/ofxPiMapper.h @@ -39,6 +39,9 @@ class ofxPiMapper { void update(); void draw(); + void keyPressed(int key); + void keyReleased(int key); + void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void mouseDragged(int x, int y, int button);