From 2c6c64c47487dbe8af6a6dc450b33931ec937601 Mon Sep 17 00:00:00 2001 From: spew Date: Fri, 10 Mar 2017 10:37:12 -0600 Subject: games/galaxy: simplify zoom loop --- sys/src/games/galaxy/galaxy.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/sys/src/games/galaxy/galaxy.c b/sys/src/games/galaxy/galaxy.c index b76e0ca5e..d81b34123 100644 --- a/sys/src/games/galaxy/galaxy.c +++ b/sys/src/games/galaxy/galaxy.c @@ -356,33 +356,23 @@ dozoom(void) double f, olds; setcursor(mc, &zoomcursor); + + z = mc->xy; + olds = scale; for(;;) { - for(;;) { - readmouse(mc); - if(mc->buttons == 0) - continue; - if(mc->buttons != 2) - goto End; + readmouse(mc); + if(mc->buttons != 2) break; - } - z = mc->xy; - olds = scale; + d = subpt(mc->xy, z); + f = tanh((double)d.y/200) + 1; pause(0, 0); - for(;;) { - readmouse(mc); - if(mc->buttons != 2) - break; - drawglxy(); - line(screen, z, (Point){z.x, mc->xy.y}, Enddisc, Enddisc, 0, display->white, ZP); - d = subpt(mc->xy, z); - f = tanh((double)d.y/200) + 1; - scale = f*olds; - } + scale = f*olds; + drawglxy(); pause(1, 0); } -End: setcursor(mc, cursor); + pause(1, 0); } void -- cgit v1.2.3