Browse Source

Add passing key events instead of registering to them

master
Krisjanis Rijnieks 9 years ago
parent
commit
e7424d492e
  1. 2
      src/Application/Application.cpp
  2. 12
      src/ofxPiMapper.cpp
  3. 3
      src/ofxPiMapper.h

2
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);

12
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;

3
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);

Loading…
Cancel
Save