games/juggle, games/catclock: keep up with queued mouse events
many queued mouse events delay eresize() because new ebread() takes from the queue first before attempting to read from the event pipe. this is a waste of memory, so just process (dequeue) all the events as long as there are any on each iteration.
This commit is contained in:
parent
883ded7b49
commit
762093d212
2 changed files with 2 additions and 2 deletions
|
@ -118,7 +118,7 @@ void main(int argc, char *argv[]){
|
|||
eye[i]=draweye(i*PI/NTAIL);
|
||||
}
|
||||
for(;;){
|
||||
if(ecanmouse()) emouse(); /* don't get resize events without this! */
|
||||
while(ecanmouse()) emouse(); /* don't get resize events without this! */
|
||||
drawclock();
|
||||
flushimage(display, 1);
|
||||
// bflush();
|
||||
|
|
|
@ -76,7 +76,7 @@ Point bpos(int b, int step, int t){
|
|||
void move(int t){
|
||||
int i, j;
|
||||
for(i=0;i!=NSTEP;i++){
|
||||
if(ecanmouse()) emouse();
|
||||
while(ecanmouse()) emouse();
|
||||
draw(image, inset(image->r, 3), display->white, nil, ZP);
|
||||
for(j=0;j!=nball;j++)
|
||||
fillellipse(image, bpos(j, i, t), RBALL, RBALL, disk[j%ndisk], ZP);
|
||||
|
|
Loading…
Reference in a new issue