From: <cl...@us...> - 2007-06-27 00:34:11
|
Revision: 15 http://fortress.svn.sourceforge.net/fortress/?rev=15&view=rev Author: clrg Date: 2007-06-26 17:34:09 -0700 (Tue, 26 Jun 2007) Log Message: ----------- Click on the minimap now moves the map too Modified Paths: -------------- trunk/Prototype/src/net/sourceforge/fortress/app.t trunk/Prototype/src/net/sourceforge/fortress/map.t trunk/Prototype/src/net/sourceforge/fortress/minimap.t Modified: trunk/Prototype/src/net/sourceforge/fortress/app.t =================================================================== --- trunk/Prototype/src/net/sourceforge/fortress/app.t 2007-06-27 00:20:34 UTC (rev 14) +++ trunk/Prototype/src/net/sourceforge/fortress/app.t 2007-06-27 00:34:09 UTC (rev 15) @@ -8,9 +8,9 @@ <minimap /> <ui:box fill="#888888" height="1" /> <ui:box height="5" /> - <ui:box id="tiletype" textcolor="white" /> + <ui:box id="tiletype" align="center" textcolor="white" /> <ui:box height="5" /> - <ui:box id="position" textcolor="white" /> + <ui:box id="position" align="center" textcolor="white" /> </ui:box> <ui:box fill="#888888" width="1" hshrink="true" /> <map id="map" /> Modified: trunk/Prototype/src/net/sourceforge/fortress/map.t =================================================================== --- trunk/Prototype/src/net/sourceforge/fortress/map.t 2007-06-27 00:20:34 UTC (rev 14) +++ trunk/Prototype/src/net/sourceforge/fortress/map.t 2007-06-27 00:34:09 UTC (rev 15) @@ -183,6 +183,16 @@ { cascade = v; surface.setMapContents($map); + + surface.moveMapTo = function(x, y) + { + var d = $map.distanceto($map[x][y]); + var dx = width/2 - d.x; + var dy = height/2 - d.y; + $map.x = 0 > dx ? (dx > width - $map.width ? dx : width - $map.width) : 0; + $map.y = 0 > dy ? (dy > height - $map.height ? dy : height - $map.height) : 0; + surface.setMapPos($map.x, $map.y); + } } </ui:box> Modified: trunk/Prototype/src/net/sourceforge/fortress/minimap.t =================================================================== --- trunk/Prototype/src/net/sourceforge/fortress/minimap.t 2007-06-27 00:20:34 UTC (rev 14) +++ trunk/Prototype/src/net/sourceforge/fortress/minimap.t 2007-06-27 00:34:09 UTC (rev 15) @@ -32,6 +32,13 @@ $viewbox.y = $minimap.height * (-my / mh); } + var moveMapFunc = function(v) + { + // assumes minimap tiles are 1px by 1px + var d = $minimap.distanceto(trapee); + surface.moveMapTo(d.x, d.y); + } + surface ++= function(v) { cascade = v; @@ -68,6 +75,7 @@ for (var j=0; nj > j; j++) { var t = .minimaptile(vexi.box); + t.Press1 ++= moveMapFunc; t.setType(map[i][j].type, map[i][j].seed); $minimap[i][j] = t; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |