#include "testApp.h"


//--------------------------------------------------------------
void testApp::setup(){
	
	vidGrabber.setVerbose(true);
	vidGrabber.initGrabber(W,H);
	
	ofSetWindowShape(WINDOW_WIDTH, WINDOW_HEIGHT);
	ofSetFrameRate(60);
	ofSetBackgroundAuto(true);
	ofBackground(0,0,0);
	
	orientationTracker.setListener(this);
	
}

//--------------------------------------------------------------
void testApp::update(){
	
	ofBackground(0,0,0);
	
	vidGrabber.update();
	if (vidGrabber.isFrameNew()) {
		orientationTracker.update(vidGrabber.getPixels(), W, H);

	}
		
}
	
//--------------------------------------------------------------
void testApp::draw(){
	orientationTracker.draw(0, 0);
}


//--------------------------------------------------------------
void testApp::keyPressed  (int key){
	switch (key){
		case 's':
			vidGrabber.videoSettings();
			break;
		case 'f':
			ofToggleFullscreen();
			break;
		default:
			orientationTracker.keyPressed(key);
			break;
	}
	
}

void testApp::blobOn( int x, int y, int id, int order )
{

}
void testApp::blobMoved( int x, int y, int id, int order )
{
	
}
void testApp::blobOff( int x, int y, int id, int order )
{
	
}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h){
	
}


