From 3f2d3721ded93048c8f8897a3c28e61852475e7e Mon Sep 17 00:00:00 2001 From: spew Date: Sun, 12 Mar 2017 18:33:54 -0500 Subject: games/galaxy: avoid unnecessary calculations It is not necessary to recalculate the center of the screen every time. --- sys/src/games/galaxy/galaxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/games/galaxy/galaxy.c b/sys/src/games/galaxy/galaxy.c index 8323e94da..57f9b7bbb 100644 --- a/sys/src/games/galaxy/galaxy.c +++ b/sys/src/games/galaxy/galaxy.c @@ -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; -- cgit v1.2.3