Elynx Le 18/01/2005 à 12:46 Exemple de ralentissement:
R_LIGHTGRAY,RECT_FILLED,LightP,DarkP);
}L'affichage des barres de vie et d'energie:void aff_infobar2B (short live1d,short live1l,short live2d,short live2l,short mana1d,short mana1l,short mana2d,short mana2l,void*LightP,void*DarkP)
{//live1d=niveau de remplissage dark pour la barre de vie à gauche ; mana2l=niveau de remplissage light pour la barre de mana à droite
const short lrectwidth=(100-clock_percetage_of_screen)*LCDx/(2*100);
const short rectheight=clock_percetage_of_screen*LCDy/(2*100);
char temp[JoueurCharMax+1]="";strncat(temp,player[0].name,JoueurCharMax);
const unsigned long textlen=JoueurCharMax;
//=max(strlen(player[0].name),strlen(player[1].name));
//textlen=min(textlen,(unsigned long)JoueurCharMax);
const short xxa=LCDx-textlen*(is89?4:6)-2;
const short yya=rectheight+2;
GrayDrawStrExt2B(0,yya,temp,A_REPLACE | A_SHADOWED ,is89?F_4x6:F_6x8,LightP,DarkP);
temp[0]=0;
strncat(temp,player[1].name,JoueurCharMax);
GrayDrawStrExt2B(xxa,yya,temp,A_REPLACE | A_SHADOWED ,is89?F_4x6:F_6x8,LightP,DarkP);
GrayDrawRect2B(0,0,lrectwidth,rectheight,COLOR_WHITE,RECT_FILLED,LightP,DarkP);
GrayDrawRect2B(0,0,lrectwidth,rectheight,COLOR_BLACK,RECT_EMPTY,LightP,DarkP);
short rect1lstart=(lrectwidth-2)*live1d/100+1;
GrayDrawRect2B(1,1,rect1lstart,rectheight-1,COLOR_DARKGRAY,RECT_FILLED,LightP,DarkP);
short xxb=rect1lstart+(lrectwidth-2)*(live1l-live1d)/100;
if(live1l>live1d)GrayDrawRect2B(rect1lstart,1,xxb,rectheight-1,COLOR_LIGHTGRAY,RECT_FILLED,LightP,DarkP);
const short xxc=LCDx-lrectwidth;
GrayDrawRect2B(xxc,0,LCDx-1,rectheight,COLOR_WHITE,RECT_FILLED,LightP,DarkP);
GrayDrawRect2B(xxc,0,LCDx-1,rectheight,COLOR_BLACK,RECT_EMPTY,LightP,DarkP);
short xxd=LCDx-(lrectwidth-2)*live2d/100;
GrayDrawRect2B(xxd,1,LCDx-2,rectheight-1,COLOR_DARKGRAY,RECT_FILLED,LightP,DarkP);
short rect2dstart=xxd+1;
short xxe=rect2dstart-(lrectwidth-2)*(live2l-live2d)/100;
if(live2l>live2d)GrayDrawRect2B(xxe,1,rect2dstart,rectheight-1,COLOR_LIGHTGRAY,RECT_FILLED,LightP,DarkP);
const short xxf=textlen*(is89?4:6)+2;
const short mrectwidth=lrectwidth-xxf-1;
const short xxg=xxf-2+mrectwidth-1;
const short yyg=yya+rectheight;
GrayDrawRect2B(xxf,yya,xxg,yyg,COLOR_WHITE,RECT_FILLED,LightP,DarkP);
GrayDrawRect2B(xxf,yya,xxg,yyg,COLOR_BLACK,RECT_EMPTY,LightP,DarkP);
short mrect1lstart=(mrectwidth-2)*mana1d/100+xxf+2;
GrayDrawRect2B(xxf+1,rectheight+3,mrect1lstart-1,yyg-1,COLOR_DARKGRAY,RECT_FILLED,LightP,DarkP);
short xxh=mrect1lstart+(mrectwidth-2)*(mana1l-mana1d)/100;
if(mana1l>mana1d)GrayDrawRect2B(mrect1lstart,rectheight+3,xxh,yyg-1,COLOR_LIGHTGRAY,RECT_FILLED,LightP,DarkP);
const short xxi=LCDx-1-xxf;
GrayDrawRect2B(xxc,yya,xxi,yyg,COLOR_WHITE,RECT_FILLED,LightP,DarkP);
GrayDrawRect2B(xxc,yya,xxi,yyg,COLOR_BLACK,RECT_EMPTY,LightP,DarkP);
short xxj=xxc+1+mrectwidth*(100-mana2d)/100-3;
GrayDrawRect2B(xxj,yya+1,xxi-1,yyg-1,COLOR_DARKGRAY,RECT_FILLED,LightP,DarkP);
short mrect2dstart=xxc+1+(100-mana2l)*mrectwidth/100;
if(mana2l>mana2d)GrayDrawRect2B(mrect2dstart-3,yya+1,xxj-1,yyg-1,COLO
J'ai l'impression d'etre maladroit dans ces calculs.
Si jai bien compris les const short ne sont calculés qu'une seule fois?
(et donc je ne perd pas du temps a re-calculer a chaque fois)
Si au premier regard vous voyez un manque de methode, dites le moi!
remarque: si je desactive ces barres de vie et d'energie je gagne +2FPS
LCDx=240 ou 160 suivant la TI
clock_percetage_of_screen=taille de l'espace vide entre les barres pour afficher le TIME LEFT
projet en cours XiaoXiaoShow