Permalink
Browse files

Code formatting

  • Loading branch information...
1 parent 0a0b1ec commit 0b37b1410ebd8993d120d6c7cb52aad6e2d619ad @izb committed May 22, 2013
@@ -74,8 +74,8 @@ define(function() {
r = Math.ceil(r/this.cellw);
if(this.candidateCache.hasOwnProperty(r)) {
- var cache = this.candidateCache[r];
- this.certains = cache.certains;
+ var cache = this.candidateCache[r];
+ this.certains = cache.certains;
this.uncertains = cache.uncertains;
return;
}
@@ -89,7 +89,7 @@ define(function() {
this.uncertains = [-s-1,-s,-s+1,-1,0,1,s-1,s,s+1];
} else {
- this.certains = [];
+ this.certains = [];
this.uncertains = [];
var rmax = (r+1)*(r+1);
@@ -145,7 +145,7 @@ define(function() {
var cx = (x/this.cellw)|0;
var cy = (y/this.cellh)|0;
- var c = cy*this.span+cx;
+ var c = cy*this.span+cx;
/* Cells that are certain to be within the radius are easy */
for (i = this.certains.length - 1; i >= 0; i--) {
@@ -176,7 +176,7 @@ define(function() {
cell = this.cells[oc];
if (cell!==undefined) {
for (j = cell.sprites.length - 1; j >= 0; j--) {
- s = cell.sprites[j];
+ s = cell.sprites[j];
dx = x-s.x;
dy = (y-s.y)*2;
s.tmpDist2=(dx*dx+dy*dy);
@@ -216,9 +216,9 @@ define(function() {
ProximityTracker.prototype.track = function(sprite) {
var pd = sprite.proximityData[this.id];
- var x = (sprite.x/this.cellw)|0;
- var y = (sprite.y/this.cellh)|0;
- var c = y*this.span+x;
+ var x = (sprite.x/this.cellw)|0;
+ var y = (sprite.y/this.cellh)|0;
+ var c = y*this.span+x;
if(c!==pd.cell) {
removeFromItsCell.call(this, sprite);
View
@@ -22,104 +22,104 @@ define(function() {
*/
this.keymap = {
backspace: 8,
- tab: 9,
- enter: 13,
- pause: 19,
- capsLock: 20,
- escape: 27,
- space: 32,
- pageUp: 33,
- pageDown: 34,
- end: 35,
- home: 36,
- left: 37,
- up: 38,
- right: 39,
- down: 40,
- ins: 45,
- del: 46,
+ tab : 9,
+ enter : 13,
+ pause : 19,
+ capsLock : 20,
+ escape : 27,
+ space : 32,
+ pageUp : 33,
+ pageDown : 34,
+ end : 35,
+ home : 36,
+ left : 37,
+ up : 38,
+ right : 39,
+ down : 40,
+ ins : 45,
+ del : 46,
/* Main keyboard */
- plus: 187,
- comma: 188,
- minus: 189,
- period: 190,
+ plus : 187,
+ comma : 188,
+ minus : 189,
+ period : 190,
- shift: 16,
- ctrl: 17,
- alt: 18,
+ shift : 16,
+ ctrl : 17,
+ alt : 18,
/* top row */
- zero: 48,
- one: 49,
- two: 50,
- three: 51,
- four: 52,
- five: 53,
- six: 54,
- seven: 55,
- eight: 56,
- nine: 57,
-
- a: 65,
- b: 66,
- c: 67,
- d: 68,
- e: 69,
- f: 70,
- g: 71,
- h: 72,
- i: 73,
- j: 74,
- k: 75,
- l: 76,
- m: 77,
- n: 78,
- o: 79,
- p: 80,
- q: 81,
- r: 82,
- s: 83,
- t: 84,
- u: 85,
- v: 86,
- w: 87,
- x: 88,
- y: 89,
- z: 90,
+ zero : 48,
+ one : 49,
+ two : 50,
+ three : 51,
+ four : 52,
+ five : 53,
+ six : 54,
+ seven : 55,
+ eight : 56,
+ nine : 57,
+
+ a : 65,
+ b : 66,
+ c : 67,
+ d : 68,
+ e : 69,
+ f : 70,
+ g : 71,
+ h : 72,
+ i : 73,
+ j : 74,
+ k : 75,
+ l : 76,
+ m : 77,
+ n : 78,
+ o : 79,
+ p : 80,
+ q : 81,
+ r : 82,
+ s : 83,
+ t : 84,
+ u : 85,
+ v : 86,
+ w : 87,
+ x : 88,
+ y : 89,
+ z : 90,
/* Number pad */
- num0: 96,
- num1: 97,
- num2: 98,
- num3: 99,
- num4: 100,
- num5: 101,
- num6: 102,
- num7: 103,
- num8: 104,
- num9: 105,
+ num0 : 96,
+ num1 : 97,
+ num2 : 98,
+ num3 : 99,
+ num4 : 100,
+ num5 : 101,
+ num6 : 102,
+ num7 : 103,
+ num8 : 104,
+ num9 : 105,
/* More number pad */
- multiply: 106,
- add: 107,
+ multiply : 106,
+ add : 107,
substract: 109,
- decimal: 110,
- divide: 111,
+ decimal : 110,
+ divide : 111,
/* Function keys */
- F1: 112,
- F2: 113,
- F3: 114,
- F4: 115,
- F5: 116,
- F6: 117,
- F7: 118,
- F8: 119,
- F9: 120,
- F10: 121,
- F11: 122,
- F12: 123
+ F1 : 112,
+ F2 : 113,
+ F3 : 114,
+ F4 : 115,
+ F5 : 116,
+ F6 : 117,
+ F7 : 118,
+ F8 : 119,
+ F9 : 120,
+ F10 : 121,
+ F11 : 122,
+ F12 : 123
};
this.actions = [];
@@ -140,8 +140,7 @@ define(function() {
var keydown = function(e) {
var tag = e.target.tagName;
- if (e.type !== 'keydown' || tag === 'INPUT' || tag === 'TEXTAREA')
- {
+ if (e.type !== 'keydown' || tag === 'INPUT' || tag === 'TEXTAREA') {
return;
}
e.preventDefault();
@@ -154,8 +153,7 @@ define(function() {
};
var keyup = function(e) {
- if (e.type !== 'keyup')
- {
+ if (e.type !== 'keyup') {
return;
}
e.preventDefault();
View
@@ -33,16 +33,16 @@ define(function() {
this.y = 0;
this.inputmap = {
- mouse1: -1,
- mouse2: -3,
- wheelUp: -4,
+ mouse1 : -1,
+ mouse2 : -3,
+ wheelUp : -4,
wheelDown: -5
};
var mousemoved = function(e) {
var rect = canvas.getBoundingClientRect();
- _this.x = e.clientX - rect.left;
- _this.y = e.clientY - rect.top;
+ _this.x = e.clientX - rect.left;
+ _this.y = e.clientY - rect.top;
};
canvas.addEventListener('mousemove', mousemoved, false);
@@ -255,17 +255,17 @@ define(['map/tile', 'util/bitmap', 'util/debug', 'util/js'], function(Tile, Bitm
*/
StaggeredIsometric.prototype.drawDebugRegions = function(ctx, props) {
- var map = this.data;
+ var map = this.data;
var l, layerEndY, layerEndX, r, x, y, stagger;
- var xstep = map.tilewidth;
- var ystep = map.tileheight / 2;
+ var xstep = map.tilewidth;
+ var ystep = map.tileheight / 2;
var starty = Math.floor((this.yoffset-ystep) / ystep);
- var endy = Math.floor((this.yoffset+this.clientHeight-ystep+this.maxYOverdraw) / ystep)+1;
+ var endy = Math.floor((this.yoffset+this.clientHeight-ystep+this.maxYOverdraw) / ystep)+1;
var startx = Math.floor((this.xoffset+this.clientWidth -1 ) / xstep);
- var endx = Math.floor((this.xoffset-xstep/2-this.maxXOverdraw) / xstep);
+ var endx = Math.floor((this.xoffset-xstep/2-this.maxXOverdraw) / xstep);
l = map.layers[0];
@@ -399,8 +399,8 @@ define(['map/tile', 'util/bitmap', 'util/debug', 'util/js'], function(Tile, Bitm
var map = this.data;
- var tw = map.tilewidth;
- var th = map.tileheight;
+ var tw = map.tilewidth;
+ var th = map.tileheight;
x=x|0;
y=y|0;
@@ -571,7 +571,7 @@ define(['map/tile', 'util/bitmap', 'util/debug', 'util/js'], function(Tile, Bitm
*/
StaggeredIsometric.prototype.updateLayers = function(now) {
var epoch = +new Date();
- var map = this.data;
+ var map = this.data;
for (var i = 0; i < map.layers.length; i++) {
var l = map.layers[i];
if (l.hasOwnProperty('update')) {
@@ -606,11 +606,11 @@ define(['map/tile', 'util/bitmap', 'util/debug', 'util/js'], function(Tile, Bitm
* @private
*/
StaggeredIsometric.prototype.onResize = function(w, h) {
- this.clientWidth = w;
+ this.clientWidth = w;
this.clientHeight = h;
- this.maxxoffset = this.data.width * this.data.tilewidth - this.clientWidth - 1;
- this.maxyoffset = this.data.height * (this.data.tileheight/2) - this.clientHeight - 1;
+ this.maxxoffset = this.data.width * this.data.tilewidth - this.clientWidth - 1;
+ this.maxyoffset = this.data.height * (this.data.tileheight/2) - this.clientHeight - 1;
};
@@ -620,18 +620,18 @@ define(['map/tile', 'util/bitmap', 'util/debug', 'util/js'], function(Tile, Bitm
*/
StaggeredIsometric.prototype.drawWorld = function(ctx, now, sprites) {
- var map = this.data;
+ var map = this.data;
var epoch;
- var xstep = map.tilewidth;
- var ystep = map.tileheight / 2;
+ var xstep = map.tilewidth;
+ var ystep = map.tileheight / 2;
var starty = Math.floor((this.yoffset-ystep) / ystep);
- var endy = Math.floor((this.yoffset+this.clientHeight-ystep+this.maxYOverdraw) / ystep)+1;
+ var endy = Math.floor((this.yoffset+this.clientHeight-ystep+this.maxYOverdraw) / ystep)+1;
var startx = Math.floor((this.xoffset+this.clientWidth -1 ) / xstep);
- var endx = Math.floor((this.xoffset-xstep/2-this.maxXOverdraw) / xstep);
+ var endx = Math.floor((this.xoffset-xstep/2-this.maxXOverdraw) / xstep);
epoch = +new Date();
/* Sort sprites first by y-axis, then by height, then creation order */
View
@@ -27,15 +27,15 @@ define(['util/uid', 'util/js'], function(uid, js) {
* the defaults.
*/
function Tile(img, x, y, w, h, xoverdraw, yoverdraw, defaultProps, properties) {
- this.img = img;
- this.x = x;
- this.y = y;
- this.w = w;
- this.h = h;
- this.xoverdraw = xoverdraw;
- this.yoverdraw = yoverdraw;
+ this.img = img;
+ this.x = x;
+ this.y = y;
+ this.w = w;
+ this.h = h;
+ this.xoverdraw = xoverdraw;
+ this.yoverdraw = yoverdraw;
this.defaultProps = defaultProps||{};
- this.properties = properties||{};
+ this.properties = properties||{};
}
/**
Oops, something went wrong.

0 comments on commit 0b37b14

Please sign in to comment.