Project

General

Profile

Revision 319

documented font. also changed a bit the timer

View differences:

proj_func.c
284 284
    if (ret == NULL) return NULL;
285 285
    ret->time = 0;
286 286
    ret->text = text_ctor(fnt, "000s");
287
    ret->array = text_get_string(ret->text);
288 287
    text_set_color(ret->text, TEXT_COLOR);
289 288
    return ret;
290 289
}
......
292 291
void (timer_update)(text_timer_t *p){
293 292
    if (p->time >= 999) return;
294 293
    p->time++;
295
    p->array[2] = p->time % 10 + '0';
296
    p->array[1] = (p->time/10) % 10 + '0';
297
    p->array[0] = (p->time/100) % 10 + '0';
294
    char buffer[100];
295
    sprintf(buffer, "%03ds", p->time);
296
    text_set_string(p->text, buffer);
298 297
}
299 298

  
300 299
void (timer_reset)(text_timer_t *p){
301
    p->time = 0;
302
    p->array[2] = '0';
303
    p->array[1] = '0';
304
    p->array[0] = '0';
300
    text_set_string(p->text, "000s");
305 301
}
306 302

  
307 303
void (timer_dtor)(text_timer_t *p){

Also available in: Unified diff