Skip to content

Commit

Permalink
drag and drop support for files
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Whitfield committed Oct 23, 2011
1 parent a50a278 commit 575fa11
Show file tree
Hide file tree
Showing 5 changed files with 420 additions and 408 deletions.
7 changes: 6 additions & 1 deletion example/src/testApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ void testApp::gotMessage(ofMessage msg)
//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo)
{

cout << "GOT SOME FILES: "<<endl;
std::vector<string>::iterator it = dragInfo.files.begin();
while(it != dragInfo.files.end()){
cout << *it << endl;
++it;
}
}

void testApp::mouseMovedEvent(ofMouseEventArgs &args)
Expand Down
38 changes: 24 additions & 14 deletions example/src/testApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,57 @@
#include "ofMain.h"
#include "ofxFensterManager.h"

class imageWindow: public ofxFensterListener{
class imageWindow: public ofxFensterListener {
public:
~imageWindow(){
~imageWindow() {
cout << "Image Listener destroyed" << endl;
}
void setup(){
void setup() {
cout << "LOADING IMAGE" << endl;
img.loadImage("someImage.JPG");
}
void draw(){
void draw() {
img.draw(0,0);
}
void keyReleased(int key, ofxFenster* window){

void keyReleased(int key, ofxFenster* window) {
if(key==' ')
ofxFensterManager::get()->deleteFenster(window);
}

ofImage img;
};

class boxWindow: public ofxFensterListener{
class boxWindow: public ofxFensterListener {
public:
boxWindow(){
boxWindow() {
rotX = ofRandom(-20, 20);
rotY = ofRandom(-10, 10);
}
void draw(){

void draw() {
ofNoFill();
ofTranslate(ofGetWidth()*.5, ofGetHeight()*.5, 0);
ofRotateX(rotX);
ofRotateY(rotY);
ofBox(0, 0, 0, 100);
}
void mouseMoved(int x, int y){

void mouseMoved(int x, int y) {
rotY = ofMap(x, 0, ofGetWidth(), -20, 20);
rotX = ofMap(y, 0, ofGetHeight(), 60, -60);
}


void dragEvent(ofDragInfo dragInfo) {
cout << "GOT SOME FILES: "<<endl;
std::vector<string>::iterator it = dragInfo.files.begin();
while(it != dragInfo.files.end()) {
cout << *it << endl;
++it;
}
}


float rotX;
float rotY;
};
Expand Down
Loading

0 comments on commit 575fa11

Please sign in to comment.