//vypis score/game over na LCD void print_score(char message[50]) { char pom_score[50]; LCD_clear(); LCD_append_string(message); sprintf(pom_score,"%d",score); LCD_append_string(pom_score); }
/******************************************************************************* * Zobrazeni casu na displeji *******************************************************************************/ int display_idle() { long microseconds, milliseconds, seconds, minutes, hours; char buf[20]; if (isrunning) t = get_time(); microseconds = (long)(((float)(t - t0))*TIMER_TICK); milliseconds = (long)(microseconds / 1000) % 1000; seconds = (((long)(microseconds / 1000) - milliseconds) / 1000) % 60; minutes = (((((long)(microseconds / 1000) - milliseconds) / 1000) - seconds) / 60) % 60; hours = ((((((long)(microseconds / 1000) - milliseconds) / 1000) - seconds) / 60) - minutes) / 60; if (hours < 10) { buf[0] = '0'; long2str(hours, &buf[1], 10); } else { long2str(hours, &buf[0], 10); } buf[2] = ':'; if (minutes < 10) { buf[3] = '0'; long2str(minutes, &buf[4], 10); } else { long2str(minutes, &buf[3], 10); } buf[5] = ':'; if (seconds < 10) { buf[6] = '0'; long2str(seconds, &buf[7], 10); } else { long2str(seconds, &buf[6], 10); } buf[8] = '.'; if (milliseconds < 10) { buf[9] = '0'; buf[10] = '0'; long2str(milliseconds, &buf[11], 10); } else if (milliseconds < 100) { buf[9] = '0'; long2str(milliseconds, &buf[10], 10); } else { long2str(milliseconds, &buf[9], 10); } buf[12] = '\0'; LCD_clear(); LCD_append_string(buf); return 0; }