summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspew <devnull@localhost>2017-03-10 10:37:12 -0600
committerspew <devnull@localhost>2017-03-10 10:37:12 -0600
commit2c6c64c47487dbe8af6a6dc450b33931ec937601 (patch)
treeac56b021395ffe5d05788d69f746cc73a6d493e6
parentacd1a3eddabf29ed08b5a0504b379141ab0e4acf (diff)
downloadplan9front-2c6c64c47487dbe8af6a6dc450b33931ec937601.tar.xz
games/galaxy: simplify zoom loop
-rw-r--r--sys/src/games/galaxy/galaxy.c30
1 files 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