__all__ = ('ResolutionError', 'Module', 'JSResolver',)
-import sys, re, json
+import sys, re, jsond as json
from itertools import chain, repeat
from collections import defaultdict
from subprocess import Popen, check_output, STDOUT, PIPE
from glob import glob
+from pprint import pprint, pformat
from bunch import *
from path import path
return (before, None, [])
return (before, sep, list(it))
+
+
def canonicalise(query, base=None):
""" query: A module ID (relative or absolute) or filepath
base: Optional. The referring module ID.
def requires(self):
return self.calcRequires('_at_requires') + self._requires
+ def __json_default__(self):
+ return dict( (k,self[k]) for k in 'id file name _requires _at_requires'.split(' ') )
+
def __hash__(self):
return hash(self.id)
class CommonJS(object):
""" Compiles JS modules into browser-safe JS files. """
- @staticmethod
- def discover(files, repos, **options):
- "Discover listed modules and their dependencies."
- cjs = CommonJS(repos, **options)
- queue = [ cjs.lookup(f) for f in files ]
- seen = set()
- while queue:
- mod = queue.pop(0)
- seen.add(mod)
- # print mod, "requirements:", mod.requires
- for query in mod.requires:
- # print mod, "requires", query
- req = cjs.lookup(query, mod)
- if req not in seen:
- queue.append(req)
- if cjs.deps_name:
- cjs.genDepLoader()
- return cjs
-
-
repos = []
modules = {} # id -> Module
_graph = None # id -> set(dependants)
_at_graph = None # id -> set(dependants)
- def __init__(self, repos, out='build', deps_name=None, clean=True, **options):
+ def __init__(self, repos, out='build', save='build', deps_name=None, clean=True, **options):
self.modules = {}
self.options = options
self.deps_name = deps_name
for k, mod in self.modules.iteritems():
yield k, mod
+ def reset(self):
+ self._graph = None
+ self._at_graph = None
+ return self
+
def calcGraph(self, attr):
if self._graph is None:
graph = self._graph = defaultdict(set)
return self.calcGraph('_at_graph')
def tsort(self, graph):
- p = Popen(['tsort'], stderr=STDOUT, stdin=PIPE, stdout=PIPE)
+ p = Popen(['tsort'], stderr=sys.stderr, stdin=PIPE, stdout=PIPE)
deps = '\n'.join( '%s %s' % (id, dep.id) for (id, deps) in graph.iteritems() for dep in deps )
p.stdin.write(deps)
p.stdin.close()
if p.wait() != 0:
raise ResolutionError('Cannot resolve dependencies! Requirements must be acyclic!')
- return p.stdout.read()
+ return p.stdout.read().strip().split('\n')
@property
def dependencies(self):
- deps = (self.tsort(self.atGraph)+self.tsort(self.graph)).strip().split('\n')
- for i, dep in reversed(list(enumerate(deps[:]))):
- try:
- idx = deps.index(dep, 0, i-1)
- if i != idx:
- del deps[idx]
- except ValueError: pass
- return deps
+ atg = self.tsort(self.atGraph)
+ nog = self.tsort(self.graph)
+ atdeps = self.atGraph.keys()
+
+ for dep in atg[:]:
+ if dep not in atdeps:
+ try: atg.remove(dep)
+ except ValueError: pass
+ else:
+ try: nog.remove(dep)
+ except ValueError: pass
+
+ # print '\nAtKeys:\n', pformat(atdeps), '\n'
+ # print '\nAtDeps:\n', pformat(atg), '\n'
+ # print '\nNoKeys:\n', pformat(nog), '\n'
+ return atg+nog
def dumpDependencies(self):
column = Popen(['column', '-s', '\t', '-t'], stderr=sys.stderr, stdin=PIPE, stdout=PIPE)
- mods = self.modules.values()
- for mod in sorted(mods, key=lambda m: len(m.requires), reverse=True):
+ # for mod in sorted(self.modules.values(), key=lambda m: len(m.requires), reverse=True):
+ for mod in sorted(self.modules.values()):
column.stdin.write('%s\t->\t%r\n' % (mod, sorted(mod.requires)))
- # print '%s\t->\t%r' % (mod, sorted(mod.requires))
column.stdin.close()
if column.wait() != 0:
print >> sys.stderr, 'Some sort of error has occurred!'
@property
def scriptTags(self):
return '\n'.join( '<script src="{}" type="text/javascript"></script>'.format(uri) for uri in self.uris )
+
+ def save(self, dir):
+ with (path(dir)/'.modules.json').open('w') as f:
+ json.dump({
+ 'modules' : self.modules,
+ 'ensure' : dict( (id, list(mod.id for mod in mods)) for id,mods in self.atGraph.iteritems() ),
+ 'graph' : dict( (id, list(mod.id for mod in mods)) for id,mods in self.graph.iteritems() ),
+ }, f, indent=4)
+ return self
+
+ @staticmethod
+ def discover(files, repos, **options):
+ "Discover listed modules and their dependencies."
+ cjs = CommonJS(repos, **options)
+
+ # print >> sys.stderr, '\n[ %s ]' % f
+
+ queue = [ cjs.reset().lookup(f) for f in files ]
+ seen = set()
+ while queue:
+ mod = queue.pop(0)
+ seen.add(mod)
+ # print mod, "requirements:", mod.requires
+ for query in mod.requires:
+ # print mod, "requires", query
+ req = cjs.lookup(query, mod)
+ if req not in seen:
+ queue.append(req)
+
+ if options.get('deps_name', None):
+ cjs.genDepLoader()
+
+ if options.get('print_deps', None):
+ print >> sys.stderr, '\n[ %s ]' % f
+ print >> sys.stderr, 'All Dependencies:'
+ print >> sys.stderr, cjs.dumpDependencies()
+ print >> sys.stderr, ''
+ print >> sys.stderr, 'Resolution:'
+ print >> sys.stderr, '\n'.join(cjs.dependencies)
+
+ if options.get('script_tags', None):
+ print cjs.scriptTags
+
+ if options.get('state', None):
+ cjs.save(options['state'])
+
+ return cjs
+
help="Generates a JS script with the given name which doc-writes tags for this set of modules.")
parser.add_option("-s", "--script-tags", default=False, action="store_true",
help="Emits script-tags for this set of modules in dependency order. [default: %default]")
+ parser.add_option("-S", "--state", default='build',
+ help="Directory to save build state. [default: %default]")
+
(options, args) = parser.parse_args()
# print 'files:', files, 'repos:', (repos or ['.'])
try:
- js = CommonJS.discover(files=files, repos=repos or ['.'], **options.__dict__)
+ cjs = CommonJS.discover(files=files, repos=repos or ['.'], **options.__dict__)
except ResolutionError as ex:
print >> sys.stderr, str(ex)
return 1
- if options.script_tags:
- print js.scriptTags
-
- if options.print_deps:
- print >> sys.stderr, 'All Dependencies:'
- print >> sys.stderr, js.dumpDependencies()
- print >> sys.stderr, ''
- print >> sys.stderr, 'Resolution:'
- print >> sys.stderr, '\n'.join(js.dependencies)
-
return 0
if __name__ == '__main__':
# The Littlest Battletank
-Inspired by Tanks minigame off Wii Play.
+Inspired by the Tanks minigame in Wii Play.
+
## The Basics
- Your tank has 1hp.
- Your basic cannon shoots bullets. A bullet lives for one bounce or until it kills something. You can have up to 5 bullets at a time in the air.
- When you die, you respawn after a few seconds. (In single player, it restarts the level.)
+
## Controls
-- wasd, arrows: move your tank.
-- mouse: aim your reticule.
-- click, space, enter: fire a shot.
-- 0-9: use items.
-- All controls can be configured.
-
-## Ideas
-- Simplicity is king.
-- Only bosses have more than 1hp
-- Always on one screen
-- No stats: all items are qualitative
-- AI makes commentary on situations. "That was close. Sucker." "loool, you always die here."
-- Use TruRank-style player rating system, but the point of multiplayer will not be the ladder
-- Optional registration (Flash cookie every user)
-- Badges, awards, stats
-- Virtual currency from various in-game activities
-
-## Power-Ups
-- Missiles (fast, no bounce)
-- Refractor Rounds (slow, infi bounces)
-- Flamethrower (Cone AOE)
-- Shrapnel Rounds (splits once on impact)
-- Mortar Rounds (Projectile AOE)
-- Mines (Stationary Prox AOE)
-- Heatseekers (Projectile Prox)
-- Nukes (Absurd AOE which often kills you)
-- Portal Cannon (Exchanges your position with your cursor)
-- K-Boss Shield (Absorbs 1 damage)
-- Gin & Tonic / iPhone 3G / Hannah Montana Lamp (Extra Life)
-- Deuschund Trebuchet (Parabolic Arc lulz)
-- Light Cannon (Faster Move, -1 Shots in Air)
-- EMP Device (aka, the "Stunna") (Freezes everyone in place. Including you.)
-
-## Mechanics
-- AOE
-- Shot Travel Speed
-- Shot Bounces
-- Shot Cooldown
-- Shots in Air
-- Move Speed
-- HP (Bosses only)
-- Allies -- companion AI tanks which play for your side, but they can still damage you
-- Can use Items
-- AI type, quality
-- Mutable Environment?
+
+### Desktop Controls
+
+- Move: wasd, arrows for cardinal directions; combine for 45-degree moves
+- Shoot:
+ - Aim your reticule with the mouse
+ - Click, or press space to fire a shot
+- Items: Press `12345zxc
+- Zoom: Mouse wheel
+- Customization:
+ - Keyboard controls can be rebound
+ - Multiple UI trays
+
+### iOS Controls
+- Move: Trace a path from your tank with your finger
+- Shoot:
+ - Tap once somewhere sufficiently far from your tank to shoot one bullet on a trajectory aimed at that point
+ - Tap once and hold to see the trajectory line
+ - Move your finger to drag the line at a new point
+ - Release the tap to shoot along that trajectory
+ - Tap with your other hand sufficiently far from your tank and the current trajectory point to cancel
+- Items: On-screen buttons, possibly modal
+- Zoom: Pinch
+- Customization:
+ - Modal buttons used to switch between multiple UI "trays" with buttons
+ - Free gestures can be rebound (two/three finger swipe, double-tap, triple-tap)
+
+
+## Gameplay Ideas
+- No camera control: camera centers on tank and moves with it, though player can zoom the map
+- No number games: all items are qualitative (so, ex: only bosses have more than 1hp, but items (like shields) might absorb damage)
+- Allies: companion AI tanks which play for your side (beware friendly fire)- Mutable Environment: obstacles can be destroyed with the right weapons, enemies can be pushed
+## Items
+### Cannons
+- Missiles: Faster projectile, but no bounce
+- Refractor Rounds: Slower projectile, but infi bounces
+- Shrapnel Rounds: Projectile that splits instead of bounce
+### Heavy Munitions
+- Flamethrower: Cone AOE
+- Mortar Rounds: Projectile with AOE on detonation
+- Proximity Missiles: Projectile that explodes on prox
+- Mines: Stationary prox AOE
+### Special Weapons
+- Heatseekers: Projectile that will guide around walls to get to your target point, and then explodes even if no one is there
+- Nuke: Slow projectile with enormous AOE (reminder: friendly fire)
+- Trebuchet Rounds: Projectile which only collides when it reaches its destination (as if it was fired in a parabolic arc)
+- Portal Cannon: Makes source/dest wormholes
+### Passives
+- Light Ordinance: Faster move, fewer shots in air
+- Tactical Driver: Attempts to automatically move your tank out of harm's way when a bullet is imminent
+- Chameleon Engine: Makes enemies unable to see you for a limited time, confusing pathing
+
+### Shields
+- Turret Shield: extends 45-degrees around tour tank, centered on the barrel; impact pushes your tank back
+- Orbital Shield: small pellet-shield that orbits your tank
+- Stationary Shield: stationary shield sphere, passable to tanks but not bullets
+- Imprinted Stationary Shield: as the stationary shield, but passable only to your team and not others
+
+### Consumables
+- Cloudpot: Your tank deploys an emergency zeppelin to float quickly from your current position to your cursor. Tank can only be hit by Trebuchet Rounds during that time.
+- The Stunna Shocka (EMP Device): Freezes all tanks in place (including you)
+
+
+## Tank Attributes
+- Movement: speed, turning speed
+- Cannon: cooldown, max in air, recoil?
+- Bullets: speed, num bounces, proximity, AOE explosion
+- Toughness: hp (Bosses only), shields, resistance to certain classes of weapons
+
+
+## Flavor
+- AI makes commentary on situations. "That was close. Sucker." "loool, you always die here."
+- Papercraft art style, vector graphics
<div id="ai" style="display:none" class="bigblue">
<div class="box">
<h2>Add Tank AI</h2>
- <textarea id="custom-tank"></textarea>
+ <textarea id="customtank"></textarea>
<div class="ready pinkbutton rounded">Ready</div>
</div>
</div>
if ( !modules.hasOwnProperty(id) )
throw new Error('No such module "'+id+'"!');
- var module = modules[ids]
+ var module = modules[id]
, exports = module.exports = {};
// TODO: load the module
+//@require('jquery')
/*
* jQuery Hotkeys Plugin
* Copyright 2010, John Resig
+//@require('jquery')
(function(b){b.fn.__bind__=b.fn.bind;b.fn.__unbind__=b.fn.unbind;b.fn.__find__=b.fn.find;var a={version:"0.7.9",override:/keypress|keydown|keyup/g,triggersMap:{},specialKeys:{27:"esc",9:"tab",32:"space",13:"return",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",39:"right",40:"down",109:"-",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",191:"/"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"},newTrigger:function(e,d,f){var c={};c[e]={};c[e][d]={cb:f,disableInInput:false};return c}};a.specialKeys=b.extend(a.specialKeys,{96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/"});b.fn.find=function(c){this.query=c;return b.fn.__find__.apply(this,arguments)};b.fn.unbind=function(h,e,g){if(b.isFunction(e)){g=e;e=null}if(e&&typeof e==="string"){var f=((this.prevObject&&this.prevObject.query)||(this[0].id&&this[0].id)||this[0]).toString();var d=h.split(" ");for(var c=0;c<d.length;c++){delete a.triggersMap[f][d[c]][e]}}return this.__unbind__(h,g)};b.fn.bind=function(j,f,k){var h=j.match(a.override);if(b.isFunction(f)||!h){return this.__bind__(j,f,k)}else{var n=null,i=b.trim(j.replace(a.override,""));if(i){n=this.__bind__(i,f,k)}if(typeof f==="string"){f={combi:f}}if(f.combi){for(var m=0;m<h.length;m++){var d=h[m];var g=f.combi.toLowerCase(),e=a.newTrigger(d,g,k),l=((this.prevObject&&this.prevObject.query)||(this[0].id&&this[0].id)||this[0]).toString();e[d][g].disableInInput=f.disableInInput;if(!a.triggersMap[l]){a.triggersMap[l]=e}else{if(!a.triggersMap[l][d]){a.triggersMap[l][d]=e[d]}}var c=a.triggersMap[l][d][g];if(!c){a.triggersMap[l][d][g]=[e[d][g]]}else{if(c.constructor!==Array){a.triggersMap[l][d][g]=[c]}else{a.triggersMap[l][d][g][c.length]=e[d][g]}}this.each(function(){var o=b(this);if(o.attr("hkId")&&o.attr("hkId")!==l){l=o.attr("hkId")+";"+l}o.attr("hkId",l)});n=this.__bind__(h.join(" "),f,a.handler)}}return n}};a.findElement=function(c){if(!b(c).attr("hkId")){if(b.browser.opera||b.browser.safari){while(!b(c).attr("hkId")&&c.parentNode){c=c.parentNode}}}return c};a.handler=function(e){var o=a.findElement(e.currentTarget),i=b(o),d=i.attr("hkId");if(d){d=d.split(";");var g=e.which,q=e.type,p=a.specialKeys[g],n=!p&&String.fromCharCode(g).toLowerCase(),h=e.shiftKey,c=e.ctrlKey,m=e.altKey||e.originalEvent.altKey,f=null;for(var r=0;r<d.length;r++){if(a.triggersMap[d[r]][q]){f=a.triggersMap[d[r]][q];break}}if(f){var j;if(!h&&!c&&!m){j=f[p]||(n&&f[n])}else{var l="";if(m){l+="alt+"}if(c){l+="ctrl+"}if(h){l+="shift+"}j=f[l+p];if(!j){if(n){j=f[l+n]||f[l+a.shiftNums[n]]||(l==="shift+"&&f[a.shiftNums[n]])}}}if(j){var s=false;for(var r=0;r<j.length;r++){if(j[r].disableInInput){var k=b(e.target);if(i.is("input")||i.is("textarea")||i.is("select")||k.is("input")||k.is("textarea")||k.is("select")){return true}}s=s||j[r].cb.apply(this,[e])}return s}}}};window.hotkeys=a;return b})(jQuery);
\ No newline at end of file
+//@require('jquery')
/**
*
* jquery.sparkline.js
+//@require('jquery')
/* jquery.sparkline 1.5.1 - http://omnipotent.net/jquery.sparkline/ */
-
(function($){$.fn.simpledraw=function(width,height,use_existing){if(use_existing&&this[0].vcanvas)return this[0].vcanvas;if(width==undefined)width=$(this).innerWidth();if(height==undefined)height=$(this).innerHeight();if($.browser.hasCanvas){return new vcanvas_canvas(width,height,this);}else if($.browser.msie){return new vcanvas_vml(width,height,this);}else{return false;}};var pending=[];$.fn.sparkline=function(uservalues,options){var options=$.extend({type:'line',lineColor:'#00f',fillColor:'#cdf',defaultPixelsPerValue:3,width:'auto',height:'auto',composite:false},options?options:{});return this.each(function(){var render=function(){var values=(uservalues=='html'||uservalues==undefined)?$(this).text().split(','):uservalues;var width=options.width=='auto'?values.length*options.defaultPixelsPerValue:options.width;if(options.height=='auto'){if(!options.composite||!this.vcanvas){var tmp=document.createElement('span');tmp.innerHTML='a';$(this).html(tmp);height=$(tmp).innerHeight();$(tmp).remove();}}else{height=options.height;}
$.fn.sparkline[options.type].call(this,values,options,width,height);}
if(($(this).html()&&$(this).is(':hidden'))||($.fn.jquery<"1.3.0"&&$(this).parents().is(':hidden'))){pending.push([this,render]);}else{render.call(this);}});};$.sparkline_display_visible=function(){for(var i=pending.length-1;i>=0;i--){var el=pending[i][0];if($(el).is(':visible')&&!$(el).parents().is(':hidden')){pending[i][1].call(el);pending.splice(i,1);}}};$.fn.sparkline.line=function(values,options,width,height){var options=$.extend({spotColor:'#f80',spotRadius:1.5,minSpotColor:'#f80',maxSpotColor:'#f80',lineWidth:1,normalRangeMin:undefined,normalRangeMax:undefined,normalRangeColor:'#ccc',chartRangeMin:undefined,chartRangeMax:undefined,chartRangeMinX:undefined,chartRangeMaxX:undefined},options?options:{});var xvalues=[],yvalues=[],yminmax=[];for(i=0;i<values.length;i++){var v=values[i];var isstr=typeof(values[i])=='string';var isarray=typeof(values[i])=='object'&&values[i]instanceof Array;var sp=isstr&&values[i].split(':');if(isstr&&sp.length==2){xvalues.push(Number(sp[0]));yvalues.push(Number(sp[1]));yminmax.push(Number(sp[1]));}else if(isarray){xvalues.push(values[i][0]);yvalues.push(values[i][1]);yminmax.push(values[i][1]);}else{xvalues.push(i);if(values[i]===null||values[i]=='null'){yvalues.push(null);}else{yvalues.push(Number(values[i]));yminmax.push(Number(values[i]));}}}
// Inspired by John Resig's "Simple Class Inheritence" -- http://ejohn.org/blog/simple-javascript-inheritance/
-var type = require('Y/type')
-, YFunction = require('Y/types/function').YFunction
-, core = require('Y/core')
-, slice = core.slice
+var type = require('Y/type')
+, core = require('Y/core')
+, YFunction = require('Y/types/function').YFunction
+, isFunction = type.isFunction
+, slice = core.slice
+
+, globals = (function(){ return this; })()
+, _Object = globals.Object
+, _Function = globals.Function
+, _Array = globals.Array
+, _String = globals.String
+, _Number = globals.Number
+
+, slice = _Array.prototype.slice
+, hasOwn = _Object.prototype.hasOwnProperty
+, getProto = _Object.getPrototypeOf
, KNOWN_CLASSES = type.type.KNOWN_CLASSES
, classToString = function toString(){ return this.className+"()"; }
, _Array = globals.Array
, PT = "prototype"
, slice = _Array[PT].slice
+, type = require('Y/type')
;
// function slice(a){
}
function forEach(o, fn){
- map(o, fn, cxt);
+ map(o, fn, arguments[2] || o);
return o;
}
function attr(o, key, value, def){
if ( !o || key === undefined ) return o;
- if ( Y.isPlainObject(key) )
+ if ( type.isPlainObject(key) )
return extend(o, key);
if ( value !== undefined || def !== undefined ){
// Curry all operators
var op = require('Y/op');
core.forEach(op, YFunction);
-Y['op'] = op['curried'] = op.extend({}, core.map(yfn.curry, op));
-// Y['op'] = core.reduce(op, function(Yop, fn, k){
-// Yop[k] = yfn.curry(fn);
-// return Yop;
-// }, {});
+// Y['op'] = op['curried'] = op.extend({}, core.map(op, yfn.curry));
+Y['op'] =
+op['curried'] =
+ core.reduce(op, function(Yop, fn, k){
+ Yop[k] = fn.curry();
+ return Yop;
+ }, {});
// var yclass = require('Y/types/class');
addNames('Class subclass instantiate fabricate YBase',
+var Y = require('Y').Y;
Y['event'] = exports;
/**
* TODO: If DOM event, wrap with consistent API.
* TODO: use jQuery if present to wrap events.
*/
-var YEvent = exports['YEvent'] =
-Y.YObject.subclass('YEvent', {
+var Event =
+exports['Event'] =
+Y.YObject.subclass('Event', {
init : function init( type, target, trigger, data ){
data = data || {};
for (var k in data) this[k] = data[k];
this.trigger = trigger || target;
},
- toString: function(){ return "YEvent("+this.type+")"; }
+ toString: function(){ return "Event("+this.type+")"; }
})
/**
},
fire : function fire(evtname, trigger, data, async){
- var evt = new YEvent(evtname, this.target, trigger, data);
+ var evt = new Event(evtname, this.target, trigger, data);
if (async)
setTimeout(this.dispatchEvent.bind(this, evt), 10);
else
}
},
-Emitter = exports['Emitter'] =
+Emitter =
+exports['Emitter'] =
Y.YObject.subclass('Emitter',
Y.extend({
'init' : function(target, parent){
}
isArray.types = [];
-function isArray(obj) { return type_of(obj) === "array" || obj instanceof Y.YArray; }
+function isArray(obj) { return type_of(obj) === "array" /*|| obj instanceof Y.YArray*/ ; }
function isFunction(obj) { return type_of(obj) === "function"; }
function isString(obj) { return type_of(obj) === "string"; }
function isNumber(obj) { return type_of(obj) === "number"; }
function is( A, B ){
if ( isArray(B) )
- return B.map( Y.is(A) ).any();
+ return B.map( is.bind(this,A) ).any();
else {
var AT = type(A), BT = type(B);
return (A instanceof BT || B instanceof AT || AT === BT);
var undefined
, WRAPS = "__wraps__"
, globals = (function(){ return this; })()
+, _Function = globals.Function
, core = require('Y/core')
, type = require('Y/type')
, isFunction = type.isFunction
, slice = core.slice
-, _ = exports._ = YFunction._ = {}
+, _ = YFunction._ = {}
, YFP = YFunction.prototype
;
if (fn.__curried__)
return fn.apply(this, slice.call(arguments,1));
- fn = Function.toFunction(fn);
+ fn = _Function.toFunction(fn);
var args = slice.call(arguments, 1)
, L = unwrap(fn).length;
function _composer(x,fn){ return fn.call(this, x); }
function compose(f,g){
- var fns = slice.call(arguments).map(Function.toFunction);
+ var fns = slice.call(arguments).map(_Function.toFunction);
return function(){
return fns.reduce(_composer, slice.call(arguments), this);
};
}
function chain(f,g){
- var fns = slice.call(arguments).map(Function.toFunction);
+ var fns = slice.call(arguments).map(_Function.toFunction);
if ( g.__sequence__ )
fns = g.__sequence__.concat( fns.slice(1) );
// Export these last to avoid methodizing them
exports['YFunction'] = YFunction;
-
-// Attach our methods to our exports!
-core.forEach(exports, YFunction);
+exports._ = _;
return delegate;
}
-
-})();
-var Vec = require('ezl/math/vec').Vec
+var Y = require('Y').Y
+, Vec = require('ezl/math/vec').Vec
,
Rect =
+var Y = require('Y').Y
+,
+
/**
* A 2-dimensional vector.
*/
-var Vec =
+Vec =
exports['Vec'] =
new Y.Class('Vec', [], {
+var Y = require('Y').Y
+, Shape = require('ezl/shape/shape').Shape
+,
-Circle = new Y.Class('Circle', Shape, {
+Circle =
+exports['Circle'] =
+Shape.subclass('Circle', {
_cssClasses : 'ezl layer shape circle',
init : function initCircle(radius, centerTL){
- Layer.init.call(this);
+ Shape.init.call(this);
var d = radius * 2;
this.radius = radius;
+//@require('jquery')
-Line = new Y.Class('Line', Shape, {
+var Y = require('Y').Y
+, Shape = require('ezl/shape/shape').Shape
+,
+
+Line =
+exports['Line'] =
+Shape.subclass('Line', {
_cssClasses : 'ezl layer shape line',
useCanvasScaling : true,
init : function initLine(x,y){
- Layer.init.call(this);
+ Shape.init.call(this);
this.sublayer = jQuery('<div style="overflow:hidden" />')
.append(this.canvas)
-var Shape = require('ezl/shape').Shape
+var Shape = require('ezl/shape/shape').Shape
,
Rect =
-Shape = new Y.Class('Shape', Layer, {
+var Y = require('Y').Y
+, Layer = require('ezl/layer').Layer
+,
+
+Shape =
+exports['Shape'] =
+Layer.subclass('Shape', {
_cssClasses : 'ezl layer shape',
fillStyle : 'rgba(231,48,117, 1)',
strokeStyle : 'transparent',
-var CAPACITY = 8
+var Y = require('Y').Y
+, CAPACITY = 8
, REGION_ID = 0
,
// -*- mode: JavaScript; tab-width: 4; indent-tabs-mode: nil; -*-
-var defaults =
+var Y = require('Y').Y
+
+, defaults =
exports.defaults = {
ui : {
showGridCoords : false,
traceTrajectories : false
}
};
+
exports.values = Y(defaults).clone().end();
-var tanks = require('tanks')
-, map = require('tanks/map')
-, thing = require('tanks/thing')
-, Grid = require('tanks/ui/grid').Grid
+//@require('lessly/future')
+//@require('jquery')
-, Level = map.Level
-, Thing = thing.Thing, Tank = thing.Tank, Bullet = thing.Bullet
+var Y = require('Y').Y
+, Event = require('Y/modules/y.event').Event
+, EventLoop = require('ezl/loop').EventLoop
-;
+, config = require('tanks/config')
+, map = require('tanks/map')
+, thing = require('tanks/thing')
+, Grid = require('tanks/ui/grid').Grid
-exports.Game = Y.subclass('Game', {
+, Level = map.Level
+, Thing = thing.Thing, Tank = thing.Tank, Bullet = thing.Bullet
+,
+
+
+Game =
+exports['Game'] =
+Y.subclass('Game', {
overlayPathmap : false,
- init : function init(viewport){
+ init : function initGame(viewport){
Y.bindAll(this);
- tanks.resetGlobals();
this.byId = {};
this.active = new Y.YArray();
destroy : function destroy(){
this.stop();
- tanks.resetGlobals();
+ this.resetGlobals();
+ },
+
+ resetGlobals : function resetGlobals(){
+ NOW = new Date().getTime();
+ ELAPSED = MS_PER_FRAME;
+ TICKS = 0;
+ SECONDTH = ELAPSED / 1000;
+ SQUARETH = REF_SIZE * SECONDTH;
},
draw : function draw(){
this.root.draw();
this.pathmap.removeOverlay(this.viewport);
- if (tanks.config.values.pathing.overlayPathmap)
+ if (config.values.pathing.overlayPathmap)
this.pathmap.overlay(this.viewport);
},
// *** Agent Management *** //
addUnit : function addUnit(unit, col,row){
- if (unit instanceof Y.event.YEvent)
+ if (unit instanceof Event)
unit = unit.instance;
unit.game = this;
},
killUnit : function killUnit(unit){
- if (unit instanceof Y.event.YEvent)
+ if (unit instanceof Event)
unit = unit.instance;
// console.log('killUnit(', unit, ')');
});
-
+
var undefined
+, Y = require('Y').Y
, GRID_ELEMENT = '#viewport'
, REF_SIZE = 50
, TWO_PI = PI*2
;
-
-tanks.resetGlobals = function resetGlobals(){
- NOW = new Date().getTime();
- ELAPSED = MS_PER_FRAME;
- TICKS = 0;
-
- SECONDTH = ELAPSED / 1000;
- SQUARETH = REF_SIZE * SECONDTH;
-};
-
-if (!window.console) {
- console = {
- log : Y.op.nop,
- info : Y.op.nop,
- warn : Y.op.nop,
- error : Y.op.nop,
- dir : Y.op.nop,
- debug : Y.op.nop
- };
-}
-var tanks = exports.tanks = {};
-tanks.config = require('tanks/config');
+//@ require('tanks/globals')
+var Y = require('Y').Y;
+
+require('tanks/globals');
+
+tanks = exports.tanks = {
+ 'config' : require('tanks/config'),
+ 'ui' : require('tanks/ui'),
+ 'Game' : require('tanks/game').Game,
+
+ 'currentGame' : null,
+
+};
+
+if (!window.console) {
+ console = {
+ log : Y.op.nop,
+ info : Y.op.nop,
+ warn : Y.op.nop,
+ error : Y.op.nop,
+ dir : Y.op.nop,
+ debug : Y.op.nop
+ };
+}
+var Y = require('Y').Y;
+
+Y.extend(exports, {
+ 'Level' : require('tanks/map/level').Level,
+ 'Wall' : require('tanks/map/wall').Wall,
+ 'PathMap' : require('tanks/map/pathmap').PathMap,
+ 'Trajectory' : require('tanks/map/trajectory').Trajectory
+});
-Level = Rect.subclass('Level', {
+var Y = require('Y').Y
+, Rect = require('ezl/shape').Rect
+, Tank = require('tanks/thing/tank').Tank
+, PlayerTank = require('tanks/thing/player').PlayerTank
+, PathMap = require('tanks/map/pathmap').PathMap
+,
+
+
+Level =
+exports['Level'] =
+Rect.subclass('Level', {
_cssClasses : 'ezl layer level',
init : function init(game, w,h){
},
addWall : function addWall(x,y, w,h, isBoundary){
- var wall = new Level.Wall(x,y, w,h, isBoundary);
+ var wall = new Wall(x,y, w,h, isBoundary);
this.pathmap.addBlocker(wall);
this.append( wall.render(this).shape );
drawShape : Y.op.nop
-});
-
-Level.Wall = Thing.subclass('Wall', {
- isBoundary : false,
- blocking : true,
- active : false,
-
- stats : {
- hp : Infinity,
- move : 0,
- power : 0,
- speed : 0,
- shots : 0
- },
-
-
- init : function initWall(x,y, w,h, isBoundary){
- this.width = w;
- this.height = h;
- this.isBoundary = !!isBoundary;
- Thing.init.call(this);
- this.setLocation(x,y);
- },
-
- // inactive
- createCooldowns : Y.op.nop,
-
- // indestructable
- dealDamage : Y.op.nop,
-
-
- render : function render(parent){
- if (this.isBoundary)
- return this;
-
- if (this.shape)
- this.shape.remove();
-
- this.shape =
- new Rect(this.width, this.height)
- .position(this.loc.x, this.loc.y)
- .fill('rgba(255,255,255, 0.25)')
- .appendTo( parent );
-
- return this;
- },
-
- toString : function(){
- var loc = this.loc
- , x1 = loc.x, y1 = loc.y
- , x2 = x1+this.width, y2 = y1 + this.height;
- return this.className+'['+x1+','+y1+', '+x2+','+y2+'](w='+this.width+', h='+this.height+')';
- }
-});
-
+});
\ No newline at end of file
// -*- mode: JavaScript; tab-width: 4; indent-tabs-mode: nil; -*-
-(function(){
+var Y = require('Y').Y
+, QuadTree = require('ezl/util/tree/quadtree').QuadTree
+,
-PathMap = QuadTree.subclass('PathMap', {
+PathMap =
+exports['PathMap'] =
+QuadTree.subclass('PathMap', {
gridSquareSize : REF_SIZE,
- gridSquareMidPt : new math.Vec(REF_SIZE/2, REF_SIZE/2),
+ gridSquareMidPt : new Vec(REF_SIZE/2, REF_SIZE/2),
for (var x=0; x<cols; x++) {
var col = grid[x] = new Array(rows);
for (var y=0; y<rows; y++) {
- var node = col[y] = new math.Vec(x,y);
+ var node = col[y] = new Vec(x,y);
node.clone = function cloneNode(){
- var n = math.Vec.prototype.clone.call(this);
+ var n = Vec.prototype.clone.call(this);
n.blocked = this.blocked;
n.value = this.value;
return n;
x = x.x;
}
var floor = Math.floor, size = this.gridSquareSize;
- return new math.Vec(floor(x/size), floor(y/size));
+ return new Vec(floor(x/size), floor(y/size));
},
square2Vec : function square2Vec(x,y){
x = x.x;
}
var floor = Math.floor, size = this.gridSquareSize;
- return new math.Vec(floor(x)*size, floor(y)*size);
+ return new Vec(floor(x)*size, floor(y)*size);
},
path : function path(start, end, id){
};
});
-
-})();
-Trajectory = math.Line.subclass('Trajectory', {
+var Y = require('Y').Y
+, math = require('ezl/math')
+, Vec = math.Vec
+, Line = math.Line
+, Rect = math.Rect
+, Thing = require('tanks/thing/thing').Thing
+,
+
+Trajectory =
+exports['Trajectory'] =
+Line.subclass('Trajectory', {
halt : false,
elapsed : 0,
bounces : 0,
}
// init with raw numbers to do calculations
- math.Line.init.call(this, x1,y1, x2,y2, tdist || this.tdist);
+ Line.init.call(this, x1,y1, x2,y2, tdist || this.tdist);
var pm = this.pathmap
, ex = (x1 > x2 ? -REF_SIZE : REF_SIZE+pm.width )
// Move goal point beyond far wall to avoid rotations
x2 = this.x2 = edge.x;
y2 = this.y2 = edge.y;
- this.p2 = new math.Vec(x2,y2);
- math.Vec.init.call(this, x2-x1, y2-y1);
+ this.p2 = new Vec(x2,y2);
+ Vec.init.call(this, x2-x1, y2-y1);
this.elapsed = 0;
this.resetBound();
if (o instanceof Thing)
return o.boundingBox.intersects(this);
- if (o instanceof Loc.Rect)
+ if (o instanceof Rect)
return o.intersects(this);
- return math.Line.prototype.intersects.call(this, x,y);
+ return Line.prototype.intersects.call(this, x,y);
},
if (this.halt) break;
// FIXME: bb.add?
- bb = new Loc.Rect(to.x,to.y, to.x+bw,to.y+bh);
+ bb = new Rect(to.x,to.y, to.x+bw,to.y+bh);
} while (dt > 0);
toString : function toString(){
return 'T['+this.p1+', '+this.p2+', slope='+this.slope.toFixed(3)+']';
}
-});
\ No newline at end of file
+});
--- /dev/null
+var Y = require('Y').Y
+, Rect = require('ezl/shape').Rect
+, Thing = require('tanks/thing/thing').Thing
+,
+
+
+Wall =
+exports['Wall'] =
+Thing.subclass('Wall', {
+ isBoundary : false,
+ blocking : true,
+ active : false,
+
+ stats : {
+ hp : Infinity,
+ move : 0,
+ power : 0,
+ speed : 0,
+ shots : 0
+ },
+
+
+ init : function initWall(x,y, w,h, isBoundary){
+ this.width = w;
+ this.height = h;
+ this.isBoundary = !!isBoundary;
+ Thing.init.call(this);
+ this.setLocation(x,y);
+ },
+
+ // inactive
+ createCooldowns : Y.op.nop,
+
+ // indestructable
+ dealDamage : Y.op.nop,
+
+
+ render : function render(parent){
+ if (this.isBoundary)
+ return this;
+
+ if (this.shape)
+ this.shape.remove();
+
+ this.shape =
+ new Rect(this.width, this.height)
+ .position(this.loc.x, this.loc.y)
+ .fill('rgba(255,255,255, 0.25)')
+ .appendTo( parent );
+
+ return this;
+ },
+
+ toString : function(){
+ var loc = this.loc
+ , x1 = loc.x, y1 = loc.y
+ , x2 = x1+this.width, y2 = y1 + this.height;
+ return this.className+'['+x1+','+y1+', '+x2+','+y2+'](w='+this.width+', h='+this.height+')';
+ }
+});
+
// -*- mode: JavaScript; tab-width: 4; indent-tabs-mode: nil; -*-
-Bullet = Thing.subclass('Bullet', {
+var Y = require('Y').Y
+, shape = require('ezl/shape')
+, Wall = require('tanks/map/wall').Wall
+, Thing = require('tanks/thing/thing').Thing
+, Line = shape.Line
+, Circle = shape.Circle
+,
+
+Bullet =
+exports['Bullet'] =
+Thing.subclass('Bullet', {
traceTrajectories : true,
var agent = evt.trigger
, trj = this.trajectory;
- if ( agent instanceof Level.Wall && trj.bounces <= this.bounceLimit )
+ if ( agent instanceof Wall && trj.bounces <= this.bounceLimit )
return;
agent.dealDamage(this.stats.power, this);
-CustomTank = Tank.subclass('CustomTank', {
+var Tank = require('tanks/thing/tank').Tank
+,
+
+CustomTank =
+exports['CustomTank'] =
+Tank.subclass('CustomTank', {
init : function initCustomTank(align, script){
Tank.init.call(this, align);
this.act = eval('(function(){ with(this){'+script+'} })');
}
-});
\ No newline at end of file
+});
-exports.Thing = require('tanks/thing/thing').Thing;
-exports.Bullet = require('tanks/thing/bullet').Bullet;
-exports.Tank = require('tanks/thing/tank').Tank;
-exports.PlayerTank = require('tanks/thing/player').PlayerTank;
-
+exports['Thing'] = require('tanks/thing/thing').Thing;
+exports['Bullet'] = require('tanks/thing/bullet').Bullet;
+exports['Tank'] = require('tanks/thing/tank').Tank;
+exports['PlayerTank'] = require('tanks/thing/player').PlayerTank;
+// exports['CustomTank'] = require('tanks/thing/customtank').CustomTank;
+//@require('jquery')
+//@require('jquery.hotkeys.min')
-var PlayerTank =
-exports.PlayerTank =
+var Y = require('Y').Y
+, Tank = require('tanks/thing/tank').Tank
+,
+
+
+PlayerTank =
+exports['PlayerTank'] =
Tank.subclass('PlayerTank', {
bodyColor : '#E73075',
this.rotateBarrelRelPage(evt.pageX, evt.pageY);
}
-});
-
+})
+,
-var Key = {
+Key =
+exports['Key'] = {
fire : 32,
_dirFromKey : {
-(function(){
+var Y = require('Y').Y
+, Thing = require('tanks/thing/thing').Thing
+, Bullet = require('tanks/thing/bullet').Bullet
+, Trajectory = require('tanks/map/trajectory').Trajectory
+, Vec = require('ezl/math/vec').Vec
+, shape = require('ezl/shape')
+, Rect = shape.Rect
+, Circle = shape.Circle
-var BULLET_MOVE_PER_FRAME = MS_PER_FRAME * Bullet.prototype.stats.move*REF_SIZE/1000
, isBullet = Y.is(Bullet)
-;
+, BULLET_MOVE_PER_FRAME = MS_PER_FRAME * Bullet.prototype.stats.move*REF_SIZE/1000
+,
-Tank = Thing.subclass('Tank', {
+Tank =
+exports['Tank'] =
+Thing.subclass('Tank', {
projectile : Bullet,
blocking : true,
});
-
-})();
\ No newline at end of file
-var loc = require('tanks/map/loc')
-, Cooldown = require('ezl/loop/cooldown').Cooldown
-, Loc = loc.Loc, BoundingBox = loc.BoundingBox
-;
+var Y = require('Y').Y
+, Class = require('evt/class').Class
-var Thing =
-exports.Thing =
-new Evt.Class('Thing', {
+, Loc = require('ezl/loc/loc').Loc
+, BoundingBox = require('ezl/loc/boundingbox').BoundingBox
+, Cooldown = require('ezl/loop').Cooldown
+,
+
+
+Thing =
+exports['Thing'] =
+new Class('Thing', {
init : function init(align){
this.id = Thing.THING_ID++;
-(function(){
+//@require('jquery')
+
// TODO
// ====
// - If different from default, set cookie
// - Update tanks.config.values
-
-var ns = tanks.ui.config = {}
-, c = tanks.config.values
+var Y = require('Y').Y
+, config = require('tanks/config')
+, c = config.values
, p = c.pathing
;
-ns.init = function initConfigUi(){
+exports['init'] = function initConfigUi(){
$('#config [name=pathmap]').attr('checked', p.overlayPathmap);
$('#config [name=aipaths]').attr('checked', p.overlayAIPaths);
$('#config [name=trajectories]').attr('checked', p.traceTrajectories);
$('#viewport .layer.grid')[(c.ui.showGridCoords ? 'add' : 'remove')+'Class']('showGridCoords');
};
-ns.update = function updateConfigUi(evt){
+exports['update'] = function updateConfigUi(evt){
p.overlayPathmap = $('#config [name=pathmap]').attr('checked');
p.overlayAIPaths = $('#config [name=aipaths]').attr('checked');
p.traceTrajectories = $('#config [name=trajectories]').attr('checked');
// // 'Function'
// // 'Object'
// };
-// ns.makeField = function makeField(key, value){
+// exports['makeField'] = function makeField(key, value){
//
// };
.split(' ');
};
-
-
-})();
-Grid = new Y.Class('Grid', Rect, {
+var Y = require('Y').Y
+, Rect = require('ezl/shape').Rect
+,
+
+Grid =
+exports['Grid'] =
+Rect.subclass('Grid', {
_cssClasses : 'ezl layer shape rect grid',
lineWidth : 0.5,
}
}
-});
\ No newline at end of file
+});
+var Y = require('Y').Y;
+Y.extend(exports, require('tanks/ui/config'));
+exports['main'] = require('tanks/ui/main');
-(function(){
+//@require('jquery')
+//@require('jquery.hotkeys.min')
-jQuery(main);
+var Y = require('Y').Y
+, config = require('tanks/config')
+, uiconfig = require('tanks/ui/config')
+, Game = require('tanks/game').Game
+, Tank = require('tanks/thing').Tank
+, FpsSparkline = require('ezl/loop').FpsSparkline
+;
+
+qkv = Y(window.location.search.slice(1)).fromKV().end();
-this.main = main;
+jQuery(main);
// Main method is only executed once, so we'll setup things
// that don't change between games.
function main(){
- qkv = Y(window.location.search.slice(1)).fromKV().end();
/// Debug ///
if (qkv.ai) {
$('#ai .ready').bind('click', function(evt){
try {
- var script = $('#custom-tank').val();
+ var script = $('#customtank').val();
Tank.prototype.act = eval('(function(){ with(this){'+script+'} })');
$('#ai').hide();
startGame();
$('#debug').bind('mousedown', Y.op.K(false));
// Update config when changed
- $('#debug input').bind('change', tanks.ui.config.update);
+ $('#debug input').bind('change', uiconfig.update);
// Create #pause box
function setupGame(){
if ( gameExists() ) teardownGame();
- LBT = tanks.currentGame = new tanks.Game();
+ LBT = tanks.currentGame = new Game();
LBT.addEventListener('win', gameover('You Win!', 'Play Again', ''));
LBT.addEventListener('lose', gameover('You Lose :(', 'Try Again', ''));
if (!qkv.ai) $('#welcome').show();
LBT.loop.spark = new FpsSparkline(LBT.loop, '.fps-sparkline', 0,0);
- tanks.ui.config.init();
+ uiconfig.init();
LBT.root.draw();
// Start button (click or return key)
$('#welcome').hide();
- if ( tanks.config.values.ui.showCountdown )
- countdownToStart(3, readyToStart);
+ if ( config.values.ui.showCountdown )
+ countdown(3, readyToStart);
else
readyToStart();
}
gameover = Y(gameover).curry();
-function countdownToStart(n, fn){
+function countdown(n, fn){
var el
, showFor = 750
, pauseFor = 500
}
-
-}).call(tanks.ui);
+exports['main'] = main;
+exports['gameExists'] = gameExists;
+exports['setupGame'] = setupGame;
+exports['teardownGame'] = teardownGame;
+exports['setupUI'] = setupUI;
+exports['teardownUI'] = teardownUI;
+exports['startGame'] = startGame;
+exports['pauseGame'] = pauseGame;
+exports['toggleGame'] = toggleGame;
+exports['resizeGame'] = resizeGame;
+exports['gameover'] = gameover;
+exports['countdown'] = countdown;
+exports['tickDown'] = tickDown;
+exports['readyToStart'] = readyToStart;
+exports['updateInfo'] = updateInfo;
+++ /dev/null
-tanks.ui = {};
-Config = Y.YObject.subclass('Config', function(){
+var Y = require('Y').Y
+, Emitter = require('Y/modules/y.event').Emitter
+,
+
+
+Config =
+exports.Config =
+Y.YObject.subclass('Config', function(){
Y.op.extend(this, {
init : function initConfig(defaults){
this._defaults = defaults;
this._o = Y({}, defaults);
- this.__emitter__ = new Y.event.Emitter(this);
+ this.__emitter__ = new Emitter(this);
},
set : function set(key, value, def){
});
-});
\ No newline at end of file
+});
--- /dev/null
+<script src="build/lessly/future.js" type="text/javascript"></script>
+<script src="build/functional/to-function.js" type="text/javascript"></script>
+<script src="build/jquery.js" type="text/javascript"></script>
+<script src="build/jquery.sparkline.min.js" type="text/javascript"></script>
+<script src="build/jquery.hotkeys.min.js" type="text/javascript"></script>
+<script src="build/Y/type.js" type="text/javascript"></script>
+<script src="build/Y/core.js" type="text/javascript"></script>
+<script src="build/Y/y.js" type="text/javascript"></script>
+<script src="build/Y/types/function.js" type="text/javascript"></script>
+<script src="build/Y/op.js" type="text/javascript"></script>
+<script src="build/Y/class.js" type="text/javascript"></script>
+<script src="build/Y/utils.js" type="text/javascript"></script>
+<script src="build/Y/types/collection.js" type="text/javascript"></script>
+<script src="build/Y/types/object.js" type="text/javascript"></script>
+<script src="build/Y/types/number.js" type="text/javascript"></script>
+<script src="build/Y/types/string.js" type="text/javascript"></script>
+<script src="build/Y/types/array.js" type="text/javascript"></script>
+<script src="build/Y.js" type="text/javascript"></script>
+<script src="build/ezl/loop/cooldown.js" type="text/javascript"></script>
+<script src="build/tanks/globals.js" type="text/javascript"></script>
+<script src="build/Y/modules/y.event.js" type="text/javascript"></script>
+<script src="build/ezl/math/vec.js" type="text/javascript"></script>
+<script src="build/ezl/math/rect.js" type="text/javascript"></script>
+<script src="build/tanks/config.js" type="text/javascript"></script>
+<script src="build/ezl/loc/loc.js" type="text/javascript"></script>
+<script src="build/ezl/loop/fps.js" type="text/javascript"></script>
+<script src="build/ezl/util/tree/quadtree.js" type="text/javascript"></script>
+<script src="build/ezl/math/line.js" type="text/javascript"></script>
+<script src="build/ezl/loop/eventloop.js" type="text/javascript"></script>
+<script src="build/ezl/loop.js" type="text/javascript"></script>
+<script src="build/tanks/ui/config.js" type="text/javascript"></script>
+<script src="build/evt/class.js" type="text/javascript"></script>
+<script src="build/tanks/map/pathmap.js" type="text/javascript"></script>
+<script src="build/ezl/math.js" type="text/javascript"></script>
+<script src="build/ezl/loc/boundingbox.js" type="text/javascript"></script>
+<script src="build/ezl/loc/square.js" type="text/javascript"></script>
+<script src="build/ezl/loc.js" type="text/javascript"></script>
+<script src="build/tanks/thing/thing.js" type="text/javascript"></script>
+<script src="build/ezl/layer.js" type="text/javascript"></script>
+<script src="build/ezl/shape/shape.js" type="text/javascript"></script>
+<script src="build/tanks/map/trajectory.js" type="text/javascript"></script>
+<script src="build/ezl/shape/line.js" type="text/javascript"></script>
+<script src="build/ezl/shape/circle.js" type="text/javascript"></script>
+<script src="build/ezl/shape/rect.js" type="text/javascript"></script>
+<script src="build/ezl/shape/polygon.js" type="text/javascript"></script>
+<script src="build/ezl/shape.js" type="text/javascript"></script>
+<script src="build/tanks/ui/grid.js" type="text/javascript"></script>
+<script src="build/tanks/map/wall.js" type="text/javascript"></script>
+<script src="build/tanks/thing/bullet.js" type="text/javascript"></script>
+<script src="build/tanks/thing/tank.js" type="text/javascript"></script>
+<script src="build/tanks/thing/player.js" type="text/javascript"></script>
+<script src="build/tanks/map/level.js" type="text/javascript"></script>
+<script src="build/tanks/thing.js" type="text/javascript"></script>
+<script src="build/tanks/map.js" type="text/javascript"></script>
+<script src="build/tanks/game.js" type="text/javascript"></script>
+<script src="build/tanks/ui/main.js" type="text/javascript"></script>
+<script src="build/tanks/ui.js" type="text/javascript"></script>
+<script src="build/tanks.js" type="text/javascript"></script>
const BUILD_DIR = "build";
static $modules = array(
- array( "main" => "src/Y/index.cjs", "loader" => "y-loader.js" )
+ // array( "main" => "src/Y/index.cjs", "loader" => "y-loader.js" )
+ array( "main" => "src/tanks/index.cjs", "loader" => "tanks-loader.js" )
);
"src/tanks/thing/thing.js",
"src/tanks/thing/bullet.js",
"src/tanks/thing/tank.js",
- "src/tanks/thing/custom-tank.js",
+ "src/tanks/thing/customtank.js",
"src/tanks/thing/player.js",
"src/tanks/map/loc.js",
"src/tanks/ui/ui.js",
"src/tanks/ui/grid.js",
- "src/tanks/ui/ui-config.js",
+ "src/tanks/ui/config.js",
"src/tanks/game.js"
);
static function compile($modules=null) {
$modules = ($modules ? $modules : self::$modules);
$PYTHONPATH = "PYTHONPATH='/Users/dsc/.python/lib/python:/usr/local/lib/python2.7/site-packages:/usr/local/lib/python2.6/site-packages'";
- // error_reporting(E_ALL);
- // echo "<!--";
+ error_reporting(E_ALL);
+ echo "<!--";
foreach ($modules as $module) {
- $ret = shell_exec("$PYTHONPATH bin/cjs.py -s {$module['main']} -- src lib 2>&1");
+ $ret = shell_exec("$PYTHONPATH bin/cjs.py {$module['main']} -- src lib 2>&1"); //
echo " ".trim(join("\n ", split("\n", $ret)));
}
- // echo "-->";
+ echo "-->";
+ include "tags.php";
}
static function writeLoaders($modules=null, $recompile=true){