|
Mise à jour : 14/10/2009
Difficulté :
Difficile
282 visites depuis 7 jours,
classé 354/786
|
), et vous voulez qu'ils disparaissent 3 secondes plus tard, donc il faut utiliser les timers !
...1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <PA9.h> int main(int argc,char **argv) { PA_Init(); PA_InitVBL(); PA_InitText(1,0); PA_VBLCounterStart(0); while(1) { PA_OutputText(1,0,0,"%d secondes",PA_VBLCounter[0]/60); PA_WaitForVBL(); } return 0; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | int bi(int y) { if((!(y%4)&&!(y%1000))||(!(y%4)&&(y%100))) return 1; else return 0; } unsigned int getTicks(void) { unsigned int ret=0; int i; unsigned int mois[12]={31,0,31,30,31,30,31,31,30,31,30,31}; for(i=0;i<30+PA_RTC.Year;i++) ret+=(bi(1970+i)?366:365)*24*3600; for(i=0;i<PA_RTC.Month-1;i++) { mois[1]=(bi(2000+PA_RTC.Year)?29:28); ret+=mois[i]*24*3600; } ret+=(PA_RTC.Day-1)*24*3600; ret+=PA_RTC.Seconds+PA_RTC.Minutes*60+(PA_RTC.Hour-1)*3600; return ret; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <PA9.h> int main(int argc, char ** argv) { PA_Init(); PA_InitVBL(); PA_InitText(1,0); PA_WaitForVBL();PA_WaitForVBL();PA_WaitForVBL(); unsigned int debut=getTicks(); while(1) { PA_OutputText(1,0,0,"%d",getTicks()-debut); // Affiche le nombre de secondes depuis que le jeu est lancé PA_WaitForVBL(); } return 0; } |
!
...Il n'y a pas encore de commentaire pour ce tuto.