diff --git a/example_pocketvj/Makefile b/example_pocketvj/Makefile new file mode 100644 index 0000000..177e172 --- /dev/null +++ b/example_pocketvj/Makefile @@ -0,0 +1,13 @@ +# Attempt to load a config.make file. +# If none is found, project defaults in config.project.make will be used. +ifneq ($(wildcard config.make),) + include config.make +endif + +# make sure the the OF_ROOT location is defined +ifndef OF_ROOT + OF_ROOT=$(realpath ../../..) +endif + +# call the project makefile! +include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk diff --git a/example_pocketvj/addons.make b/example_pocketvj/addons.make new file mode 100644 index 0000000..963941c --- /dev/null +++ b/example_pocketvj/addons.make @@ -0,0 +1,4 @@ +ofxGui +ofxPiMapper +ofxXmlSettings +ofxOMXPlayer diff --git a/example_pocketvj/bin/data/ofxpimapper.xml b/example_pocketvj/bin/data/ofxpimapper.xml new file mode 100644 index 0000000..961b490 --- /dev/null +++ b/example_pocketvj/bin/data/ofxpimapper.xml @@ -0,0 +1,36 @@ + + + + + 431.000000000 + 13.000000000 + + + 781.000000000 + 363.000000000 + + + 81.000000000 + 363.000000000 + + + + + 0.500000000 + 0.000000000 + + + 1.000000000 + 1.000000000 + + + 0.000000000 + 1.000000000 + + + + image + image1.jpg + + + diff --git a/example_pocketvj/bin/data/sources/images/image1.jpg b/example_pocketvj/bin/data/sources/images/image1.jpg new file mode 100644 index 0000000..88cf12e Binary files /dev/null and b/example_pocketvj/bin/data/sources/images/image1.jpg differ diff --git a/example_pocketvj/src/main.cpp b/example_pocketvj/src/main.cpp new file mode 100644 index 0000000..a26fe86 --- /dev/null +++ b/example_pocketvj/src/main.cpp @@ -0,0 +1,7 @@ +#include "ofMain.h" +#include "ofApp.h" + +int main(){ + ofSetupOpenGL(800, 450, OF_WINDOW); + ofRunApp(new ofApp()); +} diff --git a/example_pocketvj/src/ofApp.cpp b/example_pocketvj/src/ofApp.cpp new file mode 100644 index 0000000..b90fbaa --- /dev/null +++ b/example_pocketvj/src/ofApp.cpp @@ -0,0 +1,119 @@ +#include "ofApp.h" + +void ofApp::setup(){ + ofBackground(0); + mapper.setup(); + + // Set different info text for PocketVJ + std::string multilineInfoText = + "Custom ofxPiMapper shortcuts\n\n" + "Good day user.\n" + "Shortcuts have been customized.\n" + "Please make sure to provide your own documentation."; + mapper.setInfoText(multilineInfoText); +} + +void ofApp::update(){ + mapper.update(); +} + +void ofApp::draw(){ + mapper.draw(); +} + +void ofApp::keyPressed(int key){ + if(key == '1'){ + mapper.setMode(ofx::piMapper::PRESENTATION_MODE); + }else if(key == '2'){ + mapper.setMode(ofx::piMapper::TEXTURE_MODE); + }else if(key == '3'){ + mapper.setMode(ofx::piMapper::MAPPING_MODE); + }else if(key == '4'){ + mapper.setMode(ofx::piMapper::SOURCE_MODE); + }else if(key == 'c'){ + mapper.toggleInfo(); + }else if(key == 't'){ + mapper.createSurface(ofx::piMapper::TRIANGLE_SURFACE); + }else if(key == 'q'){ + mapper.createSurface(ofx::piMapper::QUAD_SURFACE); + }else if(key == 'r'){ + mapper.createSurface(ofx::piMapper::CIRCLE_SURFACE); + }else if(key == 'x'){ + mapper.createSurface(ofx::piMapper::HEXAGON_SURFACE); + }else if(key == 'g'){ + mapper.createSurface(ofx::piMapper::GRID_WARP_SURFACE); + }else if(key == 'a'){ + mapper.duplicateSurface(); + }else if(key == 'o'){ + mapper.scaleUp(); + }else if(key == 'i'){ + mapper.scaleDown(); + }else if(key == 'p'){ + mapper.togglePerspective(); + }else if(key == 'v'){ + // Add columns + }else if(key == 'b'){ + // Remove columns + }else if(key == 'n'){ + // Add rows + }else if(key == 'm'){ + // Remove rows + }else if(key == '.'){ + mapper.selectNextSurface(); + }else if(key == ','){ + mapper.selectPrevSurface(); + }else if(key == 'k'){ + mapper.selectNextVertex(); + }else if(key == 'l'){ + mapper.selectPrevVertex(); + }else if(key == 'h'){ + mapper.moveLayerUp(); + }else if(key == 'j'){ + mapper.moveLayerDown(); + }else if(key == 's'){ + mapper.saveProject(); + }else if(key == 'y'){ + // Toggle layer panel + }else if(key == 'z'){ + mapper.undo(); + }else if(key == 'd'){ + // Delete surface + }else if(key == 'w'){ + mapper.togglePause(); + }else if(key == '5'){ + mapper.setNextSource(); + }else if(key == '8'){ + mapper.moveSelection(ofx::piMapper::Vec3(0.0f, -1.0f, 0.0f)); + }else if(key == '9'){ + mapper.moveSelection(ofx::piMapper::Vec3(0.0f, 1.0f, 0.0f)); + }else if(key == '7'){ + mapper.moveSelection(ofx::piMapper::Vec3(-1.0f, 0.0f, 0.0f)); + }else if(key == '0'){ + mapper.moveSelection(ofx::piMapper::Vec3(1.0f, 0.0f, 0.0f)); + } + + // Make / toggle between shif/unshift (how to capture that with EGL window?) + + /* + rbt Reboot (Raspberry Pi only) + sdn Shutdown (Raspberry Pi only) + new Clear composition (remove all surfaces) + ext Exit application and return to command line + */ +} + +void ofApp::keyReleased(int key){ + mapper.keyReleased(key); +} + +void ofApp::mousePressed(int x, int y, int button){ + mapper.mousePressed(x, y, button); +} + +void ofApp::mouseReleased(int x, int y, int button){ + mapper.mouseReleased(x, y, button); +} + +void ofApp::mouseDragged(int x, int y, int button){ + mapper.mouseDragged(x, y, button); +} diff --git a/example_pocketvj/src/ofApp.h b/example_pocketvj/src/ofApp.h new file mode 100644 index 0000000..63be198 --- /dev/null +++ b/example_pocketvj/src/ofApp.h @@ -0,0 +1,21 @@ +#pragma once + +#include "ofMain.h" +#include "ofxPiMapper.h" +#include "Vec3.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 mouseReleased(int x, int y, int button); + void mouseDragged(int x, int y, int button); + + ofxPiMapper mapper; +};