#include "testApp.h"


//--------------------------------------------------------------
void testApp::setup(){
	c = colors();
	
	ofEnableAlphaBlending();
	ofSetFrameRate(60);
	ofSetVerticalSync(true);
	ofEnableSmoothing();
	
	maxStrokes = 5;
	
	output = new char[512];
}

//--------------------------------------------------------------
void testApp::update(){
	for(int i = 0; i < strokes.size(); i++){
		strokes[i].update();	
	}
}

//--------------------------------------------------------------
void testApp::draw(){
	ofBackground(0,0,0);
	for(int i = 0; i < strokes.size(); i++){
		strokes[i].draw();	
	}
}

//--------------------------------------------------------------
void testApp::keyPressed  (int key){
	
}

//--------------------------------------------------------------
void testApp::keyReleased  (int key){ 
	
}

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

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
	ofPoint point = ofPoint(x,y);
	strokes.back().addPoint(point);
}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
	pointRecorder rec = pointRecorder();
	strokes.push_back(rec);
	if(strokes.size() > maxStrokes){
		strokes.erase(strokes.begin());
	}
}

//--------------------------------------------------------------
void testApp::mouseReleased(){

}