From: <cl...@us...> - 2009-03-23 03:39:55
|
Revision: 110 http://fortress.svn.sourceforge.net/fortress/?rev=110&view=rev Author: clrg Date: 2009-03-23 03:39:40 +0000 (Mon, 23 Mar 2009) Log Message: ----------- Update prototype 1 to work with latest Vexi Modified Paths: -------------- branches/prototype1/src/net/sourceforge/fortress/app.t branches/prototype1/src/net/sourceforge/fortress/map.t branches/prototype1/src/net/sourceforge/fortress/minimap.t branches/prototype1/src/net/sourceforge/fortress/preloadimages.t Added Paths: ----------- branches/prototype1/.vexipath Added: branches/prototype1/.vexipath =================================================================== --- branches/prototype1/.vexipath (rev 0) +++ branches/prototype1/.vexipath 2009-03-23 03:39:40 UTC (rev 110) @@ -0,0 +1,8 @@ +{ + "source" : [ + "F/fortress-prototype1/src", + "LVexi Game Library", + "LVexi Platform" + ], + "projects" : [ ] +} \ No newline at end of file Modified: branches/prototype1/src/net/sourceforge/fortress/app.t =================================================================== --- branches/prototype1/src/net/sourceforge/fortress/app.t 2009-03-23 03:23:13 UTC (rev 109) +++ branches/prototype1/src/net/sourceforge/fortress/app.t 2009-03-23 03:39:40 UTC (rev 110) @@ -3,22 +3,22 @@ <vexi xmlns:ui="vexi://ui" xmlns="net.sourceforge.fortress" xmlns:widget="vexi.widget"> <widget:surface /> <preloadimages /> - <ui:box titlebar="Fortress Prototype"> - <ui:box orient="vertical" shrink="true"> + <ui:box framewidth="640" frameheight="480" titlebar="Fortress Prototype v1"> + <ui:box fill="black" orient="vertical" hshrink="true"> <minimap /> <ui:box fill="#888888" height="1" /> <ui:box height="5" /> - <ui:box id="tiletype" align="center" textcolor="white" /> + <ui:box id="tiletype" textcolor="white" vshrink="true" /> <ui:box height="5" /> - <ui:box id="position" align="center" textcolor="white" /> + <ui:box id="position" textcolor="white" vshrink="true" /> + <ui:box /> </ui:box> <ui:box fill="#888888" width="1" hshrink="true" /> <map id="map" /> vexi.ui.frame = thisbox; - $map.active ++= function(v) - { + $map.active ++= function(v) { $position.text = "( "+$map.activeTile.posx+", "+$map.activeTile.posy+" )"; $tiletype.text = $map.activeTile.type; cascade = v; Modified: branches/prototype1/src/net/sourceforge/fortress/map.t =================================================================== --- branches/prototype1/src/net/sourceforge/fortress/map.t 2009-03-23 03:23:13 UTC (rev 109) +++ branches/prototype1/src/net/sourceforge/fortress/map.t 2009-03-23 03:39:40 UTC (rev 110) @@ -1,7 +1,7 @@ <!-- Copyright 2007 licensed under GPL v3 --> <vexi xmlns:ui="vexi://ui" xmlns="net.sourceforge.fortress"> - <ui:box layout="absolute"> + <ui:box align="topleft" layout="place"> <ui:box id="map" shrink="true" /> <ui:box id="cur" fill="#88ffffff" display="false" /> @@ -10,44 +10,40 @@ //////// sample road creation ///////////////////////////////// - var createMudTile = function(tile) - { + var createMudTile = function(tile) { if (tile.type == "mud") return; var posx = tile.posx; var posy = tile.posy; var comp = ""; - if (posy > 0 and $map[posx][posy-1].type == "mud") - { + + if (posy > 0 and $map[posx][posy-1].type == "mud") { var nt = $map[posx][posy-1]; nt.comp = nt.comp.substring(0, 2) + "m" + nt.comp.substring(3); nt.sync(); comp = comp + "m"; - } - else comp = comp + "_"; - if ($map.numchildren > posx+1 and $map[posx+1][posy].type == "mud") - { + } else comp = comp + "_"; + + if ($map.numchildren > posx+1 and $map[posx+1][posy].type == "mud") { var nt = $map[posx+1][posy]; nt.comp = nt.comp.substring(0, 3) + "m"; nt.sync(); comp = comp + "m"; - } - else comp = comp + "_"; - if ($map[posx].numchildren > posy+1 and $map[posx][posy+1].type != "grass") - { + } else comp = comp + "_"; + + if ($map[posx].numchildren > posy+1 and $map[posx][posy+1].type != "grass") { var nt = $map[posx][posy+1]; nt.comp = "m" + nt.comp.substring(1); nt.sync(); comp = comp + "m"; - } - else comp = comp + "_"; - if (posx > 0 and $map[posx-1][posy].type != "grass") - { + } else comp = comp + "_"; + + if (posx > 0 and $map[posx-1][posy].type != "grass") { var nt = $map[posx-1][posy]; nt.comp = nt.comp.substring(0, 1) + "m" + nt.comp.substring(2); nt.sync(); comp = comp + "m"; - } - else comp = comp + "_"; + } else comp = comp + "_"; + tile.seed = ""; tile.type = "mud"; tile.comp = comp; @@ -55,26 +51,24 @@ surface.setMapTile(tile); } - var sr1Func = function(v) - { + var sr1Func = function(v) { + cascade = v; drag1 = false; - surface.Focused --= sr1Func; - surface._Release1 --= sr1Func; + surface.frame.Focused --= sr1Func; + surface.event._Release1 --= sr1Func; } - thisbox.Press1 ++= function(v) - { + thisbox.Press1 ++= function(v) { if (!activeTile or drag2) return; createMudTile(activeTile); drag1 = true; - surface.Focused ++= sr1Func; - surface._Release1 ++= sr1Func; + surface.frame.Focused ++= sr1Func; + surface.event._Release1 ++= sr1Func; } //////// minimap interaction ////////////////////////////////// - var mapDim = function(v) - { + var mapDim = function(v) { cascade = v; surface.setMapDim($map.width, $map.height); } @@ -82,8 +76,7 @@ $map.width ++= mapDim; $map.height ++= mapDim; - var mapBox = function(v) - { + var mapBox = function(v) { cascade = v; surface.setMapBox(width, height); } @@ -100,8 +93,7 @@ var vx; var vy; - var dragMove = function(v) - { + var dragMove = function(v) { var m = thisbox.mouse; var nx = ox + m.x - mx; var ny = oy + m.y - my; @@ -113,17 +105,15 @@ cascade = v; } - var dragStop = function(v) - { - surface.delMoveTrap(dragMove); - surface._Release2 --= dragStop; + var dragStop = function(v) { + surface.event.delMoveTrap(dragMove); + surface.event._Release2 --= dragStop; drag2 = false; cascade = v; active = true; } - var dragStart = function(v) - { + var dragStart = function(v) { if (drag1) return; drag2 = true; $cur.display = false; @@ -134,8 +124,8 @@ oy = $map.y; vx = width - $map.width; vy = height - $map.height; - surface.addMoveTrap(dragMove); - surface._Release2 ++= dragStop; + surface.event.addMoveTrap(dragMove); + surface.event._Release2 ++= dragStop; cascade = v; } @@ -145,8 +135,8 @@ thisbox.activeTile = null; - thisbox.active ++= function(v) - { + thisbox.active ++= function(v) { + cascade = v; var d = thisbox.distanceto(activeTile); $cur.display = true; $cur.width = activeTile.width; @@ -155,22 +145,22 @@ $cur.y = d.y; } - var enterFunc = function(v) - { + var enterFunc = function(v) { cascade = v; activeTile = trapee; if (drag1) createMudTile(trapee); if (!drag2) active = true; } - thisbox.Leave ++= function(v) { $cur.display = false; } + thisbox.Leave ++= function(v) { + cascade = v; + $cur.display = false; + } - for (var i=0; 100>i; i++) - { + for (var i=0; 100>i; i++) { $map[i] = vexi.box; $map[i].orient = "vertical"; - for (var j=0; 100>j; j++) - { + for (var j=0; 100>j; j++) { var t = .maptile(vexi.box); t.Enter ++= enterFunc; t.posx = i; @@ -179,13 +169,11 @@ } } - surface ++= function(v) - { + surface ++= function(v) { cascade = v; surface.setMapContents($map); - surface.moveMapTo = function(x, y) - { + surface.moveMapTo = function(x, y) { var d = $map.distanceto($map[x][y]); var dx = width/2 - d.x; var dy = height/2 - d.y; Modified: branches/prototype1/src/net/sourceforge/fortress/minimap.t =================================================================== --- branches/prototype1/src/net/sourceforge/fortress/minimap.t 2009-03-23 03:23:13 UTC (rev 109) +++ branches/prototype1/src/net/sourceforge/fortress/minimap.t 2009-03-23 03:39:40 UTC (rev 110) @@ -1,8 +1,8 @@ <!-- Copyright 2007 licensed under GPL v3 --> <vexi xmlns:ui="vexi://ui" xmlns="net.sourceforge.fortress"> - <ui:box height="100" width="100" layout="absolute"> - <ui:box layout="absolute"> + <ui:box height="100" width="100" layout="place"> + <ui:box align="topleft" layout="place"> $minimap.width ++= function(v) { cascade = v; width = v; } $minimap.height ++= function(v) { cascade = v; height = v; } <ui:box id="minimap" shrink="true" /> @@ -24,73 +24,63 @@ var vw = 1; var vh = 1; - var syncView = function() - { + var syncView = function() { $viewbox.width = $minimap.width * (vw / mw) + 1; $viewbox.height = $minimap.height * (vh / mh) + 1; $viewbox.x = $minimap.width * (-mx / mw); $viewbox.y = $minimap.height * (-my / mh); } - var moveMapFunc = function(v) - { - vexi.log.info(v); + var moveMapFunc = function(v) { + cascade = v; // assumes minimap tiles are 1px by 1px surface.moveMapTo(mouse.x, mouse.y); - cascade = v; } - var releaseFunc = function(v) - { + var releaseFunc = function(v) { + cascade = v; Move --= moveMapFunc; - surface.Focused --= releaseFunc; - surface._Release1 --= releaseFunc; + surface.frame.Focused --= releaseFunc; + surface.event._Release1 --= releaseFunc; } - var pressFunc = function(v) - { + var pressFunc = function(v) { + cascade = v; Move ++= moveMapFunc; - surface.Focused ++= releaseFunc; - surface._Release1 ++= releaseFunc; + surface.frame.Focused ++= releaseFunc; + surface.event._Release1 ++= releaseFunc; } thisbox.Press1 ++= pressFunc; - surface ++= function(v) - { + surface ++= function(v) { cascade = v; - surface.setMapBox = function(_vw, _vh) - { + surface.setMapBox = function(_vw, _vh) { vw = _vw; vh = _vh; syncView(); } - surface.setMapDim = function(_mw, _mh) - { + surface.setMapDim = function(_mw, _mh) { mw = _mw; mh = _mh; syncView(); } - surface.setMapPos = function(_mx, _my) - { + surface.setMapPos = function(_mx, _my) { mx = _mx; my = _my; syncView(); } - surface.setMapContents = function(map) - { + surface.setMapContents = function(map) { var ni = map.numchildren; var nj = map[0].numchildren; - for (var i=0; ni > i; i++) - { + for (var i=0; ni > i; i++) { $minimap[i] = vexi.box; $minimap[i].orient = "vertical"; - for (var j=0; nj > j; j++) - { + 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); @@ -99,8 +89,7 @@ } } - surface.setMapTile = function(t) - { + surface.setMapTile = function(t) { $minimap[t.posx][t.posy].setType(t.type, t.seed); } } Modified: branches/prototype1/src/net/sourceforge/fortress/preloadimages.t =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |