https://github.com/bakercp/ofxpointer
A framework to unify openFrameworks pointer events into a single W3C-PointerEvent like interface.
https://github.com/bakercp/ofxpointer
Last synced: 8 months ago
JSON representation
A framework to unify openFrameworks pointer events into a single W3C-PointerEvent like interface.
- Host: GitHub
- URL: https://github.com/bakercp/ofxpointer
- Owner: bakercp
- License: mit
- Created: 2013-10-15T14:46:30.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-05-17T05:15:47.000Z (about 2 years ago)
- Last Synced: 2025-04-02T18:12:48.313Z (about 1 year ago)
- Language: C++
- Homepage:
- Size: 5.03 MB
- Stars: 28
- Watchers: 3
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ofxPointer
## Description
This frameworks adapts the [W3C Pointer Event](http://www.w3.org/TR/pointerevents/) specification to work with openFrameworks. A compatibility layer for iOS / `UITouch` includes support for high-frequency coalesced events, predicted events, event property updates, tilt, pressure and other advanced properties.
## Features
Currently the openFrameworks pointer model separates touch and mouse events, making cross platform development a little tricky.
Simply put, `ofxPointer` merges pointer, touch and pen input into a single extensible interface.
A typical program will now look like this:
### All Platforms
```c++
#pragma once
#include "ofMain.h"
#include "ofxPointer.h"
class ofApp: public ofBaseApp
{
public:
void setup() override
{
// Register the pointer events.
ofx::RegisterPointerEvents(this);
}
void update() override
{
// Update
}
void draw() override
{
// Draw
}
void onPointerUp(ofx::PointerEventArgs& evt)
{
ofLogNotice("ofApp::onPointerUp") << evt;
}
void onPointerDown(ofx::PointerEventArgs& evt)
{
ofLogNotice("ofApp::onPointerDown") << evt;
}
void pointerMove(ofx::PointerEventArgs& evt)
{
ofLogNotice("ofApp::onPointerMove") << evt;
}
void onPointerCancel(ofx::PointerEventArgs& evt)
{
ofLogNotice("ofApp::onPointerCancel") << evt;
}
};
```
Or even more simply, like this:
```c++
#pragma once
#include "ofMain.h"
#include "ofxPointer.h"
class ofApp: public ofBaseApp
{
public:
void setup() override
{
// Register the pointer events.
ofx::RegisterPointerEvent(this);
}
void update() override
{
// Update
}
void draw() override
{
// Draw
}
// All pointer events are returned to a single callback.
void onPointerEvent(ofx::PointerEventArgs& evt)
{
ofLogNotice("ofApp::onPointerEvent") << evt;
}
};
```
### iOS
iOS Currently supports all advanced `UITouch` features including tiltX/Y, elevation, azimuth, precise location, pressure, predicted and coalesced events, estimated properties and estimated property updates. See the iOS examples for more.

## Getting Started
To get started, generate the example project files using the openFrameworks [Project Generator](http://openframeworks.cc/learning/01_basics/how_to_add_addon_to_project/).
## Documentation
API documentation can be found here.
## Build Status
Linux, macOS [](https://travis-ci.org/bakercp/ofxPointer)
Visual Studio, MSYS [](https://ci.appveyor.com/project/bakercp/ofxpointer/branch/master)
## Compatibility
The `stable` branch of this repository is meant to be compatible with the openFrameworks [stable branch](https://github.com/openframeworks/openFrameworks/tree/stable), which corresponds to the latest official openFrameworks release.
The `master` branch of this repository is meant to be compatible with the openFrameworks [master branch](https://github.com/openframeworks/openFrameworks/tree/master).
Some past openFrameworks releases are supported via tagged versions, but only `stable` and `master` branches are actively supported.
## Versioning
This project uses Semantic Versioning, although strict adherence will only come into effect at version 1.0.0.
## Licensing
See `LICENSE.md`.
## Contributing
Pull Requests are always welcome, so if you make any improvements please feel free to float them back upstream :)
1. Fork this repository.
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin my-new-feature`).
5. Create new Pull Request.