Esempio n. 1
0
File: IHM.c Progetto: MIDMX/RaVisual
void password_screen(){

	//fond d'écran, header, footer
	create_rectangle(0,0,320,240,0x632C);
	header(5,TRUE,TRUE);

	//initialisatioin des variables
	char * temp[20],hidden[20]={};
	uint32_t i,j,len = strlen(password);
	uint32_t plus = 0, offsetY = 85, offsetX = 10;

	//création de la barre de texte
	LCD_DrawFullRect(10,40,300,32,0x39C7,0xD6BA);
	LCD_DrawFullRect(279,41,30,30,0xD6BA,0x153F);
	create_button(button,41,279,41,30,30);

	//on affiche le mot de passe en masuqnat les caractères
	for(i = 0; i<len;i++){
		strcpy(temp,hidden);
		sprintf(hidden,"%s-",(uint8_t *)temp);
	}
	LCD_DisplayStringLine(52,15,(uint8_t *)hidden,0x39C7,0xD6BA,LCD_NO_DISPLAY_ON_UART);

	//on choisit la police du texte à afficher
	LCD_SetFont(&Bebasn);

	//affichage des icônes dans le menu
	for(i=0;i<4;i++){
		for(j=0;j<10;j++){

			//bufferisation de la position des boutons
			create_button(button,plus,(30*j)+offsetX,(31*i)+offsetY,30,30);

			//drawing separators
			LCD_DrawRect((30*j)+offsetX,(31*i)+offsetY,30,30,0x39C7);
			LCD_DrawFullRect((30*j)+offsetX,(31*i)+offsetY,29,29,0x738E,0x5ACB);
			LCD_DisplayStringLine((31*i)+offsetY+11,(30*j)+offsetX+11,(uint8_t *)string[plus],0xD6BA,0x5ACB,LCD_NO_DISPLAY_ON_UART);
			plus++;

			// on sort de la boucle pour ne pas afficher les deux dernières touches du clavier
			// (choix graphique, on aurait pu faire sans)
			if (plus > 37){
				j = 10;
				i = 4;
			}

		}
	}

	//affichage du footer, puis lecture de l'écran tactile
	footer(PASSWORD);
	read_screen(button,PASSWORD,40);

}
Esempio n. 2
0
File: IHM.c Progetto: MIDMX/RaVisual
void menu_screen(){

	//initialisation des variables
	int i,j,text = 0;

	//fond d'écran, header, footer
	create_rectangle(0,0,320,240,0x5ACB);
	header(5,FALSE,TRUE);

	//Choix de la taille de police pour l'écriture dans le header
	LCD_SetFont(&Bebasn);

	//affichage des icônes dans le menu
	for(i=0;i<2;i++){
		for(j=0;j<3;j++){
			if(i == 1 && j > 0){
				//DO NOTHING
			}else{
				LCD_DrawFullRect((104*j)+5,(84*i)+38,102,81,0x2104,0xFFFF);
				LCD_DrawFullRect((104*j)+5,(84*i)+38,102,20,0x2104,0x2104);
				LCD_DisplayStringLine((84*i)+44,(105*j)+10,(uint8_t *)menuText[text],0xffff,0x2104,LCD_NO_DISPLAY_ON_UART);
				DISP_BMP((uint8_t*)images[text],(104*j)+6,(84*i)+59,100,60);

				//bufferisation de la position des boutons
				create_button(button,text,(104*j)+5,(84*i)+38,102,81);

				text++;
			}
		}
	}

	footer(MAIN);

	//on lance l'acquisition sur l'écran tactile
	read_screen(button,MAIN,4);
}
Esempio n. 3
0
File: IHM.c Progetto: MIDMX/RaVisual
void setting_menu(){

	//fond d'écran, header
	header(5,TRUE,TRUE);

	//choix de la police
	LCD_SetFont(&Bebasn);

	//initialisation des variables
	int i = 0, taille = 6;
	const int offsetY = 36;

	//filling text container
	create_rectangle(0,25,320,190,0x5ACB); //TODO: inutile, à virer

	//affichage du menu-list dans le menu settings
	for(i = 0;i<taille;i++){

		//drawing separators
		LCD_DrawLine(0,(32*i)+24,320,LCD_DIR_HORIZONTAL,0x39C7);
		LCD_DrawLine(0,(32*i)+25,320,LCD_DIR_HORIZONTAL,0x738E);

		//displaying text and icons in "non selected color"
		LCD_DisplayStringLine((32*i)+offsetY,45,(uint8_t *)list[i],0xD6BA,0x5ACB,LCD_NO_DISPLAY_ON_UART);
		DISP_BMP((uint8_t*)logoff[i],10,(32*i)+28,24,24);

		//bufferisation de la position des boutons
		create_button(button,i,0,(i*32)+25,320,33);

	}

	//affichage du footer, puis lecture de l'écran tactile
	footer(SETTINGS);
	read_screen(button,SETTINGS,taille);

}
Esempio n. 4
0
int main() 
{
	bool allowed[4][10]={
		{1,1,1,0,0,0,0,0,0,0},
		{1,1,1,1,1,1,1,1,1,1},
		{1,1,1,1,1,1,0,0,0,0}, 
		{1,1,1,1,1,1,1,1,1,1}
	};
	bool matching_digits[4][10];
	int nmatching[4];  
	while(read_screen())
	{
		memset(matching_digits,false,40*sizeof(bool));
		memset(nmatching,0,4*sizeof(int));
		for(int p=0;p<4;p++)
		{
			for(int d=0;d<10;d++)
			{	
				if(match_digit(p,d) &&
				   allowed[p][d])
				{
					matching_digits[p][d]=true;
					nmatching[p]++;
				}
				else
				{
					matching_digits[p][d]=false;
				}
			}
		}
		if(nmatching[0]==1 && matching_digits[0][2])
		{
			for(int d=4;d<10;d++)
			{
				if(matching_digits[1][d]==1)
				{
					matching_digits[1][d]=0;
					nmatching[1]--;
				}
			}
		}
		for(int d=4;d<10;d++)
		{
			if(matching_digits[1][d])
			{
				if(matching_digits[0][2])
				{
					matching_digits[0][2]=false;
					nmatching[0]--;
				} 
			}
		}
		int solution[4]={-1,-1,-1,-1};
		bool ambiguous=false;
		for(int p=0;p<4;p++)
		{
			for(int d=0;d<10;d++)
			{
				if(matching_digits[p][d] && solution[p]>=0)
				{
					ambiguous=true;
					break;
				}
				else if(matching_digits[p][d])
				{
					solution[p]=d;
				}
			}
		}
		if(ambiguous)
			puts("ambiguous");
		else
			printf("%d%d:%d%d\n",solution[0],solution[1],solution[2],solution[3]);
	}
	puts("end");
	return 0;
}