← Back

ofxCanvasEvents

github.com/brannondorsey/ofxCanvasEvents · @brannondorsey
OF 0.9 Web/Networking

Broadcasts mouse, touch, and key events from an HTML5 Canvas to an openFrameworks app

2 2 Last commit 11y ago Created 12y ago

README

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


<!-- Known issues

Any specific (and long-living) issues/limitations you want to mention? For bugs, etc. you should use the issue tracker of your addon's repository

Version history

It make sense to include a version history here (newest releases first), describing new features and changes to the addon. Use git tags to mark release points in your repo, too!

Version 0.1 (Date):

Describe relevant changes etc. -->

Get this addon

HTTPS
SSH