Revision 142
fixed flicker
lab5.c | ||
---|---|---|
471 | 471 |
timer_int_handler(); |
472 | 472 |
if(no_interrupts == Nt*ticks_per_frame){ |
473 | 473 |
|
474 |
//if(vx) draw_rectangle(min(x-v,x),y , abs(v) , sprite_get_h(sp), 0);
|
|
475 |
//if(vy) draw_rectangle(x ,min(y-v,y),sprite_get_w(sp), abs(v) , 0);
|
|
474 |
if(vx) draw_rectangle((vx > 0 ? x : x+sprite_get_w(sp)+vx),y , abs(v) , sprite_get_h(sp), 0);
|
|
475 |
if(vy) draw_rectangle(x ,(vy > 0 ? y : y+sprite_get_h(sp)+vy),sprite_get_w(sp), abs(v) , 0);
|
|
476 | 476 |
|
477 | 477 |
vx = (vx > 0 ? min(vx, xf-x) : max(vx, xf-x) ); |
478 | 478 |
vy = (vy > 0 ? min(vy, yf-y) : max(vy, yf-y) ); |
479 | 479 |
x += vx; |
480 | 480 |
y += vy; |
481 | 481 |
sprite_set_pos(sp,x,y); |
482 |
clear_screen(); |
|
482 |
//clear_screen();
|
|
483 | 483 |
sprite_draw(sp); |
484 | 484 |
|
485 | 485 |
no_interrupts = 0; |
Also available in: Unified diff