
#include <oslib/oslib.h>


PSP_MODULE_INFO("Devslib Sample", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);


//declaration
OSL_EFFECT *Fxmasque[3];
OSL_IMAGE *Fond;



int main(int argc, char* argv[])
{


	//Initialisation
	oslInit(0);							//la lib
	oslInitGfx(OSL_PF_8888, 1);			//Gfx
	oslInitAudio();						//Sound


	//charge tout les masques
	Fxmasque[0] = oslLoadMaskEffect("media/objectif.png");
	Fxmasque[1] = oslLoadMaskEffect("media/masque_champi.png");
	Fxmasque[2] = oslLoadMaskEffect("media/masque_etoile.png");
	Fxmasque[3] = oslLoadMaskEffect("media/masque_mario.png");

	Fond = oslLoadImageFile("media/fond.png", OSL_IN_RAM, OSL_PF_5551);	

	oslActiveEffect(Fxmasque[0],0, 1);
	
	//possition de l'annimation
	int possition = 0;

	while (!osl_quit)
	{
		//Debut du dessin
		oslStartDrawing();
		oslCls();

		switch (possition)
		{
		case 0:
			oslUpdateMaskEffect(Fxmasque[0]);
			oslDrawImage(Fond);
			oslDrawMaskEffect(Fxmasque[0]);
			if (Fxmasque[0]->active == 2){oslActiveEffect(Fxmasque[1],1, 0); possition ++;}
			break;
		case 1:
			oslUpdateMaskEffect(Fxmasque[1]);
			oslDrawImage(Fond);
			oslDrawMaskEffect(Fxmasque[1]);
			if (Fxmasque[1]->active == 2){oslActiveEffect(Fxmasque[2],0, 1); possition ++;}
			break;
		case 2:
			oslUpdateMaskEffect(Fxmasque[2]);
			oslDrawImage(Fond);
			oslDrawMaskEffect(Fxmasque[2]);
			if (Fxmasque[2]->active == 2){oslActiveEffect(Fxmasque[3],1, 0); possition ++;}
			break;
		case 3:
			oslUpdateMaskEffect(Fxmasque[3]);
			oslDrawImage(Fond);
			oslDrawMaskEffect(Fxmasque[3]);
			if (Fxmasque[3]->active == 2){oslActiveEffect(Fxmasque[0],0, 1); possition = 0;}
			break;
		}


		oslSynchronization();

	}

	oslEndGfx();
	oslQuit();
	return 0;
}



