#include <psychlops.h>
using namespace Psychlops;

void psychlops_main() {

	Canvas sampleA(Canvas::fullscreen);
	Clock timer1, timer2; 
	int temp;

	sampleA.watchFPS();

	sampleA.clear(0.5);
	sampleA.message("calculating...", sampleA.getHcenter(), sampleA.getVcenter());
	sampleA.flip();

	temp=0;
	for(int i=0; i<100; i++){
 		timer1.update();
 		sampleA.progressbar(i,100);
 		while((timer2-timer1).at_msec()<100){timer2.update();}
 		if(Input::get(Keyboard::esc))break;
	}
 
	sampleA.clear(0.5);
	sampleA.message("10 sec elapsed", sampleA.getHcenter(), sampleA.getVcenter());
	sampleA.flip();
	while(!Input::get(Keyboard::spc));
	sampleA.clear(0.5);
	sampleA.message("calculating...", sampleA.getHcenter(), sampleA.getVcenter());
	sampleA.flip();


	temp=0;
	for(int i=0; i<100; i++){
		timer1.update();
		sampleA.progressbar((double)i/100.0);
		while((timer2-timer1).at_msec()<50){timer2.update();}
		if(Input::get(Keyboard::esc))break;
	}

	sampleA.clear(0.5);
	sampleA.message("5 sec elapsed", sampleA.getHcenter(), sampleA.getVcenter());
	sampleA.flip();
	while(!Input::get(Keyboard::spc));
}