From: dsc Date: Wed, 24 Nov 2010 10:47:07 +0000 (-0800) Subject: Y.subclass over new Y.Class X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=fc2716b0c1163179689962a11fc9380e7d539a76;p=tanks.git Y.subclass over new Y.Class --- diff --git a/doc/roadmap.md b/doc/roadmap.md new file mode 100644 index 0000000..efb4c0c --- /dev/null +++ b/doc/roadmap.md @@ -0,0 +1,8 @@ +# Littlest Roadmap + +- UI for config system +- Animations +- Items +- Level transitions +- Improve friendly fire of AI + diff --git a/src/lessly/bitgrid.js b/src/lessly/bitgrid.js index 815b3b5..eb7c70c 100644 --- a/src/lessly/bitgrid.js +++ b/src/lessly/bitgrid.js @@ -20,7 +20,7 @@ function toY(y){ return Math.floor(y/CELL_Y); } * TODO: Make rect() routines agnostic to cell dimensions * TODO: Optimize set operations */ -BitGrid = new Y.Class('BitGrid', { +BitGrid = Y.subclass('BitGrid', { init : function init(w, h){ this.width = w; this.height = h; diff --git a/src/lessly/log.js b/src/lessly/log.js index 3fa7703..9d339f3 100644 --- a/src/lessly/log.js +++ b/src/lessly/log.js @@ -1,4 +1,4 @@ -Log = new Y.Class('Log', { +Log = Y.subclass('Log', { _n : 0, DEFAULT_OPTIONS : { autoScroll : true, diff --git a/src/portal/layer.js b/src/portal/layer.js index bd61600..b6cd536 100644 --- a/src/portal/layer.js +++ b/src/portal/layer.js @@ -9,7 +9,7 @@ var CONTEXT_ATTRS = Y([ -Layer = new Y.Class('Layer', { +Layer = Y.subclass('Layer', { _cssClasses : 'portal layer', canvas : null, diff --git a/src/portal/loop/cooldown.js b/src/portal/loop/cooldown.js index 5ba12cd..1a61a37 100644 --- a/src/portal/loop/cooldown.js +++ b/src/portal/loop/cooldown.js @@ -1,4 +1,4 @@ -Cooldown = new Y.Class('Cooldown', { +Cooldown = Y.subclass('Cooldown', { 'init' : function(cooldown, isReady){ this.cooldown = cooldown; // ms this.ready = isReady || true; diff --git a/src/portal/loop/fps.js b/src/portal/loop/fps.js index 663afc8..9038237 100644 --- a/src/portal/loop/fps.js +++ b/src/portal/loop/fps.js @@ -1,4 +1,4 @@ -FpsSparkline = new Y.Class('FpsSparkline', { +FpsSparkline = Y.subclass('FpsSparkline', { init : function init(loop, el, w,h, maxBuffer, interval){ this.buffer = []; diff --git a/src/portal/util/tree/pointquadtree.js b/src/portal/util/tree/pointquadtree.js index 28d2e16..38b7222 100644 --- a/src/portal/util/tree/pointquadtree.js +++ b/src/portal/util/tree/pointquadtree.js @@ -39,7 +39,7 @@ LeafType = { } }, -Node = new Y.Class('Node', { +Node = Y.subclass('Node', { init : function Node(x, y, w, h, parent) { this.w = w; this.h = h; @@ -130,7 +130,7 @@ Range = new Y.Class('Range', Y.YCollection, { } }), -Leaf = new Y.Class('Leaf', { +Leaf = Y.subclass('Leaf', { toString : function toString(){ return LeafType.toString(this.type)+'('+this.x+','+this.y+', value='+this.value+')'; } @@ -191,7 +191,7 @@ RangeCell = new Y.Class('RangeCell', Leaf, { } }), -PointQuadTree = new Y.Class('PointQuadTree', { +PointQuadTree = Y.subclass('PointQuadTree', { 'init' : function(minX,minY, maxX,maxY) { this.x1 = this.x = minX; this.y1 = this.y = minY; diff --git a/src/portal/util/tree/quadtree.js b/src/portal/util/tree/quadtree.js index 8b23c47..5f92556 100644 --- a/src/portal/util/tree/quadtree.js +++ b/src/portal/util/tree/quadtree.js @@ -25,7 +25,7 @@ var CAPACITY = 8, REGION_ID = 0, -Region = new Y.Class('Region', { +Region = Y.subclass('Region', { init : function init(x1,y1, x2,y2, value){ Rect.call(this, x1,y1, x2,y2); this.id = REGION_ID++; @@ -43,7 +43,7 @@ Region = new Y.Class('Region', { } }), -QuadTree = new Y.Class('QuadTree', { +QuadTree = Y.subclass('QuadTree', { depth : 0, parent : null, regions : [], diff --git a/src/portal/util/tree/rbtree.js b/src/portal/util/tree/rbtree.js index 1c71b2f..a5cb4e1 100644 --- a/src/portal/util/tree/rbtree.js +++ b/src/portal/util/tree/rbtree.js @@ -26,7 +26,7 @@ Node.prototype.toString = function(){ }; var -RedBlackTree = new Y.Class('RedBlackTree', { +RedBlackTree = Y.subclass('RedBlackTree', { init : function init(key, value){ if (this.key !== undefined) this.setKey(key, value); diff --git a/src/tanks/config.js b/src/tanks/config.js index 6386908..ed61e1b 100644 --- a/src/tanks/config.js +++ b/src/tanks/config.js @@ -1,12 +1,16 @@ // -*- mode: JavaScript; tab-width: 4; indent-tabs-mode: nil; -*- tanks.config = { - ui : { - showGridCoords : false, - showCountdown : false - }, - pathing : { - overlayAIPaths : true, - overlayPathmap : false, - traceTrajectories : false + defaults : { + ui : { + showGridCoords : false, + showCountdown : true + }, + pathing : { + overlayAIPaths : false, + overlayPathmap : false, + traceTrajectories : false + } } }; + +tanks.config.values = Y(tanks.config.defaults).clone().end(); \ No newline at end of file diff --git a/src/tanks/game.js b/src/tanks/game.js index b3cf024..e6cdbf0 100644 --- a/src/tanks/game.js +++ b/src/tanks/game.js @@ -1,4 +1,4 @@ -tanks.Game = new Y.Class('Game', { +tanks.Game = Y.subclass('Game', { overlayPathmap : false, diff --git a/src/tanks/map/level.js b/src/tanks/map/level.js index a3c6d2b..9c050d2 100644 --- a/src/tanks/map/level.js +++ b/src/tanks/map/level.js @@ -29,8 +29,8 @@ Level = Rect.subclass('Level', { E = game.addUnit(new Tank(2), 0,1); - // game.addUnit(new Tank(2), 1,0); - // game.addUnit(new Tank(2), 8,1); + game.addUnit(new Tank(2), 1,0); + game.addUnit(new Tank(2), 8,1); }, addWall : function addWall(x,y, w,h, isBoundary){ diff --git a/src/tanks/ui/config.js b/src/tanks/ui/config.js index 479fc9d..9076096 100644 --- a/src/tanks/ui/config.js +++ b/src/tanks/ui/config.js @@ -34,7 +34,7 @@ Y.YString.prototype.splitCamel = // - Update tanks.config.values var ns = tanks.ui.config = {} -, c = tanks.config +, c = tanks.config.values , p = c.pathing ; diff --git a/src/tanks/util/config.js b/src/tanks/util/config.js new file mode 100644 index 0000000..2404089 --- /dev/null +++ b/src/tanks/util/config.js @@ -0,0 +1,5 @@ +Config = Y.subclass('Config', { + + + +}); \ No newline at end of file