
#include <oslib/oslib.h>


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


OSL_IMAGE *Fond;


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

	//log tout ce qui ce passe dans un fichier
	oslLogSystem(1);

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


	//Initialise le clavier sur le clavier virtuel 1
	oslKeyboardLoad2("clavier/clavier1.png","clavier/clavier2.png","sourie1.png",130,150);


	Fond = oslLoadImageFile("fond.png", OSL_IN_RAM, OSL_PF_8888);

	char *testText = "";

	while (!osl_quit)
	{
		oslStartDrawing();

		oslSetTextColor(RGBA(255,255,255,255));
		oslSetBkColor(RGBA(0,0,0,255));
		

		oslDrawImage(Fond);


		//oslPrintf_xy(0, 200, "Texte : %s" ,testText);

	    oslDrawFillRect(50+5, 10+5, 480-50+5, 92-10+5, RGBA(30,30,30,100));
		oslDrawFillRect(50, 10, 480-50, 92-10, RGB(255,255,255));
		oslPrintColorShadow(240- (oslStringLength("Tapez votre Texte :")/2), 20,VERT,"Tapez votre Texte :", 0);
		oslDrawFillRect(50+5+3, 10+23+3, 480-50-5+3, 92-10-5+3, RGBA(30,30,30,100));
		oslDrawFillRect(50+5, 10+23, 480-50-5, 92-10-5, RGB(120,216,248));
		oslDrawRect(50+5, 10+23, 480-50-5, 92-10-5, RGB(0,0,0));
		oslSetBkColor(RGBA(0, 0, 0, 0));
		oslSetTextColor(RGBA(255, 0, 0, 255));

		//oslDrawTextBox(50+5+3, 10+23+3, 480-50-5-3, 92-10-5-3, (char *)testText, 0);
		oslPrintf_xy(50+5+3, 10+23+3, "%s" ,testText);

		
		testText = oslKeyboard2Draw();


		

		oslSynchronization();


	}

	osl_DelKeyboard2();

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



