https://github.com/brannondorsey/ofxcanvasevents
Broadcasts mouse, touch, and key events from an HTML5 Canvas to an openFrameworks app
https://github.com/brannondorsey/ofxcanvasevents
Last synced: 9 months ago
JSON representation
Broadcasts mouse, touch, and key events from an HTML5 Canvas to an openFrameworks app
- Host: GitHub
- URL: https://github.com/brannondorsey/ofxcanvasevents
- Owner: brannondorsey
- License: other
- Created: 2014-11-03T18:02:33.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-11-29T05:04:47.000Z (about 10 years ago)
- Last Synced: 2025-01-12T05:44:15.015Z (11 months ago)
- Language: JavaScript
- Size: 765 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: license.md
Awesome Lists containing this project
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](license.md)
Installation
------------
Download or clone this repository into your `openFrameworks/addons/` folder making sure to save it as `ofxCanvasEvents`.
Dependencies
------------
- [ofxIO](http://github.com/bakercp/ofxIO)
- [ofxJSON](http://github.com/bakercp/ofxJSON)
- [ofxJSONRPC](http://github.com/bakercp/ofxJSONRPC)
- [ofxMediaType](http://github.com/bakercp/ofxMediaType)
- [ofxSSLManager](http://github.com/bakercp/ofxSSLManager)
- [ofxTaskQueue](http://github.com/bakercp/ofxTaskQueue)
- [ofxHTTP](http://github.com/bakercp/ofxHTTP)
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
```cpp
#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
```cpp
void keyPressed(ofKeyEventArgs& args);
void keyReleased(ofKeyEventArgs& args);
```
```cpp
void ofApp::keyPressed(ofKeyEventArgs& args){
message = "keyPressed keycode: " + ofToString(args.keycode);
}
void ofApp::keyReleased(ofKeyEventArgs& args){
message = "keyReleased keycode: " + ofToString(args.keycode);
}
```