From: <cl...@us...> - 2007-06-27 00:15:58
|
Revision: 12 http://fortress.svn.sourceforge.net/fortress/?rev=12&view=rev Author: clrg Date: 2007-06-26 17:16:00 -0700 (Tue, 26 Jun 2007) Log Message: ----------- Press1 and drag to create road and fix tile cursor display for updated Vexi Modified Paths: -------------- trunk/Prototype/src/net/sourceforge/fortress/map.t Modified: trunk/Prototype/src/net/sourceforge/fortress/map.t =================================================================== --- trunk/Prototype/src/net/sourceforge/fortress/map.t 2007-06-24 23:13:29 UTC (rev 11) +++ trunk/Prototype/src/net/sourceforge/fortress/map.t 2007-06-27 00:16:00 UTC (rev 12) @@ -5,16 +5,13 @@ <ui:box id="map" shrink="true" /> <ui:box id="cur" fill="#88ffffff" display="false" /> + var drag1 = false; + var drag2 = false; + //////// sample road creation ///////////////////////////////// - thisbox.Press1 ++= function(v) + var createMudTile = function(tile) { - if (!activeTile) return; - createMudTile(activeTile); - } - - thisbox.createMudTile = function(tile) - { if (tile.type == "mud") return; var posx = tile.posx; var posy = tile.posy; @@ -58,6 +55,22 @@ surface.setMapTile(tile); } + var sr1Func = function(v) + { + drag1 = false; + surface.Focused --= sr1Func; + surface.Release1 --= sr1Func; + } + + thisbox.Press1 ++= function(v) + { + if (!activeTile or drag2) return; + createMudTile(activeTile); + drag1 = true; + surface.Focused ++= sr1Func; + surface.Release1 ++= sr1Func; + } + //////// minimap interaction ////////////////////////////////// var mapDim = function(v) @@ -80,8 +93,6 @@ //////// map movement ///////////////////////////////////////// - var dragging = false; - var mx; var my; var ox; @@ -106,14 +117,15 @@ { surface.delMoveTrap(dragMove); surface._Release2 --= dragStop; - dragging = false; + drag2 = false; cascade = v; active = true; } var dragStart = function(v) { - dragging = true; + if (drag1) return; + drag2 = true; $cur.display = false; var m = thisbox.mouse; mx = m.x; @@ -135,19 +147,20 @@ thisbox.active ++= function(v) { - var d = $map.distanceto(activeTile); + var d = distanceto(activeTile); $cur.display = true; $cur.width = activeTile.width; $cur.height = activeTile.height; - $cur.x = d.x + $map.x; - $cur.y = d.y + $map.y; + $cur.x = d.x; + $cur.y = d.y; } var enterFunc = function(v) { cascade = v; activeTile = trapee; - if (!dragging) active = true; + if (drag1) createMudTile(trapee); + if (!drag2) active = true; } thisbox.Leave ++= function(v) { $cur.display = false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cl...@us...> - 2007-06-27 00:20:07
|
Revision: 13 http://fortress.svn.sourceforge.net/fortress/?rev=13&view=rev Author: clrg Date: 2007-06-26 17:20:09 -0700 (Tue, 26 Jun 2007) Log Message: ----------- Oops, really fix tile cursor display ;-) Modified Paths: -------------- trunk/Prototype/src/net/sourceforge/fortress/map.t Modified: trunk/Prototype/src/net/sourceforge/fortress/map.t =================================================================== --- trunk/Prototype/src/net/sourceforge/fortress/map.t 2007-06-27 00:16:00 UTC (rev 12) +++ trunk/Prototype/src/net/sourceforge/fortress/map.t 2007-06-27 00:20:09 UTC (rev 13) @@ -147,7 +147,7 @@ thisbox.active ++= function(v) { - var d = distanceto(activeTile); + var d = thisbox.distanceto(activeTile); $cur.display = true; $cur.width = activeTile.width; $cur.height = activeTile.height; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |