|
From: <cl...@us...> - 2007-12-02 03:44:05
|
Revision: 98
http://fortress.svn.sourceforge.net/fortress/?rev=98&view=rev
Author: clrg
Date: 2007-12-01 19:44:08 -0800 (Sat, 01 Dec 2007)
Log Message:
-----------
Start anew, learning the lessons of old and being a bit smarter
Added Paths:
-----------
trunk/fortress/.project
trunk/fortress/src/
trunk/fortress/src/fortress/
trunk/fortress/src/fortress/icon.t
trunk/fortress/src/fortress/image/
trunk/fortress/src/fortress/image/compass.png
trunk/fortress/src/fortress/image/grass.png
trunk/fortress/src/fortress/image/grid.png
trunk/fortress/src/fortress/image/grid_select.png
trunk/fortress/src/fortress/image/hammer.png
trunk/fortress/src/fortress/image/pickaxe.png
trunk/fortress/src/fortress/image/scroll.png
trunk/fortress/src/fortress/main.t
Added: trunk/fortress/.project
===================================================================
--- trunk/fortress/.project (rev 0)
+++ trunk/fortress/.project 2007-12-02 03:44:08 UTC (rev 98)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>fortress</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ <nature>org.vexi.vexidev.vexiNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/fortress/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/fortress/src/fortress/icon.t
===================================================================
--- trunk/fortress/src/fortress/icon.t (rev 0)
+++ trunk/fortress/src/fortress/icon.t 2007-12-02 03:44:08 UTC (rev 98)
@@ -0,0 +1,29 @@
+<vexi xmlns:ui="vexi://ui" xmlns="fortress"
+ xmlns:lay="vexi.layout">
+ <ui:box layout="layer" shrink="true">
+ <lay:border id="outer" depth="1">
+ <lay:border id="inner" depth="1" />
+ </lay:border>
+ <ui:box id="image" cursor="hand" />
+
+ thisbox.border ++= function(v) {
+ $outer.border = v ? "#88"+v.substring(1) : null;
+ $inner.border = v;
+ return;
+ }
+
+ Enter ++= function(v) { if (!selected) border = "#ffff00"; return; }
+ Leave ++= function(v) { if (!selected) border = null; return; }
+
+ thisbox.selected ++= function(v) {
+ cascade = v;
+ border = v ? "#ff9900" : (mouse.inside ? "#ffff00" : null);
+ }
+
+ thisbox.image ++= function(v) {
+ cascade = v;
+ $image.fill = .image[v];
+ }
+
+ </ui:box>
+</vexi>
\ No newline at end of file
Added: trunk/fortress/src/fortress/image/compass.png
===================================================================
(Binary files differ)
Property changes on: trunk/fortress/src/fortress/image/compass.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/fortress/src/fortress/image/grass.png
===================================================================
(Binary files differ)
Property changes on: trunk/fortress/src/fortress/image/grass.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/fortress/src/fortress/image/grid.png
===================================================================
(Binary files differ)
Property changes on: trunk/fortress/src/fortress/image/grid.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/fortress/src/fortress/image/grid_select.png
===================================================================
(Binary files differ)
Property changes on: trunk/fortress/src/fortress/image/grid_select.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/fortress/src/fortress/image/hammer.png
===================================================================
(Binary files differ)
Property changes on: trunk/fortress/src/fortress/image/hammer.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/fortress/src/fortress/image/pickaxe.png
===================================================================
(Binary files differ)
Property changes on: trunk/fortress/src/fortress/image/pickaxe.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/fortress/src/fortress/image/scroll.png
===================================================================
(Binary files differ)
Property changes on: trunk/fortress/src/fortress/image/scroll.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/fortress/src/fortress/main.t
===================================================================
--- trunk/fortress/src/fortress/main.t (rev 0)
+++ trunk/fortress/src/fortress/main.t 2007-12-02 03:44:08 UTC (rev 98)
@@ -0,0 +1,78 @@
+<vexi xmlns:ui="vexi://ui" xmlns="fortress"
+ xmlns:role="org.vexi.lib.role"
+ xmlns:lay="vexi.layout"
+ xmlns:wi="vexi.widget">
+ <wi:surface />
+ <ui:box framewidth="640" frameheight="480">
+ <ui:box layout="place">
+ <role:draggable id="board" align="bottomleft" layout="layer" width="4000" height="2000" fill=":.image.grass">
+ <ui:box id="grid" fill=":.image.grid" />
+ <ui:box id="select" align="bottomleft" fill=":.image.grid_select" shrink="true" />
+ </role:draggable>
+ <lay:pad id="icons" align="bottom" padding="10" vshrink="true">
+ <ui:box fill=":.image.compass" shrink="true" />
+ <ui:box />
+ <icon id="build" image="hammer" />
+ <ui:box width="10" />
+ <icon id="build" image="pickaxe" />
+ <ui:box width="10" />
+ <icon id="build" image="scroll" />
+ </lay:pad>
+ </ui:box>
+
+ ////////
+ // icon handling
+
+ var selected;
+
+ var selectIcon = function(v) {
+ var deselect = trapee == selected;
+ if (selected) {
+ selected.selected = false;
+ selected = null;
+ if (deselect) return;
+ }
+ selected = trapee;
+ selected.selected = true;
+ return;
+ }
+
+ for (var i=0; $icons.numchildren>i; i++) {
+ $icons[i].Press1 ++= selectIcon;
+ }
+
+ $board.Move ++= function(v) {
+ cascade = v;
+ var board_m = $board.mouse;
+ $select.x = board_m.x - board_m.x%50;
+ $select.y = board_m.y - board_m.y%25 - $board.height + 25;
+ }
+
+ ////////
+ // map dragging
+
+ var limitx;
+ var limity;
+ var startx;
+ var starty;
+
+ $board.dragStart ++= function(v) {
+ cascade = v;
+ limitx = width-$board.width;
+ limity = $board.height-height;
+ startx = $board.x;
+ starty = $board.y;
+ }
+
+ var max = function(a, b) { return a>b? a : b; }
+ var min = function(a, b) { return b>a? a : b; }
+ $board.dragUpdate ++= function(v) {
+ cascade = v;
+ $board.x = min(0, max(limitx, startx + v.x));
+ $board.y = max(0, min(limity, starty + v.y));
+ }
+
+ vexi.ui.frame = thisbox;
+
+ </ui:box>
+</vexi>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|