Skip to content

Latest commit

 

History

History
101 lines (73 loc) · 2.53 KB

README.md

File metadata and controls

101 lines (73 loc) · 2.53 KB

ofxCanvasEvents

NOTE: DOES NOT WORK YET!

Introduction

Broadcast mouse, touch, and key events from an HTML5 Canvas to your openFrameworks app.

License

MIT License

Installation

Download or clone this repository into your openFrameworks/addons/ folder making sure to save it as ofxCanvasEvents.

Dependencies

Huge shoutout to @bakercp for developing the entire suite of dependencies that make this addon possible.

Compatibility

Compatible with openFrameworks 0.8.4 and above (may work with older versions too).

Usage

Basic

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

keycodes

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