diff --git a/example-gamepad/src/main.cpp b/example-gamepad/src/main.cpp new file mode 100644 index 0000000..d1b6467 --- /dev/null +++ b/example-gamepad/src/main.cpp @@ -0,0 +1,24 @@ +#include "ofMain.h" +#include "ofApp.h" +#include +#include + +int main(int argc, char * argv[]){ + bool fullscreen = false; + + vector arguments = vector(argv, argv + argc); + for(int i = 0; i < arguments.size(); ++i){ + if(arguments.at(i) == "-f"){ + fullscreen = true; + break; + } + } + + if(fullscreen){ + ofSetupOpenGL(800, 450, OF_FULLSCREEN); + }else{ + ofSetupOpenGL(800, 450, OF_WINDOW); + } + + ofRunApp(new ofApp()); +} diff --git a/example-gamepad/src/ofApp.cpp b/example-gamepad/src/ofApp.cpp new file mode 100644 index 0000000..aab3328 --- /dev/null +++ b/example-gamepad/src/ofApp.cpp @@ -0,0 +1,34 @@ +#include "ofApp.h" + +void ofApp::setup(){ + ofBackground(0); + mapper.setup(); +} + +void ofApp::update(){ + mapper.update(); +} + +void ofApp::draw(){ + mapper.draw(); +} + +void ofApp::keyPressed(int key){ + mapper.keyPressed(key); +} + +void ofApp::keyReleased(int key){ + mapper.keyReleased(key); +} + +void ofApp::mousePressed(int x, int y, int button){ + mapper.mousePressed(x, y, button); +} + +void ofApp::mouseDragged(int x, int y, int button){ + mapper.mouseDragged(x, y, button); +} + +void ofApp::mouseReleased(int x, int y, int button){ + piMapper.mouseReleased(x, y, button); +} diff --git a/example-gamepad/src/ofApp.h b/example-gamepad/src/ofApp.h new file mode 100644 index 0000000..12aa676 --- /dev/null +++ b/example-gamepad/src/ofApp.h @@ -0,0 +1,20 @@ +#pragma once + +#include "ofMain.h" +#include "ofxPiMapper.h" + +class ofApp : public ofBaseApp { + public: + void setup(); + void update(); + void draw(); + + void keyPressed(int key); + void keyReleased(int key); + + void mousePressed(int x, int y, int button); + void mouseDragged(int x, int y, int button); + void mouseReleased(int x, int y, int button); + + ofxPiMapper mapper; +}; \ No newline at end of file