]> git.lizzy.rs Git - plan9front.git/commitdiff
games/galaxy: avoid unnecessary calculations
authorspew <devnull@localhost>
Sun, 12 Mar 2017 23:33:54 +0000 (18:33 -0500)
committerspew <devnull@localhost>
Sun, 12 Mar 2017 23:33:54 +0000 (18:33 -0500)
It is not necessary to recalculate the center of the
screen every time.

sys/src/games/galaxy/galaxy.c

index 8323e94da9aeb62a14b8c7fefd2515d83be440bd..57f9b7bbba291cbba19b382733d08aff0f2719a0 100644 (file)
@@ -357,13 +357,13 @@ dozoom(void)
        setcursor(mc, &zoomcursor);
        oxy = mc->xy;
        oscale = scale;
+       sc = screencenter();
        for(;;) {
                readmouse(mc);
                if(mc->buttons != 2)
                        break;
                d = subpt(mc->xy, oxy);
                z = tanh((double)d.y/200) + 1;
-               sc = screencenter();
                gsc = tovector(sc);
                pause(0, 0);
                scale = z*oscale;