Browse Source

Add example_pocketvj

master
Krisjanis Rijnieks 7 years ago
parent
commit
e8dddfe008
  1. 13
      example_pocketvj/Makefile
  2. 4
      example_pocketvj/addons.make
  3. 36
      example_pocketvj/bin/data/ofxpimapper.xml
  4. BIN
      example_pocketvj/bin/data/sources/images/image1.jpg
  5. 7
      example_pocketvj/src/main.cpp
  6. 119
      example_pocketvj/src/ofApp.cpp
  7. 21
      example_pocketvj/src/ofApp.h

13
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

4
example_pocketvj/addons.make

@ -0,0 +1,4 @@
ofxGui
ofxPiMapper
ofxXmlSettings
ofxOMXPlayer

36
example_pocketvj/bin/data/ofxpimapper.xml

@ -0,0 +1,36 @@
<surfaces>
<surface type="0">
<vertices>
<vertex>
<x>431.000000000</x>
<y>13.000000000</y>
</vertex>
<vertex>
<x>781.000000000</x>
<y>363.000000000</y>
</vertex>
<vertex>
<x>81.000000000</x>
<y>363.000000000</y>
</vertex>
</vertices>
<texCoords>
<texCoord>
<x>0.500000000</x>
<y>0.000000000</y>
</texCoord>
<texCoord>
<x>1.000000000</x>
<y>1.000000000</y>
</texCoord>
<texCoord>
<x>0.000000000</x>
<y>1.000000000</y>
</texCoord>
</texCoords>
<source>
<source-type>image</source-type>
<source-name>image1.jpg</source-name>
</source>
</surface>
</surfaces>

BIN
example_pocketvj/bin/data/sources/images/image1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

7
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());
}

119
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);
}

21
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;
};
Loading…
Cancel
Save