git: 9front

Download patch

ref: dc8a83a16e5a78c6c0e74a0441fface3c291f735
parent: fe914952f84dbc5c6d860c49ff4ae211266f0ad9
author: spew <devnull@localhost>
date: Sun Mar 12 14:33:54 EDT 2017

games/galaxy: avoid unnecessary calculations
It is not necessary to recalculate the center of the
screen every time.

--- a/sys/src/games/galaxy/galaxy.c
+++ b/sys/src/games/galaxy/galaxy.c
@@ -357,6 +357,7 @@
 	setcursor(mc, &zoomcursor);
 	oxy = mc->xy;
 	oscale = scale;
+	sc = screencenter();
 	for(;;) {
 		readmouse(mc);
 		if(mc->buttons != 2)
@@ -363,7 +364,6 @@
 			break;
 		d = subpt(mc->xy, oxy);
 		z = tanh((double)d.y/200) + 1;
-		sc = screencenter();
 		gsc = tovector(sc);
 		pause(0, 0);
 		scale = z*oscale;
--