NOTE: DOES NOT WORK YET!
Broadcast mouse, touch, and key events from an HTML5 Canvas to your openFrameworks app.
Download or clone this repository into your openFrameworks/addons/
folder making sure to save it as ofxCanvasEvents
.
Huge shoutout to @bakercp for developing the entire suite of dependencies that make this addon possible.
Compatible with openFrameworks 0.8.4 and above (may work with older versions too).
Create a new project using the oF Project Generator making sure to include the ofxCanvasEvent addon and the rest of the dependencies mentioned above. Copy the Document
#include "ofMain.h"
#include "ofxCanvasEvents.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(ofKeyEventArgs& args);
void keyReleased(ofKeyEventArgs& args);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofx::CanvasEvents canvasEvents;
};
void keyPressed(ofKeyEventArgs& args);
void keyReleased(ofKeyEventArgs& args);
void ofApp::keyPressed(ofKeyEventArgs& args){
message = "keyPressed keycode: " + ofToString(args.keycode);
}
void ofApp::keyReleased(ofKeyEventArgs& args){
message = "keyReleased keycode: " + ofToString(args.keycode);
}