Esempio n. 1
0
void printScore(int score){
  char str[15];
  sprintf(str, "%05d", score);
  EcrireTexte(60*TAILLE_CASE+BORD-TailleChaineEcran("00000",2),40*TAILLE_CASE+BORD+30,str,2);
}
Esempio n. 2
0
int affichage_apres_round(int gagnant)
{
	if(actions_sur_pression_touche_combat ()==QUITTER_AFFICHAGE)
		return QUITTER_AFFICHAGE;
	if(env.mode == MODE_MAXSPEED_NODISPLAY)
		return 0;
	
	temps debut;
	temps refresh_previous_time, current_time, refresh_diff_time, temps_fin;
	bool quitter;
	
	// On travaille avec un cycle de taille limit_clign
	int limit_clign = TIME_END_MATCH / (REFRESH_TIME*NB_CLIGN);
	int iclign = 0;
	bool affiche_texte=FAUX;
	
	char * inf = info_fin_round2string( gagnant );
	
	int x,y,w,h; // zone prise par le texte
	
	
	
	x = (W_FENETRE - TailleChaineEcran(inf,2))/2;
	y = H_FENETRE/2 - 50 - TailleSupPolice(2);
	w = TailleChaineEcran(inf,2);
	h = TailleSupPolice(2) + TailleInfPolice(2);
	
	x=x-5;
	y=y-4;
	w=w+10;
	h=h+10;
	
	couleur_role clr_back, clr_texte;
	
		
	if(gagnant==-1)
	{
		clr_back=CLR_BACKGROUND;
		clr_texte=CLR_TEXTE_INFO;
	}
	else if(gagnant==0)
	{
		clr_back=CLR_CASE_P0;
		clr_texte=CLR_PROG0;
		env.mem_owner [ env.ip[1] ] = OWNER_P1_KILL;
		env.need_rebuff[ env.ip[1] ]  = VRAI;
		buff_zone_mem();
	}
	else if(gagnant==1)
	{
		clr_back=CLR_CASE_P1;
		clr_texte=CLR_PROG1;
		env.mem_owner [ env.ip[0] ] = OWNER_P0_KILL;
		env.need_rebuff[ env.ip[0] ]  = VRAI;
		buff_zone_mem();
	}
	
	
	/* On sauvegarde la zone 'sans texte' dans save (depuis buffer),
	 * On ecrit le texte dans buffer,
	 * On copie la zone 'avec texte' dans save
	 */
	
	save_buff_zone (x,y,w,h,0,0);
	
	
	buff_rect (x,y,w,h,clr_back);
	buff_combat_text_info (inf, clr_texte);
	
	free(inf);
	inf=NULL;
	
	save_buff_zone (x,y,w,h,0,100);
	
	
	
	refresh_previous_time=debut=get_temps();
	temps_fin=env.waitingtime;
	
	quitter=FAUX;
	while(!quitter)
	{
		
		current_time=get_temps();
		
		
		quitter = ((current_time-debut) > TIME_END_MATCH);


		if(actions_sur_pression_touche_combat ()==QUITTER_AFFICHAGE)
			return QUITTER_AFFICHAGE;
		
		
		if ( iclign==limit_clign )
		{
			iclign= 0;
			buff_save_zone (0,(affiche_texte)?100:0,w,h,x,y);
			affiche_texte = !affiche_texte;
		}
		else
			iclign ++;
		
		refresh_diff_time=current_time-refresh_previous_time;
		
		if(refresh_diff_time > REFRESH_TIME)
		{
			flip(); 
			refresh_previous_time=current_time;
		}
		else 
		if(!quitter)
		{
			delay(REFRESH_TIME - refresh_diff_time); // pause le temps qu'il reste
		}
		
		
	}
	return 0;
}
Esempio n. 3
0
void buff_combat_text_info (char * texte, couleur_role clr_texte)
{
	const int x = (W_FENETRE - TailleChaineEcran(texte,2))/2;
	const int y = H_FENETRE/2 - 50;
	buff_ecrire_texte(texte,x,y,2,clr_texte);
}
Esempio n. 4
0
void buff_ecrire_texte_xaligncenter (char * texte, int y, int taille, couleur_role c)
{
	const int x = (W_FENETRE - TailleChaineEcran(texte,taille))/2;
	buff_ecrire_texte (texte,x,y,taille,c);
}
Esempio n. 5
0
void buff_liste_combat (liste_combat l, int x, int y, int w, int h)
{
	int i;
	
	int posx, posy;
	
	int p;
	
	int pcenter=x+w/2;
	
	chainon_combat * c;
	
	char * sscore[2];
	
	for(i=0;i<2;i++)
		sscore[i]=malloc(sizeof(char)*16);
	
	posx = x+40;
	posy = y+10;
	
	for(i=-2;i<=2;i++)
	{
		
		c=offset_combat(l,i);
			
		
		if(c!=NULL)
		{			
			p=pcenter-TailleChaineEcran(c->cbt[0]->nom,1)-40;
			buff_ecrire_texte(c->cbt[0]->nom,p,posy,1,CLR_PROG0);
			if(i<0)
			{
				snprintf(sscore[0],15,"%03d",c->score[0]);
				p=pcenter-TailleChaineEcran(sscore[0],1)-40;
				buff_ecrire_texte(sscore[0],p,posy+25,1,CLR_PROG0);
			}
			else
				if(i==0)
					buff_element(EL_IND_D, p-40,posy-20);
			
						p=pcenter-TailleChaineEcran("VS",2)/2;
			buff_ecrire_texte("VS",p,posy+10,2,CLR_TEXTE_DEFAUT);

			
			p=pcenter+40;
			buff_ecrire_texte(c->cbt[1]->nom,p,posy,1,CLR_PROG1);
			if(i<0)
			{
				snprintf(sscore[1],15,"%03d",c->score[1]);
				buff_ecrire_texte(sscore[1],p,posy+25,1,CLR_PROG1);
			}
			else
				if(i==0)
					buff_element(EL_IND_G, p+TailleChaineEcran(c->cbt[1]->nom,1)+10,posy-20);
			

			
			
		}
		
		posy+=h/5;
	}
	
	
	
	
	
	
	for(i=0;i<2;i++)
		free(sscore[i]);
}