← Back

ofxMacTrackpadPressure

github.com/ofWorks/ofxMacTrackpadPressure · @ofWorks
OF 0.12 Utilities macOS

pressure sensitive touchpad in macOS

1 0 Last commit 5mo ago Created 5mo ago

README

ofxMacTrackpadPressure



macOS trackpad pressure / Force Touch support for openFrameworks.

Files



ofxMacTrackpadPressure/
├── addon_config.mk
├── src/
│   ├── ofxMacTrackpadPressure.h      // C++ header (clean, no Obj-C)
│   └── ofxMacTrackpadPressure.mm     // Objective-C++ implementation
└── example-pressure-drawing/
    └── src/
        ├── main.cpp
        ├── ofApp.h
        └── ofApp.cpp


Installation



1. Copy ofxMacTrackpadPressure/ to your openFrameworks/addons/ folder 2. Generate your project with Project Generator, include this addon 3. Or manually add the .h and .mm files to your Xcode project

Usage



#include "ofxMacTrackpadPressure.h"

ofxMacTrackpadPressure pressure;

void ofApp::setup() {
    pressure.setup();
    pressure.setEnabled(true);
    ofAddListener(pressure.pressureChanged, this, &ofApp::onPressureChanged);
}

void ofApp::onPressureChanged(ofxTrackpadPressureEventArgs& args) {
    float p = args.pressure;  // 1.0 = normal click, up to ~5.0 deep press
}


Key Points



Controls (example)



Get this addon

HTTPS
SSH