DIR : /home/kozerus/public_html/jkwii/js/jsdoit/gamehmpath/index.js

/home/kozerus/public_html/jkwii/js/jsdoit/gamehmpath

// generatedy by JSX compiler 0.9.49 (2013-06-30 15:20:50 -0700; 577bcd9d557d259c17fd80210e50c3bfb9b2a3df)
var JSX = {};
(function (JSX) {
/**
 * extends the class
 */
function $__jsx_extend(derivations, base) {
	var ctor = function () {};
	ctor.prototype = base.prototype;
	var proto = new ctor();
	for (var i in derivations) {
		derivations[i].prototype = proto;
	}
}

/**
 * copies the implementations from source interface to target
 */
function $__jsx_merge_interface(target, source) {
	for (var k in source.prototype)
		if (source.prototype.hasOwnProperty(k))
			target.prototype[k] = source.prototype[k];
}

/**
 * defers the initialization of the property
 */
function $__jsx_lazy_init(obj, prop, func) {
	function reset(obj, prop, value) {
		delete obj[prop];
		obj[prop] = value;
		return value;
	}

	Object.defineProperty(obj, prop, {
		get: function () {
			return reset(obj, prop, func());
		},
		set: function (v) {
			reset(obj, prop, v);
		},
		enumerable: true,
		configurable: true
	});
}

/**
 * sideeffect().a /= b
 */
function $__jsx_div_assign(obj, prop, divisor) {
	return obj[prop] = (obj[prop] / divisor) | 0;
}

/*
 * global functions, renamed to avoid conflict with local variable names
 */
var $__jsx_parseInt = parseInt;
var $__jsx_parseFloat = parseFloat;
var $__jsx_isNaN = isNaN;
var $__jsx_isFinite = isFinite;

var $__jsx_encodeURIComponent = encodeURIComponent;
var $__jsx_decodeURIComponent = decodeURIComponent;
var $__jsx_encodeURI = encodeURI;
var $__jsx_decodeURI = decodeURI;

var $__jsx_ObjectToString = Object.prototype.toString;
var $__jsx_ObjectHasOwnProperty = Object.prototype.hasOwnProperty;

/*
 * profiler object, initialized afterwards
 */
function $__jsx_profiler() {
}

/*
 * public interface to JSX code
 */
JSX.require = function (path) {
	var m = $__jsx_classMap[path];
	return m !== undefined ? m : null;
};

JSX.profilerIsRunning = function () {
	return $__jsx_profiler.getResults != null;
};

JSX.getProfileResults = function () {
	return ($__jsx_profiler.getResults || function () { return {}; })();
};

JSX.postProfileResults = function (url, cb) {
	if ($__jsx_profiler.postResults == null)
		throw new Error("profiler has not been turned on");
	return $__jsx_profiler.postResults(url, cb);
};

JSX.resetProfileResults = function () {
	if ($__jsx_profiler.resetResults == null)
		throw new Error("profiler has not been turned on");
	return $__jsx_profiler.resetResults();
};
JSX.DEBUG = true;
function g_StopIteration() {
	Error.call(this);
};

$__jsx_extend([g_StopIteration], Error);
function _Main() {
};

$__jsx_extend([_Main], Object);
function _Main$main$AS(args) {
	_Main$loadImg$HSF$V$(({ "player": "http://jsrun.it/assets/i/P/g/u/iPguf.png", "enemy1": "http://jsrun.it/assets/s/s/w/T/sswTQ.png", "enemy2": "http://jsrun.it/assets/3/Y/W/W/3YWWs.png", "enemy3": "http://jsrun.it/assets/7/r/l/F/7rlFw.png" }), (function () {
		Ctrl$init$();
		Game$init$();
		_Main$mainloop$();
	}));
};

_Main.main = _Main$main$AS;
_Main.main$AS = _Main$main$AS;

function _Main$mainloop$() {
	Ctrl$calc$();
	Game$calc$();
	Game$draw$();
	Timer$setTimeout$F$V$N(_Main$mainloop$, 33);
};

_Main.mainloop$ = _Main$mainloop$;

function _Main$loadImg$HSF$V$(imgs, callback) {
	var count;
	var i;
	var img;
	count = 0;
	for (i in imgs) {
		count++;
	}
	if (count > 0) {
		for (i in imgs) {
			img = (function ($v) {
				if (! ($v == null || $v instanceof HTMLImageElement)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:48:51] detected invalid cast, value is not an instance of the designated type or null\n                var img = dom.createElement(\"img\") as HTMLImageElement;\r\n                                                   ^^\n");
				}
				return $v;
			}(dom$createElement$S("img")));
			img.onload = (function (e) {
				if (-- count === 0) {
					callback();
				}
			});
			img.src = (function (v) {
				if (! (v != null)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:53:30] null access\n                img.src = imgs[i];\r\n                              ^\n");
				}
				return v;
			}(imgs[i]));
			_Main.imgs[i] = img;
		}
	} else {
		callback();
	}
};

_Main.loadImg$HSF$V$ = _Main$loadImg$HSF$V$;

function Game() {
};

$__jsx_extend([Game], Object);
function Game$init$() {
	var w;
	var h;
	Game.field = new Field();
	w = Game.field.canvas.width;
	h = Game.field.canvas.height;
	Game.clist = [];
	Game.slist = [];
	Game.player = new GamePlayer("player", w * Math.random(), h * Math.random(), Math.PI / 180 * 45);
	Game.enemy = [];
	Game.enemy.push(new GameCharacter("enemy1", w * Math.random(), h * Math.random(), Math.PI * 2 * Math.random()));
	Game.enemy.push(new GameCharacter("enemy2", w * Math.random(), h * Math.random(), Math.PI * 2 * Math.random()));
	Game.enemy.push(new GameCharacter("enemy3", w * Math.random(), h * Math.random(), Math.PI * 2 * Math.random()));
	Ccvs.cx0 = Ccvs.cx1 = Game.player.x;
	Ccvs.cy0 = Ccvs.cy1 = Game.player.y;
	Ccvs.scale = 1;
	Ccvs.roth = Math.PI / 180 * 45;
	Ccvs.rotv = Math.PI / 180 * 45;
	Ccvs.sinv = Math.sin(Ccvs.rotv);
	Ccvs.cosv = Math.cos(Ccvs.rotv);
};

Game.init$ = Game$init$;

function Game$calc$() {
	var $math_abs_t;
	var r;
	var walk;
	var dr;
	var x;
	var y;
	var size;
	var length;
	var margin;
	var rotateRatio;
	var num;
	var c;
	var s;
	var i;
	var speed;
	r = Game.player.r;
	walk = true;
	if (Cbtn.krt && Cbtn.kup) {
		r = Math.PI * 1.74 - Ccvs.rotv;
	} else {
		if (Cbtn.klt && Cbtn.kup) {
			r = Math.PI * 1.26 - Ccvs.rotv;
		} else {
			if (Cbtn.klt && Cbtn.kdn) {
				r = Math.PI * 0.74 - Ccvs.rotv;
			} else {
				if (Cbtn.krt && Cbtn.kdn) {
					r = Math.PI * 0.26 - Ccvs.rotv;
				} else {
					if (Cbtn.krt) {
						r = Math.PI * 0.00 - Ccvs.rotv;
					} else {
						if (Cbtn.kup) {
							r = Math.PI * 1.50 - Ccvs.rotv;
						} else {
							if (Cbtn.klt) {
								r = Math.PI * 1.00 - Ccvs.rotv;
							} else {
								if (Cbtn.kdn) {
									r = Math.PI * 0.50 - Ccvs.rotv;
								} else {
									walk = false;
								}
							}
						}
					}
				}
			}
		}
	}
	dr = Game.player.r - r;
	while (dr < - Math.PI) {
		dr += 2 * Math.PI;
	}
	while (dr > Math.PI) {
		dr -= 2 * Math.PI;
	}
	Game.player.r -= dr * 0.5;
	if (Cbtn.k_s && Game.player.motion !== "beam") {
		if (Game.player.motion !== "charge") {
			Game.player.motion = "charge";
			Game.player.action = 0;
		} else {
			Game.player.action++;
			Game.player.charge = Math.min(1, Game.player.action / 90);
			x = Game.player.x + 10 * Math.cos(Game.player.r - Math.PI * 0.4);
			y = Game.player.y + 10 * Math.sin(Game.player.r - Math.PI * 0.4);
			Game.clist.push(new DrawEffect(x, y, 10, Game.player.charge * 3));
			Ccvs.color = "rgba(0, 0, 0, " + (0.4 * Game.player.charge + "") + ")";
		}
	} else {
		if (Game.player.motion === "charge") {
			Game.player.motion = "beam";
			Game.player.action = 0;
		} else {
			if (Game.player.motion === "beam") {
				Game.player.action++;
				size = 0;
				if (Game.player.charge < 0.2) {
					size = Math.min(3, Math.max(0.3, Game.player.action - 0)) + Math.min(0, 40 - Game.player.action);
				} else {
					if (Game.player.charge < 0.8) {
						size = Math.min(6, Math.max(0.3, Game.player.action - 5)) + Math.min(0, 50 - Game.player.action);
					} else {
						size = Math.min(10, Math.max(0.3, Game.player.action - 10)) + Math.min(0, 60 - Game.player.action);
					}
				}
				if (size > 0) {
					length = 400;
					margin = 15 + size;
					rotateRatio = 1 - (($math_abs_t = Ccvs.sinh * Math.sin(Game.player.r + Ccvs.rotv)) >= 0 ? $math_abs_t : -$math_abs_t);
					num = Math.ceil(rotateRatio * length / (size * 3));
					r = (length - margin) / num;
					c = Math.cos(Game.player.r);
					s = Math.sin(Game.player.r);
					for (i = 0; i < num; i++) {
						x = Game.player.x + (margin + i * r) * c;
						y = Game.player.y + (margin + i * r) * s;
						Game.clist.push(new DrawEffect(x, y, 10, size));
					}
					Ccvs.color = "rgba(0, 0, 0, " + (0.5 + 0.03 * size + "") + ")";
				} else {
					Game.player.motion = "stand";
					Ccvs.color = "";
				}
			} else {
				if (walk) {
					speed = 3;
					Game.player.x += speed * Math.cos(Game.player.r);
					Game.player.y += speed * Math.sin(Game.player.r);
					Game.player.motion = "walk";
					Game.player.action++;
				} else {
					Game.player.motion = "stand";
				}
			}
		}
	}
	Ccvs.cx1 = Game.player.x;
	Ccvs.cy1 = Game.player.y;
};

Game.calc$ = Game$calc$;

function Game$draw$() {
	var i;
	Ccvs.context.fillStyle = "black";
	Ccvs.context.fillRect(0, 0, Ccvs.canvas.width, Ccvs.canvas.height);
	Game.field.draw$NN(Ccvs.cx0, Ccvs.cy0);
	Game.player.preDraw$();
	for (i = 0; i < Game.enemy.length; i++) {
		Game.enemy[i].preDraw$();
	}
	DrawUnit$drawList$ALDrawUnit$(Game.slist);
	if (Ccvs.color !== "") {
		Ccvs.context.fillStyle = Ccvs.color;
		Ccvs.context.fillRect(0, 0, Ccvs.canvas.width, Ccvs.canvas.height);
	}
	DrawUnit$drawList$ALDrawUnit$(Game.clist);
};

Game.draw$ = Game$draw$;

function Field() {
	var r;
	var divide;
	var margin;
	var unitWidth;
	var i;
	var posx0;
	var posx1;
	var j;
	var posy0;
	var posy1;
	var pos;
	this.canvas = (function ($v) {
		if (! ($v == null || $v instanceof HTMLCanvasElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:264:66] detected invalid cast, value is not an instance of the designated type or null\n        this.canvas = dom.window.document.createElement(\"canvas\") as HTMLCanvasElement;\r\n                                                                  ^^\n");
		}
		return $v;
	}(dom.window.document.createElement("canvas")));
	this.context = (function ($v) {
		if (! ($v == null || $v instanceof CanvasRenderingContext2D)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:265:52] detected invalid cast, value is not an instance of the designated type or null\n        this.context = this.canvas.getContext(\"2d\") as CanvasRenderingContext2D;\r\n                                                    ^^\n");
		}
		return $v;
	}(this.canvas.getContext("2d")));
	r = this.canvas.width = this.canvas.height = 510;
	divide = 20;
	margin = 5;
	unitWidth = (r - margin * 2) / divide;
	this.context.fillStyle = "white";
	this.context.fillRect(0, 0, r, r);
	for (i = 0; i < divide; i++) {
		posx0 = margin + unitWidth * (i + 0);
		posx1 = margin + unitWidth * (i + 1);
		for (j = 0; j < divide; j++) {
			this.context.fillStyle = ((i + j) % 2 === 0 ? "white" : "gray");
			posy0 = margin + unitWidth * (j + 0);
			posy1 = margin + unitWidth * (j + 1);
			this.context.beginPath();
			this.context.moveTo(posx0, posy0);
			this.context.lineTo(posx1, posy0);
			this.context.lineTo(posx1, posy1);
			this.context.lineTo(posx0, posy1);
			this.context.closePath();
			this.context.fill();
		}
	}
	for (i = 0; i < 2; i++) {
		for (j = 0; j < divide + 1; j++) {
			pos = margin + unitWidth * j;
			this.context.beginPath();
			if (i === 0) {
				this.context.moveTo(margin, pos);
				this.context.lineTo(r - margin, pos);
			}
			if (i === 1) {
				this.context.moveTo(pos, margin);
				this.context.lineTo(pos, r - margin);
			}
			this.context.closePath();
			this.context.stroke();
		}
	}
	this.context.beginPath();
	this.context.moveTo(0, 0);
	this.context.lineTo(0, r);
	this.context.lineTo(r, r);
	this.context.lineTo(r, 0);
	this.context.closePath();
	this.context.stroke();
};

$__jsx_extend([Field], Object);
Field.prototype.draw$NN = function (x, y) {
	Ccvs.context.save();
	Ccvs.context.translate(Ccvs.canvas.width * 0.5, Ccvs.canvas.height * 0.5);
	Ccvs.context.scale(Ccvs.scale, Ccvs.scale * Ccvs.sinh);
	Ccvs.context.rotate(Ccvs.rotv);
	Ccvs.context.translate(- x, - y);
	Ccvs.context.drawImage(this.canvas, 0, 0);
	Ccvs.context.restore();
};


function GameCharacter(imgName, x, y, r) {
	this.x = 0;
	this.y = 0;
	this.r = 0;
	this.motion = "";
	this.action = 0;
	this._character = new DrawCharacter(_Main.imgs[imgName], 1.2, ({ "head": [ [ 0.00, 0.00, 0.00, 0, 0, 16, 0 ], [ - 0.06, 0.20, - 0.02, 0, 48, 16, 0 ], [ - 0.06, - 0.20, - 0.02, 0, 48, 16, 1 ], [ - 0.19, 0.00, - 0.09, 0, 64, 16, 0 ] ], "body": [ [ 0.00, 0.00, 0.00, 0, 16, 16, 0 ] ], "ftr1": [ [ 0.00, 0.00, 0.00, 0, 32, 8, 0 ] ], "ftl1": [ [ 0.00, 0.00, 0.00, 0, 32, 8, 1 ] ], "ftr2": [ [ 0.00, 0.00, 0.00, 32, 32, 8, 0 ] ], "ftl2": [ [ 0.00, 0.00, 0.00, 32, 32, 8, 1 ] ], "hndr": [ [ 0.00, 0.00, 0.00, 0, 40, 8, 0 ] ], "hndl": [ [ 0.00, 0.00, 0.00, 0, 40, 8, 1 ] ] }), ({ "stand": [ ({ "head": [ 1, 0.00, 0.00, 0.52, 45 * 0 ], "body": [ 1, - 0.02, 0.00, 0.27, 0 ], "ftr1": [ 1, 0.02, 0.10, 0.10, 0 ], "ftl1": [ 1, - 0.02, - 0.10, 0.10, 0 ], "hndr": [ 0, - 0.02, 0.20, 0.25, 0 ], "hndl": [ 0, 0.02, - 0.20, 0.25, 0 ] }) ], "walk": [ ({ "head": [ 1, 0.12, 0.00, 0.45, 0 ], "body": [ 1, 0.00, 0.00, 0.23, 0 ], "ftr1": [ 1, 0.10, 0.07, 0.10, 0 ], "ftl2": [ 1, - 0.20, - 0.07, 0.20, 0 ], "hndr": [ 0, - 0.10, 0.15, 0.25, 0 ], "hndl": [ 0, 0.10, - 0.15, 0.25, 0 ] }), ({ "head": [ 1, 0.12, 0.00, 0.47, 0 ], "body": [ 1, 0.00, 0.00, 0.26, 0 ], "ftr1": [ 1, 0.00, 0.07, 0.10, 0 ], "ftl1": [ 1, 0.00, - 0.07, 0.15, 0 ], "hndr": [ 0, - 0.05, 0.18, 0.25, 0 ], "hndl": [ 0, 0.05, - 0.18, 0.25, 0 ] }), ({ "head": [ 1, 0.12, 0.00, 0.45, 0 ], "body": [ 1, 0.00, 0.00, 0.23, 0 ], "ftr2": [ 1, - 0.20, 0.07, 0.20, 0 ], "ftl1": [ 1, 0.10, - 0.07, 0.10, 0 ], "hndr": [ 0, 0.10, 0.15, 0.25, 0 ], "hndl": [ 0, - 0.10, - 0.15, 0.25, 0 ] }), ({ "head": [ 1, 0.12, 0.00, 0.47, 0 ], "body": [ 1, 0.00, 0.00, 0.26, 0 ], "ftr1": [ 1, 0.00, 0.07, 0.15, 0 ], "ftl1": [ 1, 0.00, - 0.07, 0.10, 0 ], "hndr": [ 0, 0.05, 0.18, 0.25, 0 ], "hndl": [ 0, - 0.05, - 0.18, 0.25, 0 ] }) ], "charge": [ ({ "head": [ 1, 0.02, 0.00, 0.52, 0 ], "body": [ 1, 0.00, 0.00, 0.27, - 45 ], "ftr1": [ 1, 0.04, 0.09, 0.10, 0 ], "ftl1": [ 1, - 0.04, - 0.09, 0.10, 0 ], "hndr": [ 0, 0.06, - 0.10, 0.30, 0 ], "hndl": [ 0, - 0.06, - 0.18, 0.30, 0 ] }) ], "beam": [ ({ "head": [ 1, 0.06, 0.00, 0.52, 0 ], "body": [ 1, 0.04, 0.00, 0.27, 0 ], "ftr1": [ 1, 0.06, 0.08, 0.10, 0 ], "ftl2": [ 1, - 0.06, - 0.08, 0.15, 0 ], "hndr": [ 0, 0.18, 0.06, 0.30, 0 ], "hndl": [ 0, 0.18, - 0.06, 0.30, 0 ] }) ] }));
	this._shadow = new DrawShadow(1.2);
	Game.clist.push(this._character);
	Game.slist.push(this._shadow);
	this.x = x;
	this.y = y;
	this.r = r;
};

$__jsx_extend([GameCharacter], Object);
GameCharacter.prototype.preDraw$ = function () {
	var x;
	var y;
	x = this.x - Ccvs.cx0;
	y = this.y - Ccvs.cy0;
	this._shadow.preDraw$NNN(x, y, 0);
	switch (this.motion) {
	case "walk":
		this._character.preDraw$NNNNSI(x, y, 0, this.r, "walk", ((this.action / 6 | 0) % this._character.getLen$S("walk") | 0));
		break;
	case "charge":
		this._character.preDraw$NNNNSI(x, y, 0, this.r, "charge", 0);
		break;
	case "beam":
		this._character.preDraw$NNNNSI(x, y, 0, this.r, "beam", 0);
		break;
	default:
		this._character.preDraw$NNNNSI(x, y, 0, this.r, "stand", 0);
		break;
	}
};


function GamePlayer(imgName, x, y, r) {
	GameCharacter.call(this, imgName, x, y, r);
	this.charge = 0;
};

$__jsx_extend([GamePlayer], GameCharacter);
function DrawUnit() {
	this.visible = false;
	this.exist = true;
	this.drz = 0;
};

$__jsx_extend([DrawUnit], Object);
function DrawUnit$drawList$ALDrawUnit$(list) {
	var i;
	for (i = 0; i < list.length; i++) {
		if (! list[i].exist) {
			list.splice(i--, 1);
		}
	}
	list.sort((function (u0, u1) {
		return u0.drz - u1.drz;
	}));
	for (i = 0; i < list.length; i++) {
		if (list[i].visible) {
			list[i].draw$();
			list[i].visible = false;
		}
	}
};

DrawUnit.drawList$ALDrawUnit$ = DrawUnit$drawList$ALDrawUnit$;

function DrawEffect(x, y, z, size) {
	DrawUnit.call(this);
	this._drx = 0;
	this._dry = 0;
	this._drScale = 0;
	this.preDraw$NNNN(x - Ccvs.cx0, y - Ccvs.cy0, z, size);
};

$__jsx_extend([DrawEffect], DrawUnit);
DrawEffect.prototype.preDraw$NNNN = function (x, y, z, size) {
	var y0;
	var z0;
	this.visible = true;
	this._drx = Ccvs.scale * (x * Ccvs.cosv - y * Ccvs.sinv);
	y0 = Ccvs.scale * (x * Ccvs.sinv + y * Ccvs.cosv);
	z0 = Ccvs.scale * z;
	this._dry = y0 * Ccvs.sinh - z0 * Ccvs.cosh;
	this.drz = y0 * Ccvs.cosh + z0 * Ccvs.sinh;
	this._drScale = Ccvs.scale * size;
};


DrawEffect.prototype.draw$ = function () {
	var s;
	var x;
	var y;
	var grd;
	s = 16 * this._drScale | 0;
	x = this._drx + Ccvs.canvas.width * 0.5 | 0;
	y = this._dry + Ccvs.canvas.height * 0.5 | 0;
	Ccvs.context.save();
	Ccvs.context.globalCompositeOperation = "lighter";
	grd = Ccvs.context.createRadialGradient(x, y, 0, x, y, s * 0.5);
	grd.addColorStop(0, "rgba(255, 255, 255, 1)");
	grd.addColorStop(1, "rgba(0, 0, 0, 0)");
	Ccvs.context.fillStyle = grd;
	Ccvs.context.fillRect(x - s * 0.5, y - s * 0.5, s, s);
	Ccvs.context.restore();
	this.exist = false;
};


function DrawCharacter(img, size, parts, pose) {
	var i;
	var j;
	var temp;
	var x;
	var y;
	var z;
	var u;
	var v;
	var s;
	var swap;
	DrawUnit.call(this);
	this._duList = null;
	this._parts = null;
	this._pose = null;
	this._size = 0;
	this.img = null;
	this.drX0 = 0;
	this.drY0 = 0;
	this.drZ0 = 0;
	this.drScale = 0;
	this.drRotv = 0;
	this.drSin = 0;
	this.drCos = 0;
	this.drAngv1 = 0;
	this.drAngv2 = 0;
	if (DrawCharacter.canvas == null) {
		DrawCharacter.canvas = (function ($v) {
			if (! ($v == null || $v instanceof HTMLCanvasElement)) {
				debugger;
				throw new Error("[/tmp/wgSM3b81rn.jsx:505:79] detected invalid cast, value is not an instance of the designated type or null\n            DrawCharacter.canvas = dom.window.document.createElement(\"canvas\") as HTMLCanvasElement;\r\n                                                                               ^^\n");
			}
			return $v;
		}(dom.window.document.createElement("canvas")));
		DrawCharacter.context = (function ($v) {
			if (! ($v == null || $v instanceof CanvasRenderingContext2D)) {
				debugger;
				throw new Error("[/tmp/wgSM3b81rn.jsx:506:74] detected invalid cast, value is not an instance of the designated type or null\n            DrawCharacter.context = DrawCharacter.canvas.getContext(\"2d\") as CanvasRenderingContext2D;\r\n                                                                          ^^\n");
			}
			return $v;
		}(DrawCharacter.canvas.getContext("2d")));
		DrawCharacter.canvas.width = Ccvs.canvas.width;
		DrawCharacter.canvas.height = Ccvs.canvas.height;
	}
	this.img = img;
	this._duList = [];
	this._parts = ({  });
	this._pose = pose;
	this._size = size;
	for (i in parts) {
		this._parts[i] = [];
		for (j = 0; j < parts[i].length; j++) {
			temp = parts[i][j];
			x = temp[0];
			y = temp[1];
			z = temp[2];
			u = Math.round((function (v) {
				if (! (v != null)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:525:39] null access\n                var u = Math.round(temp[3]);\r\n                                       ^\n");
				}
				return v;
			}(temp[3])));
			v = Math.round((function (v) {
				if (! (v != null)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:526:39] null access\n                var v = Math.round(temp[4]);\r\n                                       ^\n");
				}
				return v;
			}(temp[4])));
			s = Math.round((function (v) {
				if (! (v != null)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:527:39] null access\n                var s = Math.round(temp[5]);\r\n                                       ^\n");
				}
				return v;
			}(temp[5])));
			swap = Math.round((function (v) {
				if (! (v != null)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:528:43] null access\n                var swap = (Math.round(temp[6]) > 0);\r\n                                           ^\n");
				}
				return v;
			}(temp[6]))) > 0;
			this._parts[i][j] = new DrawCharacterParts(this, (function (v) {
				if (! (v != null)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:529:65] null access\n                this._parts[i][j] = new DrawCharacterParts(this, x, y, z, u, v, s, swap);\r\n                                                                 ^\n");
				}
				return v;
			}(x)), (function (v) {
				if (! (v != null)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:529:68] null access\n                this._parts[i][j] = new DrawCharacterParts(this, x, y, z, u, v, s, swap);\r\n                                                                    ^\n");
				}
				return v;
			}(y)), (function (v) {
				if (! (v != null)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:529:71] null access\n                this._parts[i][j] = new DrawCharacterParts(this, x, y, z, u, v, s, swap);\r\n                                                                       ^\n");
				}
				return v;
			}(z)), (u | 0), (v | 0), (s | 0), swap);
			this._duList.push(this._parts[i][j]);
		}
	}
};

$__jsx_extend([DrawCharacter], DrawUnit);
DrawCharacter.prototype.getLen$S = function (motion) {
	return (this._pose[motion].length | 0);
};


DrawCharacter.prototype.preDraw$NNNNSI = function (x, y, z, r, motion, action) {
	var pose;
	var i;
	var j;
	if (this._pose[motion] == null || this._pose[motion][action] == null) {
		return;
	}
	this.visible = true;
	this.drX0 = Ccvs.scale * (x * Ccvs.cosv - y * Ccvs.sinv);
	this.drY0 = Ccvs.scale * (x * Ccvs.sinv + y * Ccvs.cosv);
	this.drZ0 = Ccvs.scale * z;
	this.drz = this.drY0 * Ccvs.cosh + this.drZ0 * Ccvs.sinh;
	this.drScale = Ccvs.scale * this._size;
	this.drRotv = Ccvs.rotv + r;
	this.drSin = Math.sin(this.drRotv);
	this.drCos = Math.cos(this.drRotv);
	pose = this._pose[motion][action];
	for (i in pose) {
		for (j in this._parts[i]) {
			this._parts[i][j].preDraw$AN(pose[i]);
		}
	}
};


DrawCharacter.prototype.draw$ = function () {
	var x;
	var y;
	var w;
	var h;
	DrawCharacter.minx = (DrawCharacter.canvas.width | 0);
	DrawCharacter.miny = (DrawCharacter.canvas.height | 0);
	DrawCharacter.maxx = 0;
	DrawCharacter.maxy = 0;
	DrawUnit$drawList$ALDrawUnit$(this._duList);
	x = Math.max(0, DrawCharacter.minx);
	y = Math.max(0, DrawCharacter.miny);
	w = Math.min(DrawCharacter.canvas.width - x, DrawCharacter.maxx - DrawCharacter.minx);
	h = Math.min(DrawCharacter.canvas.height - y, DrawCharacter.maxy - DrawCharacter.miny);
	if (w > 0 && h > 0) {
		if (Ccvs.color !== "") {
			DrawCharacter.context.save();
			DrawCharacter.context.globalCompositeOperation = "source-atop";
			DrawCharacter.context.fillStyle = Ccvs.color;
			DrawCharacter.context.fillRect(x, y, w, h);
			DrawCharacter.context.restore();
		}
		Ccvs.context.drawImage(DrawCharacter.canvas, x, y, w, h, x, y, w, h);
		DrawCharacter.context.clearRect(x, y, w, h);
	}
};


function DrawCharacterParts(character, x2, y2, z2, u, v, uvsize, swap) {
	DrawUnit.call(this);
	this._drx = 0;
	this._dry = 0;
	this._dru = 0;
	this._drv = 0;
	this._yswap = false;
	this._zswap = false;
	this._character = character;
	this._x2 = x2;
	this._y2 = y2;
	this._z2 = z2;
	this._u = u;
	this._v = v;
	this._uvsize = uvsize;
	this._swap = swap;
};

$__jsx_extend([DrawCharacterParts], DrawUnit);
DrawCharacterParts.prototype.preDraw$AN = function (pose) {
	var type;
	var rotv;
	var av;
	var x2;
	var y2;
	var z2;
	var cos;
	var sin;
	var x2r;
	var y2r;
	var x1;
	var y1;
	var z1;
	var y0;
	var z0;
	this.visible = true;
	type = Math.round((function (v) {
		if (! (v != null)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:638:34] null access\n        var type = Math.round(pose[0]);\r\n                                  ^\n");
		}
		return v;
	}(pose[0])));
	rotv = Math.PI * (function (v) {
		if (! (v != null)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:641:33] null access\n        var rotv = Math.PI * pose[4] / 180;\r\n                                 ^\n");
		}
		return v;
	}(pose[4])) / 180;
	av = 0;
	switch (type) {
	case 1:
	case 2:
	case 3:
	case 4:
		av = Math.round(1 - 180 / Math.PI * (this._character.drRotv + rotv) / 90) % 4;
		while (av < 0) {
			av += 4;
		}
		break;
	case 5:
		av = Math.round(1 - 180 / Math.PI * (this._character.drRotv + rotv) / 45) % 4;
		while (av < 0) {
			av += 4;
		}
		break;
	}
	x2 = this._x2;
	y2 = this._y2;
	z2 = this._z2;
	this._yswap = false;
	this._zswap = false;
	if (type === 3 || type === 4) {
		this._zswap = ! this._zswap;
		z2 *= - 1;
	}
	if (type === 2 || type === 3) {
		if (av === 0) {
			av = 2;
		} else {
			if (av === 2) {
				av = 0;
			}
		}
		this._yswap = ! this._yswap;
		x2 *= - 1;
	}
	if (this._swap) {
		if (av === 1) {
			av = 3;
		} else {
			if (av === 3) {
				av = 1;
			}
		}
		this._yswap = ! this._yswap;
	}
	if (pose[4] !== 0) {
		cos = Math.cos(rotv);
		sin = Math.sin(rotv);
		x2r = x2 * cos - y2 * sin;
		y2r = x2 * sin + y2 * cos;
		x2 = x2r;
		y2 = y2r;
	}
	x1 = (function (v) {
		if (! (v != null)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:682:21] null access\n        var x1 = pose[1] + x2;\r\n                     ^\n");
		}
		return v;
	}(pose[1])) + x2;
	y1 = (function (v) {
		if (! (v != null)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:683:21] null access\n        var y1 = pose[2] + y2;\r\n                     ^\n");
		}
		return v;
	}(pose[2])) + y2;
	z1 = (function (v) {
		if (! (v != null)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:684:21] null access\n        var z1 = pose[3] + z2;\r\n                     ^\n");
		}
		return v;
	}(pose[3])) + z2;
	this._drx = this._character.drX0 + this._character.drScale * 35 * (x1 * this._character.drCos - y1 * this._character.drSin);
	y0 = this._character.drY0 + this._character.drScale * 35 * (x1 * this._character.drSin + y1 * this._character.drCos);
	z0 = this._character.drZ0 + this._character.drScale * 35 * (z1 - 0.05);
	this._dry = y0 * Ccvs.sinh - z0 * Ccvs.cosh;
	this.drz = y0 * Ccvs.cosh + z0 * Ccvs.sinh;
	this._dru = (this._u + av * this._uvsize | 0);
	this._drv = this._v;
};


DrawCharacterParts.prototype.draw$ = function () {
	var s2;
	var s1;
	var xc;
	var yc;
	var xm;
	var ym;
	var xp;
	var yp;
	s2 = this._uvsize * this._character.drScale | 0;
	s1 = s2 * 0.5 | 0;
	xc = this._drx + DrawCharacter.canvas.width * 0.5 | 0;
	yc = this._dry + DrawCharacter.canvas.height * 0.5 | 0;
	xm = xc - s1;
	ym = yc - s1;
	xp = xc + s1;
	yp = yc + s1;
	if (0 < xp || xm < DrawCharacter.canvas.width || 0 < yp || ym < DrawCharacter.canvas.height) {
		if (DrawCharacter.minx > xm) {
			DrawCharacter.minx = (xm | 0);
		}
		if (DrawCharacter.miny > ym) {
			DrawCharacter.miny = (ym | 0);
		}
		if (DrawCharacter.maxx < xp) {
			DrawCharacter.maxx = (xp | 0);
		}
		if (DrawCharacter.maxy < yp) {
			DrawCharacter.maxy = (yp | 0);
		}
		if (this._yswap || this._zswap) {
			DrawCharacter.context.save();
			DrawCharacter.context.translate(xc, yc);
			DrawCharacter.context.scale((this._yswap ? - 1 : 1), (this._zswap ? - 1 : 1));
			DrawCharacter.context.translate(- xc, - yc);
			DrawCharacter.context.drawImage(this._character.img, this._dru, this._drv, this._uvsize, this._uvsize, xm, ym, s2, s2);
			DrawCharacter.context.restore();
		} else {
			DrawCharacter.context.drawImage(this._character.img, this._dru, this._drv, this._uvsize, this._uvsize, xm, ym, s2, s2);
		}
	}
};


function DrawShadow(size) {
	var context;
	DrawUnit.call(this);
	this._size = 0;
	this._drx = 0;
	this._dry = 0;
	this._drScale = 0;
	if (DrawShadow.canvas == null) {
		DrawShadow.canvas = (function ($v) {
			if (! ($v == null || $v instanceof HTMLCanvasElement)) {
				debugger;
				throw new Error("[/tmp/wgSM3b81rn.jsx:748:76] detected invalid cast, value is not an instance of the designated type or null\n            DrawShadow.canvas = dom.window.document.createElement(\"canvas\") as HTMLCanvasElement;\r\n                                                                            ^^\n");
			}
			return $v;
		}(dom.window.document.createElement("canvas")));
		context = (function ($v) {
			if (! ($v == null || $v instanceof CanvasRenderingContext2D)) {
				debugger;
				throw new Error("[/tmp/wgSM3b81rn.jsx:749:61] detected invalid cast, value is not an instance of the designated type or null\n            var context = DrawShadow.canvas.getContext(\"2d\") as CanvasRenderingContext2D;\r\n                                                             ^^\n");
			}
			return $v;
		}(DrawShadow.canvas.getContext("2d")));
		DrawShadow.canvas.width = DrawShadow.canvas.height = 32;
		context.fillStyle = "rgba(0, 0, 0, 0.5)";
		context.arc(16, 16, 15, 0, Math.PI * 2.0, true);
		context.fill();
	}
	this._size = size;
};

$__jsx_extend([DrawShadow], DrawUnit);
DrawShadow.prototype.preDraw$NNN = function (x, y, z) {
	var y0;
	var z0;
	this.visible = true;
	this._drx = Ccvs.scale * (x * Ccvs.cosv - y * Ccvs.sinv);
	y0 = Ccvs.scale * (x * Ccvs.sinv + y * Ccvs.cosv);
	z0 = Ccvs.scale * z;
	this._dry = y0 * Ccvs.sinh - z0 * Ccvs.cosh;
	this.drz = y0 * Ccvs.cosh + z0 * Ccvs.sinh;
	this._drScale = Ccvs.scale * this._size;
};


DrawShadow.prototype.draw$ = function () {
	var psx;
	var psy;
	var px;
	var py;
	psx = 16 * this._drScale | 0;
	psy = psx * Ccvs.sinh | 0;
	px = this._drx - psx * 0.5 + Ccvs.canvas.width * 0.5 | 0;
	py = this._dry - psy * 0.5 + Ccvs.canvas.height * 0.5 | 0;
	Ccvs.context.drawImage(DrawShadow.canvas, px, py, psx, psy);
};


function Ctrl() {
};

$__jsx_extend([Ctrl], Object);
function Ctrl$init$() {
	Ctrl.div = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:810:55] detected invalid cast, value is not an instance of the designated type or null\n        Ctrl.div = dom.document.getElementById(\"root\") as HTMLDivElement;\r\n                                                       ^^\n");
		}
		return $v;
	}(dom.document.getElementById("root")));
	Ctrl.isTouch = !! eval("'ontouchstart' in window");
	if (Ctrl.isTouch) {
		Ctrl.div.addEventListener("touchstart", Ctrl$mdnfn$LEvent$, true);
		Ctrl.div.addEventListener("touchmove", Ctrl$mmvfn$LEvent$, true);
		Ctrl.div.addEventListener("touchend", Ctrl$mupfn$LEvent$, true);
		Ctrl.div.addEventListener("touchcancel", Ctrl$mupfn$LEvent$, true);
	} else {
		Ctrl.div.addEventListener("mousedown", Ctrl$mdnfn$LEvent$, true);
		Ctrl.div.addEventListener("mousemove", Ctrl$mmvfn$LEvent$, true);
		Ctrl.div.addEventListener("mouseup", Ctrl$mupfn$LEvent$, true);
		Ctrl.div.addEventListener("mouseout", (function (e) {
			var me;
			me = (function ($v) {
				if (! ($v == null || $v instanceof MouseEvent)) {
					debugger;
					throw new Error("[/tmp/wgSM3b81rn.jsx:824:40] detected invalid cast, value is not an instance of the designated type or null\n                var me : MouseEvent = e as MouseEvent;\r\n                                        ^^\n");
				}
				return $v;
			}(e));
			if (Ctrl.mdn && me.target == Ctrl.div && (me.clientX <= 0 || Ctrl.ww <= me.clientX || me.clientY <= 0 || Ctrl.wh <= me.clientY)) {
				Ctrl$mupfn$LEvent$(e);
			}
		}), true);
		dom.document.addEventListener("keydown", Cbtn$kdnfn$LEvent$, true);
		dom.document.addEventListener("keyup", Cbtn$kupfn$LEvent$, true);
	}
	Cbtn$init$();
	Ccvs$init$();
};

Ctrl.init$ = Ctrl$init$;

function Ctrl$calc$() {
	var w;
	var h;
	w = dom.window.innerWidth;
	h = dom.window.innerHeight;
	if (Ctrl.ww !== w || Ctrl.wh !== h) {
		Ctrl.ww = (w | 0);
		Ctrl.wh = (h | 0);
	}
	Cbtn$calc$();
	Ccvs$calc$();
};

Ctrl.calc$ = Ctrl$calc$;

function Ctrl$getmmv$LEvent$(e) {
	var te;
	var me;
	if (Ctrl.isTouch) {
		te = (function ($v) {
			if (! ($v == null || $v instanceof TouchEvent)) {
				debugger;
				throw new Error("[/tmp/wgSM3b81rn.jsx:857:36] detected invalid cast, value is not an instance of the designated type or null\n            var te : TouchEvent = e as TouchEvent;\r\n                                    ^^\n");
			}
			return $v;
		}(e));
		Ctrl.mx = (te.changedTouches[0].clientX | 0);
		Ctrl.my = (te.changedTouches[0].clientY | 0);
	} else {
		me = (function ($v) {
			if (! ($v == null || $v instanceof MouseEvent)) {
				debugger;
				throw new Error("[/tmp/wgSM3b81rn.jsx:861:36] detected invalid cast, value is not an instance of the designated type or null\n            var me : MouseEvent = e as MouseEvent;\r\n                                    ^^\n");
			}
			return $v;
		}(e));
		Ctrl.mx = (me.clientX | 0);
		Ctrl.my = (me.clientY | 0);
	}
};

Ctrl.getmmv$LEvent$ = Ctrl$getmmv$LEvent$;

function Ctrl$mdnfn$LEvent$(e) {
	Ctrl$getmmv$LEvent$(e);
	if (Cbtn$btnchk$()) {
		Cbtn$btnfn$B(false);
		Ctrl._mode = 1;
	} else {
		Ctrl.mdn = true;
		Ctrl.mmv = false;
		Ctrl._mode = 2;
		Ctrl._tempmx = Ctrl.mx;
		Ctrl._tempmy = Ctrl.my;
	}
	e.preventDefault();
};

Ctrl.mdnfn$LEvent$ = Ctrl$mdnfn$LEvent$;

function Ctrl$mmvfn$LEvent$(e) {
	var x;
	var y;
	Ctrl$getmmv$LEvent$(e);
	if (Ctrl._mode > 0) {
		if (Ctrl._mode === 1) {
			Cbtn$btnfn$B(false);
		} else {
			if (Ctrl._mode === 2) {
				if (! Ctrl.mmv) {
					x = Ctrl._tempmx - Ctrl.mx;
					y = Ctrl._tempmy - Ctrl.my;
					Ctrl.mmv = x * x + y * y > 10;
				}
			}
		}
	}
	e.preventDefault();
};

Ctrl.mmvfn$LEvent$ = Ctrl$mmvfn$LEvent$;

function Ctrl$mupfn$LEvent$(e) {
	Ctrl$getmmv$LEvent$(e);
	if (Ctrl._mode > 0) {
		if (Ctrl._mode === 1) {
			Cbtn$btnfn$B(true);
		} else {
			if (Ctrl._mode === 2) {
				Ctrl.mdn = false;
			}
		}
		Ctrl._mode = 0;
	}
	e.preventDefault();
};

Ctrl.mupfn$LEvent$ = Ctrl$mupfn$LEvent$;

function Cbtn() {
};

$__jsx_extend([Cbtn], Object);
function Cbtn$init$() {
	Cbtn._arrowDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:984:95] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._arrowDiv = dom.document.getElementsByClassName(\"jsx_ecstatbutton arrow\").item(0) as HTMLDivElement;\r\n                                                                                               ^^\n");
		}
		return $v;
	}(dom.document.getElementsByClassName("jsx_ecstatbutton arrow").item(0)));
	Cbtn._buttonDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:985:97] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._buttonDiv = dom.document.getElementsByClassName(\"jsx_ecstatbutton button\").item(0) as HTMLDivElement;\r\n                                                                                                 ^^\n");
		}
		return $v;
	}(dom.document.getElementsByClassName("jsx_ecstatbutton button").item(0)));
	Cbtn._upDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:986:74] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._upDiv = Cbtn._arrowDiv.getElementsByClassName(\"up\").item(0) as HTMLDivElement;\r\n                                                                          ^^\n");
		}
		return $v;
	}(Cbtn._arrowDiv.getElementsByClassName("up").item(0)));
	Cbtn._dnDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:987:74] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._dnDiv = Cbtn._arrowDiv.getElementsByClassName(\"dn\").item(0) as HTMLDivElement;\r\n                                                                          ^^\n");
		}
		return $v;
	}(Cbtn._arrowDiv.getElementsByClassName("dn").item(0)));
	Cbtn._rtDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:988:74] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._rtDiv = Cbtn._arrowDiv.getElementsByClassName(\"rt\").item(0) as HTMLDivElement;\r\n                                                                          ^^\n");
		}
		return $v;
	}(Cbtn._arrowDiv.getElementsByClassName("rt").item(0)));
	Cbtn._ltDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:989:74] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._ltDiv = Cbtn._arrowDiv.getElementsByClassName(\"lt\").item(0) as HTMLDivElement;\r\n                                                                          ^^\n");
		}
		return $v;
	}(Cbtn._arrowDiv.getElementsByClassName("lt").item(0)));
	Cbtn._zbDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:990:75] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._zbDiv = Cbtn._buttonDiv.getElementsByClassName(\"zb\").item(0) as HTMLDivElement;\r\n                                                                           ^^\n");
		}
		return $v;
	}(Cbtn._buttonDiv.getElementsByClassName("zb").item(0)));
	Cbtn._xbDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:991:75] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._xbDiv = Cbtn._buttonDiv.getElementsByClassName(\"xb\").item(0) as HTMLDivElement;\r\n                                                                           ^^\n");
		}
		return $v;
	}(Cbtn._buttonDiv.getElementsByClassName("xb").item(0)));
	Cbtn._cbDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:992:75] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._cbDiv = Cbtn._buttonDiv.getElementsByClassName(\"cb\").item(0) as HTMLDivElement;\r\n                                                                           ^^\n");
		}
		return $v;
	}(Cbtn._buttonDiv.getElementsByClassName("cb").item(0)));
	Cbtn._sbDiv = (function ($v) {
		if (! ($v == null || $v instanceof HTMLDivElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:993:75] detected invalid cast, value is not an instance of the designated type or null\n        Cbtn._sbDiv = Cbtn._buttonDiv.getElementsByClassName(\"sb\").item(0) as HTMLDivElement;\r\n                                                                           ^^\n");
		}
		return $v;
	}(Cbtn._buttonDiv.getElementsByClassName("sb").item(0)));
};

Cbtn.init$ = Cbtn$init$;

function Cbtn$calc$() {
	var kup;
	var kdn;
	var krt;
	var klt;
	var k_z;
	var k_x;
	var k_c;
	var k_s;
	kup = Cbtn._bkup || Cbtn._kkup;
	kdn = Cbtn._bkdn || Cbtn._kkdn;
	krt = Cbtn._bkrt || Cbtn._kkrt;
	klt = Cbtn._bklt || Cbtn._kklt;
	k_z = Cbtn._bk_z || Cbtn._kk_z;
	k_x = Cbtn._bk_x || Cbtn._kk_x;
	k_c = Cbtn._bk_c || Cbtn._kk_c;
	k_s = Cbtn._bk_s || Cbtn._kk_s;
	if (kup !== Cbtn.kup) {
		Cbtn.kup = kup;
		Cbtn._upDiv.className = (Cbtn.kup ? "up hover" : "up");
	}
	if (kdn !== Cbtn.kdn) {
		Cbtn.kdn = kdn;
		Cbtn._dnDiv.className = (Cbtn.kdn ? "dn hover" : "dn");
	}
	if (krt !== Cbtn.krt) {
		Cbtn.krt = krt;
		Cbtn._rtDiv.className = (Cbtn.krt ? "rt hover" : "rt");
	}
	if (klt !== Cbtn.klt) {
		Cbtn.klt = klt;
		Cbtn._ltDiv.className = (Cbtn.klt ? "lt hover" : "lt");
	}
	if (k_z !== Cbtn.k_z) {
		Cbtn.k_z = k_z;
		Cbtn._zbDiv.className = (Cbtn.k_z ? "zb hover" : "zb");
	}
	if (k_x !== Cbtn.k_x) {
		Cbtn.k_x = k_x;
		Cbtn._xbDiv.className = (Cbtn.k_x ? "xb hover" : "xb");
	}
	if (k_c !== Cbtn.k_c) {
		Cbtn.k_c = k_c;
		Cbtn._cbDiv.className = (Cbtn.k_c ? "cb hover" : "cb");
	}
	if (k_s !== Cbtn.k_s) {
		Cbtn.k_s = k_s;
		Cbtn._sbDiv.className = (Cbtn.k_s ? "sb hover" : "sb");
	}
};

Cbtn.calc$ = Cbtn$calc$;

function Cbtn$kdnfn$LEvent$(e) {
	var getkey;
	var ke;
	getkey = true;
	ke = (function ($v) {
		if (! ($v == null || $v instanceof KeyboardEvent)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:1023:19] detected invalid cast, value is not an instance of the designated type or null\n        var ke = e as KeyboardEvent;\r\n                   ^^\n");
		}
		return $v;
	}(e));
	switch (ke.keyCode) {
	case 37:
		Cbtn._kklt = true;
		break;
	case 38:
		Cbtn._kkup = true;
		break;
	case 39:
		Cbtn._kkrt = true;
		break;
	case 40:
		Cbtn._kkdn = true;
		break;
	case 88:
		Cbtn._kk_x = true;
		break;
	case 90:
		Cbtn._kk_z = true;
		break;
	case 67:
		Cbtn._kk_c = true;
		break;
	case 32:
		Cbtn._kk_s = true;
		break;
	default:
		getkey = false;
	}
	if (getkey) {
		e.preventDefault();
	}
};

Cbtn.kdnfn$LEvent$ = Cbtn$kdnfn$LEvent$;

function Cbtn$kupfn$LEvent$(e) {
	var getkey;
	var ke;
	getkey = true;
	ke = (function ($v) {
		if (! ($v == null || $v instanceof KeyboardEvent)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:1043:19] detected invalid cast, value is not an instance of the designated type or null\n        var ke = e as KeyboardEvent;\r\n                   ^^\n");
		}
		return $v;
	}(e));
	switch (ke.keyCode) {
	case 37:
		Cbtn._kklt = false;
		break;
	case 38:
		Cbtn._kkup = false;
		break;
	case 39:
		Cbtn._kkrt = false;
		break;
	case 40:
		Cbtn._kkdn = false;
		break;
	case 88:
		Cbtn._kk_x = false;
		Cbtn.trigger_x = true;
		break;
	case 90:
		Cbtn._kk_z = false;
		Cbtn.trigger_z = true;
		break;
	case 67:
		Cbtn._kk_c = false;
		Cbtn.trigger_c = true;
		break;
	case 32:
		Cbtn._kk_s = false;
		Cbtn.trigger_s = true;
		break;
	default:
		getkey = false;
	}
	if (getkey) {
		e.preventDefault();
	}
};

Cbtn.kupfn$LEvent$ = Cbtn$kupfn$LEvent$;

function Cbtn$btnchk$() {
	var flag;
	flag = false;
	flag = flag || 0 < Ctrl.mx && Ctrl.mx < 144 && Ctrl.wh - 144 < Ctrl.my && Ctrl.my < Ctrl.wh;
	flag = flag || Ctrl.ww - 144 < Ctrl.mx && Ctrl.mx < Ctrl.ww && Ctrl.wh - 144 < Ctrl.my && Ctrl.my < Ctrl.wh;
	return flag;
};

Cbtn.btnchk$ = Cbtn$btnchk$;

function Cbtn$btnfn$B(trigger) {
	var x;
	var y;
	Cbtn._bkup = Cbtn._bkdn = Cbtn._bkrt = Cbtn._bklt = false;
	Cbtn._bk_z = Cbtn._bk_x = Cbtn._bk_c = Cbtn._bk_s = false;
	if (! trigger) {
		x = Ctrl.mx - 72;
		y = Ctrl.my - Ctrl.wh + 72;
		if (x * x + y * y < 72 * 72) {
			if (y < 0 && x < y * y * 0.18 && x > y * y * - 0.18) {
				Cbtn._bkup = true;
			}
			if (y > 0 && x < y * y * 0.18 && x > y * y * - 0.18) {
				Cbtn._bkdn = true;
			}
			if (x > 0 && y < x * x * 0.18 && y > x * x * - 0.18) {
				Cbtn._bkrt = true;
			}
			if (x < 0 && y < x * x * 0.18 && y > x * x * - 0.18) {
				Cbtn._bklt = true;
			}
		}
	}
	x = Ctrl.mx - Ctrl.ww + 144;
	y = Ctrl.my - Ctrl.wh + 144;
	if (20 < x && x < 124 && 20 < y && y < 124) {
		if (trigger) {
			Cbtn.trigger_s = true;
		} else {
			Cbtn._bk_s = true;
		}
	}
};

Cbtn.btnfn$B = Cbtn$btnfn$B;

function Ccvs() {
};

$__jsx_extend([Ccvs], Object);
function Ccvs$init$() {
	Ccvs.canvas = (function ($v) {
		if (! ($v == null || $v instanceof HTMLCanvasElement)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:1145:83] detected invalid cast, value is not an instance of the designated type or null\n        Ccvs.canvas = dom.document.getElementsByClassName(\"jsx_ccvs main\").item(0) as HTMLCanvasElement;\r\n                                                                                   ^^\n");
		}
		return $v;
	}(dom.document.getElementsByClassName("jsx_ccvs main").item(0)));
	Ccvs.context = (function ($v) {
		if (! ($v == null || $v instanceof CanvasRenderingContext2D)) {
			debugger;
			throw new Error("[/tmp/wgSM3b81rn.jsx:1146:52] detected invalid cast, value is not an instance of the designated type or null\n        Ccvs.context = Ccvs.canvas.getContext(\"2d\") as CanvasRenderingContext2D;\r\n                                                    ^^\n");
		}
		return $v;
	}(Ccvs.canvas.getContext("2d")));
	Ccvs.scale = 1;
	Ccvs.rotv = Math.PI / 180 * 0;
	Ccvs.roth = Math.PI / 180 * 45;
	Ccvs.sinv = Math.sin(Ccvs.rotv);
	Ccvs.cosv = Math.cos(Ccvs.rotv);
	Ccvs.sinh = Math.sin(Ccvs.roth);
	Ccvs.cosh = Math.cos(Ccvs.roth);
};

Ccvs.init$ = Ccvs$init$;

function Ccvs$calc$() {
	var x0;
	var y0;
	var r0;
	var x1;
	var y1;
	var r1;
	var cos;
	var drh;
	var scale;
	Ccvs.mx = (Ctrl.mx - (Ctrl.ww - Ccvs.canvas.width) * 0.5 | 0);
	Ccvs.my = (Ctrl.my - (Ctrl.wh - Ccvs.canvas.height) * 0.5 | 0);
	if (Ccvs._tempmdn !== Ctrl.mdn) {
		Ccvs._tempmdn = Ctrl.mdn;
		Ccvs.mdn = Ccvs._tempmdn && 0 < Ccvs.mx && Ccvs.mx < Ccvs.canvas.width && 0 < Ccvs.my && Ccvs.my < Ccvs.canvas.height;
	}
	if (Ccvs.mdn && Ctrl.mmv) {
		x0 = Ccvs._tempmx - Ccvs.canvas.width * 0.5;
		y0 = Ccvs._tempmy - Ccvs.canvas.height * 0.5;
		r0 = Math.sqrt(x0 * x0 + y0 * y0);
		x1 = Ccvs.mx - Ccvs.canvas.width * 0.5;
		y1 = Ccvs.my - Ccvs.canvas.height * 0.5;
		r1 = Math.sqrt(x1 * x1 + y1 * y1);
		if (r0 > 20 && r1 > 20) {
			cos = (x0 * x1 + y0 * y1) / (r0 * r1);
			if (cos > 1) {
				cos = 1;
			} else {
				if (cos < - 1) {
					cos = - 1;
				}
			}
			Ccvs.rotv += Math.acos(cos) * (x0 * y1 - y0 * x1 > 0 ? 1 : - 1);
			Ccvs.sinv = Math.sin(Ccvs.rotv);
			Ccvs.cosv = Math.cos(Ccvs.rotv);
		}
	}
	Ccvs._tempmx = Ccvs.mx;
	Ccvs._tempmy = Ccvs.my;
	Ccvs.cx0 += (Ccvs.cx1 - Ccvs.cx0) * 0.3;
	Ccvs.cy0 += (Ccvs.cy1 - Ccvs.cy0) * 0.3;
	drh = Ccvs.roth - Math.PI / 180 * 30;
	if ((drh >= 0 ? drh : - drh) > 0.01) {
		Ccvs.roth -= drh * 0.1;
		Ccvs.sinh = Math.sin(Ccvs.roth);
		Ccvs.cosh = Math.cos(Ccvs.roth);
	}
	scale = 1.5;
	Ccvs.scale += (scale - Ccvs.scale) * 0.1;
};

Ccvs.calc$ = Ccvs$calc$;

function dom() {
};

$__jsx_extend([dom], Object);
function dom$id$S(id) {
	return (function ($v) {
		if (! ($v == null || $v instanceof HTMLElement)) {
			debugger;
			throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/js/web.jsx:29:47] detected invalid cast, value is not an instance of the designated type or null\n        return dom.document.getElementById(id) as HTMLElement;\n                                               ^^\n");
		}
		return $v;
	}(dom.document.getElementById(id)));
};

dom.id$S = dom$id$S;

function dom$getElementById$S(id) {
	return (function ($v) {
		if (! ($v == null || $v instanceof HTMLElement)) {
			debugger;
			throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/js/web.jsx:37:47] detected invalid cast, value is not an instance of the designated type or null\n        return dom.document.getElementById(id) as HTMLElement;\n                                               ^^\n");
		}
		return $v;
	}(dom.document.getElementById(id)));
};

dom.getElementById$S = dom$getElementById$S;

function dom$createElement$S(tag) {
	return (function ($v) {
		if (! ($v == null || $v instanceof HTMLElement)) {
			debugger;
			throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/js/web.jsx:45:47] detected invalid cast, value is not an instance of the designated type or null\n        return dom.document.createElement(tag) as __noconvert__ HTMLElement;\n                                               ^^\n");
		}
		return $v;
	}(dom.document.createElement(tag)));
};

dom.createElement$S = dom$createElement$S;

function EventInit() {
	this.bubbles = false;
	this.cancelable = false;
};

$__jsx_extend([EventInit], Object);
function CustomEventInit() {
	EventInit.call(this);
	this.detail = null;
};

$__jsx_extend([CustomEventInit], EventInit);
function MutationObserverInit() {
	this.childList = false;
	this.attributes = false;
	this.characterData = false;
	this.subtree = false;
	this.attributeOldValue = false;
	this.characterDataOldValue = false;
	this.attributeFilter = null;
};

$__jsx_extend([MutationObserverInit], Object);
function UIEventInit() {
	EventInit.call(this);
	this.view = null;
	this.detail = 0;
};

$__jsx_extend([UIEventInit], EventInit);
function FocusEventInit() {
	this.bubbles = false;
	this.cancelable = false;
	this.view = null;
	this.detail = 0;
	this.relatedTarget = null;
};

$__jsx_extend([FocusEventInit], Object);
function MouseEventInit() {
	UIEventInit.call(this);
	this.screenX = 0;
	this.screenY = 0;
	this.clientX = 0;
	this.clientY = 0;
	this.ctrlKey = false;
	this.shiftKey = false;
	this.altKey = false;
	this.metaKey = false;
	this.button = 0;
	this.buttons = 0;
	this.relatedTarget = null;
	this.region = null;
};

$__jsx_extend([MouseEventInit], UIEventInit);
function WheelEventInit() {
	this.bubbles = false;
	this.cancelable = false;
	this.view = null;
	this.detail = 0;
	this.screenX = 0;
	this.screenY = 0;
	this.clientX = 0;
	this.clientY = 0;
	this.ctrlKey = false;
	this.shiftKey = false;
	this.altKey = false;
	this.metaKey = false;
	this.button = 0;
	this.buttons = 0;
	this.relatedTarget = null;
	this.deltaX = 0;
	this.deltaY = 0;
	this.deltaZ = 0;
	this.deltaMode = 0;
};

$__jsx_extend([WheelEventInit], Object);
function KeyboardEventInit() {
	this.bubbles = false;
	this.cancelable = false;
	this.view = null;
	this.detail = 0;
	this.char = "";
	this.key = "";
	this.location = 0;
	this.ctrlKey = false;
	this.shiftKey = false;
	this.altKey = false;
	this.metaKey = false;
	this.repeat = false;
	this.locale = "";
	this.charCode = 0;
	this.keyCode = 0;
	this.which = 0;
};

$__jsx_extend([KeyboardEventInit], Object);
function CompositionEventInit() {
	this.bubbles = false;
	this.cancelable = false;
	this.view = null;
	this.detail = 0;
	this.data = null;
	this.locale = "";
};

$__jsx_extend([CompositionEventInit], Object);
function ProgressEventInit() {
	EventInit.call(this);
	this.lengthComputable = false;
	this.loaded = 0;
	this.total = 0;
};

$__jsx_extend([ProgressEventInit], EventInit);
function XMLHttpRequestOptions() {
	this.anon = false;
};

$__jsx_extend([XMLHttpRequestOptions], Object);
function TrackEventInit() {
	EventInit.call(this);
	this.track = null;
};

$__jsx_extend([TrackEventInit], EventInit);
function PopStateEventInit() {
	EventInit.call(this);
	this.state = null;
};

$__jsx_extend([PopStateEventInit], EventInit);
function HashChangeEventInit() {
	EventInit.call(this);
	this.oldURL = "";
	this.newURL = "";
};

$__jsx_extend([HashChangeEventInit], EventInit);
function PageTransitionEventInit() {
	EventInit.call(this);
	this.persisted = false;
};

$__jsx_extend([PageTransitionEventInit], EventInit);
function DragEventInit() {
	EventInit.call(this);
	this.view = null;
	this.detail = 0;
	this.screenX = 0;
	this.screenY = 0;
	this.clientX = 0;
	this.clientY = 0;
	this.ctrlKey = false;
	this.shiftKey = false;
	this.altKey = false;
	this.metaKey = false;
	this.button = 0;
	this.buttons = 0;
	this.relatedTarget = null;
	this.dataTransfer = null;
};

$__jsx_extend([DragEventInit], EventInit);
function CloseEventInit() {
	EventInit.call(this);
	this.wasClean = false;
	this.code = 0;
	this.reason = "";
};

$__jsx_extend([CloseEventInit], EventInit);
function StorageEventInit() {
	EventInit.call(this);
	this.key = null;
	this.oldValue = null;
	this.newValue = null;
	this.url = "";
	this.storageArea = null;
};

$__jsx_extend([StorageEventInit], EventInit);
function MessageEventInit() {
	EventInit.call(this);
	this.data = null;
	this.origin = "";
	this.lastEventId = "";
	this.source = null;
	this.ports = null;
};

$__jsx_extend([MessageEventInit], EventInit);
function ErrorEventInit() {
	EventInit.call(this);
	this.message = "";
	this.filename = "";
	this.lineno = 0;
};

$__jsx_extend([ErrorEventInit], EventInit);
function EventSourceInit() {
	this.withCredentials = false;
};

$__jsx_extend([EventSourceInit], Object);
function IDBObjectStoreParameters() {
	this.keyPath = null;
	this.autoIncrement = false;
};

$__jsx_extend([IDBObjectStoreParameters], Object);
function IDBIndexParameters() {
	this.unique = false;
	this.multiEntry = false;
};

$__jsx_extend([IDBIndexParameters], Object);
function IDBVersionChangeEventInit() {
	EventInit.call(this);
	this.oldVersion = 0;
	this.newVersion = null;
};

$__jsx_extend([IDBVersionChangeEventInit], EventInit);
function NotificationOptions() {
	this.titleDir = "";
	this.body = "";
	this.bodyDir = "";
	this.tag = "";
	this.iconUrl = "";
};

$__jsx_extend([NotificationOptions], Object);
function RTCSessionDescriptionInit() {
	this.type = "";
	this.sdp = "";
};

$__jsx_extend([RTCSessionDescriptionInit], Object);
function RTCIceCandidateInit() {
	this.candidate = "";
	this.sdpMid = "";
	this.sdpMLineIndex = 0;
};

$__jsx_extend([RTCIceCandidateInit], Object);
function RTCIceServer() {
	this.url = "";
	this.credential = null;
};

$__jsx_extend([RTCIceServer], Object);
function RTCConfiguration() {
	this.iceServers = null;
};

$__jsx_extend([RTCConfiguration], Object);
function DataChannelInit() {
	this.reliable = false;
};

$__jsx_extend([DataChannelInit], Object);
function RTCPeerConnectionIceEventInit() {
	EventInit.call(this);
	this.candidate = null;
};

$__jsx_extend([RTCPeerConnectionIceEventInit], EventInit);
function MediaStreamEventInit() {
	EventInit.call(this);
	this.stream = null;
};

$__jsx_extend([MediaStreamEventInit], EventInit);
function DataChannelEventInit() {
	EventInit.call(this);
	this.channel = null;
};

$__jsx_extend([DataChannelEventInit], EventInit);
function MediaStreamConstraints() {
	this.video = null;
	this.audio = null;
};

$__jsx_extend([MediaStreamConstraints], Object);
function MediaTrackConstraints() {
	this.mandatory = null;
	this.optional = null;
};

$__jsx_extend([MediaTrackConstraints], Object);
function HitRegionOptions() {
	this.path = null;
	this.id = "";
	this.parentID = null;
	this.cursor = "";
	this.control = null;
	this.label = null;
	this.role = null;
};

$__jsx_extend([HitRegionOptions], Object);
function WebGLContextAttributes() {
	this.alpha = false;
	this.depth = false;
	this.stencil = false;
	this.antialias = false;
	this.premultipliedAlpha = false;
	this.preserveDrawingBuffer = false;
};

$__jsx_extend([WebGLContextAttributes], Object);
function WebGLContextEventInit() {
	EventInit.call(this);
	this.statusMessage = "";
};

$__jsx_extend([WebGLContextEventInit], EventInit);
function DeviceOrientationEventInit() {
	EventInit.call(this);
	this.alpha = null;
	this.beta = null;
	this.gamma = null;
	this.absolute = false;
};

$__jsx_extend([DeviceOrientationEventInit], EventInit);
function DeviceMotionEventInit() {
	EventInit.call(this);
	this.acceleration = null;
	this.accelerationIncludingGravity = null;
	this.rotationRate = null;
	this.interval = null;
};

$__jsx_extend([DeviceMotionEventInit], EventInit);
function Timer() {
};

$__jsx_extend([Timer], Object);
function Timer$setTimeout$F$V$N(callback, intervalMS) {
	return (function ($v) {
		if (! ($v == null || typeof $v === "function")) {
			debugger;
			throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:34:40] detected invalid cast, value is not a function or null\n        return (js.global[\"setTimeout\"] as __noconvert__ function(:function():void,:number) : TimerHandle)(callback, intervalMS);\n                                        ^^\n");
		}
		return $v;
	}(js.global.setTimeout))(callback, intervalMS);
};

Timer.setTimeout$F$V$N = Timer$setTimeout$F$V$N;

function Timer$clearTimeout$LTimerHandle$(timer) {
	(function ($v) {
		if (! ($v == null || typeof $v === "function")) {
			debugger;
			throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:38:35] detected invalid cast, value is not a function or null\n        (js.global[\"clearTimeout\"] as __noconvert__ function(:TimerHandle) : void)(timer);\n                                   ^^\n");
		}
		return $v;
	}(js.global.clearTimeout))(timer);
};

Timer.clearTimeout$LTimerHandle$ = Timer$clearTimeout$LTimerHandle$;

function Timer$setInterval$F$V$N(callback, intervalMS) {
	return (function ($v) {
		if (! ($v == null || typeof $v === "function")) {
			debugger;
			throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:42:41] detected invalid cast, value is not a function or null\n        return (js.global[\"setInterval\"] as __noconvert__ function(:function():void,:number) : TimerHandle)(callback, intervalMS);\n                                         ^^\n");
		}
		return $v;
	}(js.global.setInterval))(callback, intervalMS);
};

Timer.setInterval$F$V$N = Timer$setInterval$F$V$N;

function Timer$clearInterval$LTimerHandle$(timer) {
	(function ($v) {
		if (! ($v == null || typeof $v === "function")) {
			debugger;
			throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:46:36] detected invalid cast, value is not a function or null\n        (js.global[\"clearInterval\"] as __noconvert__ function(:TimerHandle) : void)(timer);\n                                    ^^\n");
		}
		return $v;
	}(js.global.clearInterval))(timer);
};

Timer.clearInterval$LTimerHandle$ = Timer$clearInterval$LTimerHandle$;

function Timer$requestAnimationFrame$F$NV$(callback) {
	return Timer._requestAnimationFrame(callback);
};

Timer.requestAnimationFrame$F$NV$ = Timer$requestAnimationFrame$F$NV$;

function Timer$cancelAnimationFrame$LTimerHandle$(timer) {
	Timer._cancelAnimationFrame(timer);
};

Timer.cancelAnimationFrame$LTimerHandle$ = Timer$cancelAnimationFrame$LTimerHandle$;

function Timer$useNativeRAF$B(enable) {
	Timer._requestAnimationFrame = Timer$_getRequestAnimationFrameImpl$B(enable);
	Timer._cancelAnimationFrame = Timer$_getCancelAnimationFrameImpl$B(enable);
};

Timer.useNativeRAF$B = Timer$useNativeRAF$B;

function Timer$_getRequestAnimationFrameImpl$B(useNativeImpl) {
	var lastTime;
	if (useNativeImpl) {
		if (js.global.requestAnimationFrame) {
			return (function (callback) {
				return (function ($v) {
					if (! ($v == null || typeof $v === "function")) {
						debugger;
						throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:72:63] detected invalid cast, value is not a function or null\n                    return (js.global[\"requestAnimationFrame\"] as __noconvert__\n                                                               ^^\n");
					}
					return $v;
				}(js.global.requestAnimationFrame))(callback);
			});
		} else {
			if (js.global.webkitRequestAnimationFrame) {
				return (function (callback) {
					return (function ($v) {
						if (! ($v == null || typeof $v === "function")) {
							debugger;
							throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:78:69] detected invalid cast, value is not a function or null\n                    return (js.global[\"webkitRequestAnimationFrame\"] as __noconvert__\n                                                                     ^^\n");
						}
						return $v;
					}(js.global.webkitRequestAnimationFrame))(callback);
				});
			} else {
				if (js.global.mozRequestAnimationFrame) {
					return (function (callback) {
						return (function ($v) {
							if (! ($v == null || typeof $v === "function")) {
								debugger;
								throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:84:66] detected invalid cast, value is not a function or null\n                    return (js.global[\"mozRequestAnimationFrame\"] as __noconvert__\n                                                                  ^^\n");
							}
							return $v;
						}(js.global.mozRequestAnimationFrame))(callback);
					});
				} else {
					if (js.global.oRequestAnimationFrame) {
						return (function (callback) {
							return (function ($v) {
								if (! ($v == null || typeof $v === "function")) {
									debugger;
									throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:90:64] detected invalid cast, value is not a function or null\n                    return (js.global[\"oRequestAnimationFrame\"] as __noconvert__\n                                                                ^^\n");
								}
								return $v;
							}(js.global.oRequestAnimationFrame))(callback);
						});
					} else {
						if (js.global.msRequestAnimationFrame) {
							return (function (callback) {
								return (function ($v) {
									if (! ($v == null || typeof $v === "function")) {
										debugger;
										throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:96:65] detected invalid cast, value is not a function or null\n                    return (js.global[\"msRequestAnimationFrame\"] as __noconvert__\n                                                                 ^^\n");
									}
									return $v;
								}(js.global.msRequestAnimationFrame))(callback);
							});
						}
					}
				}
			}
		}
	}
	lastTime = 0;
	return (function (callback) {
		var now;
		var timeToCall;
		now = Date.now();
		timeToCall = Math.max(0, 16 - (now - lastTime));
		lastTime = now + timeToCall;
		return Timer$setTimeout$F$V$N((function () {
			callback(now + timeToCall);
		}), timeToCall);
	});
};

Timer._getRequestAnimationFrameImpl$B = Timer$_getRequestAnimationFrameImpl$B;

function Timer$_getCancelAnimationFrameImpl$B(useNativeImpl) {
	if (useNativeImpl) {
		if (js.global.cancelAnimationFrame) {
			return (function (timer) {
				(function ($v) {
					if (! ($v == null || typeof $v === "function")) {
						debugger;
						throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:119:55] detected invalid cast, value is not a function or null\n                    (js.global[\"cancelAnimationFrame\"] as __noconvert__\n                                                       ^^\n");
					}
					return $v;
				}(js.global.cancelAnimationFrame))(timer);
			});
		} else {
			if (js.global.webkitCancelAnimationFrame) {
				return (function (timer) {
					(function ($v) {
						if (! ($v == null || typeof $v === "function")) {
							debugger;
							throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:125:61] detected invalid cast, value is not a function or null\n                    (js.global[\"webkitCancelAnimationFrame\"] as __noconvert__\n                                                             ^^\n");
						}
						return $v;
					}(js.global.webkitCancelAnimationFrame))(timer);
				});
			} else {
				if (js.global.mozCancelAnimationFrame) {
					return (function (timer) {
						(function ($v) {
							if (! ($v == null || typeof $v === "function")) {
								debugger;
								throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:131:58] detected invalid cast, value is not a function or null\n                    (js.global[\"mozCancelAnimationFrame\"] as __noconvert__\n                                                          ^^\n");
							}
							return $v;
						}(js.global.mozCancelAnimationFrame))(timer);
					});
				} else {
					if (js.global.oCancelAnimationFrame) {
						return (function (timer) {
							(function ($v) {
								if (! ($v == null || typeof $v === "function")) {
									debugger;
									throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:137:56] detected invalid cast, value is not a function or null\n                    (js.global[\"oCancelAnimationFrame\"] as __noconvert__\n                                                        ^^\n");
								}
								return $v;
							}(js.global.oCancelAnimationFrame))(timer);
						});
					} else {
						if (js.global.msCancelAnimationFrame) {
							return (function (timer) {
								(function ($v) {
									if (! ($v == null || typeof $v === "function")) {
										debugger;
										throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/timer.jsx:143:57] detected invalid cast, value is not a function or null\n                    (js.global[\"msCancelAnimationFrame\"] as __noconvert__\n                                                         ^^\n");
									}
									return $v;
								}(js.global.msCancelAnimationFrame))(timer);
							});
						}
					}
				}
			}
		}
	}
	return Timer$clearTimeout$LTimerHandle$;
};

Timer._getCancelAnimationFrameImpl$B = Timer$_getCancelAnimationFrameImpl$B;

function TimerHandle() {
};

$__jsx_extend([TimerHandle], Object);
$__jsx_lazy_init(_Main, "imgs", function () {
	return ({  });
});
Game.field = null;
Game.player = null;
Game.enemy = null;
Game.clist = null;
Game.slist = null;
DrawCharacter.canvas = null;
DrawCharacter.context = null;
DrawCharacter.minx = 0;
DrawCharacter.miny = 0;
DrawCharacter.maxx = 0;
DrawCharacter.maxy = 0;
DrawShadow.canvas = null;
Ctrl.div = null;
Ctrl.isTouch = false;
Ctrl.mdn = false;
Ctrl.mmv = false;
Ctrl.mx = 0;
Ctrl.my = 0;
Ctrl.ww = 0;
Ctrl.wh = 0;
Ctrl._mode = 0;
Ctrl._tempmx = 0;
Ctrl._tempmy = 0;
Cbtn.kup = false;
Cbtn.kdn = false;
Cbtn.krt = false;
Cbtn.klt = false;
Cbtn.k_z = false;
Cbtn.k_x = false;
Cbtn.k_c = false;
Cbtn.k_s = false;
Cbtn.trigger_z = false;
Cbtn.trigger_x = false;
Cbtn.trigger_c = false;
Cbtn.trigger_s = false;
Cbtn._arrowDiv = null;
Cbtn._buttonDiv = null;
Cbtn._upDiv = null;
Cbtn._dnDiv = null;
Cbtn._rtDiv = null;
Cbtn._ltDiv = null;
Cbtn._zbDiv = null;
Cbtn._xbDiv = null;
Cbtn._cbDiv = null;
Cbtn._sbDiv = null;
Cbtn._bkup = false;
Cbtn._bkdn = false;
Cbtn._bkrt = false;
Cbtn._bklt = false;
Cbtn._bk_z = false;
Cbtn._bk_x = false;
Cbtn._bk_c = false;
Cbtn._bk_s = false;
Cbtn._kkup = false;
Cbtn._kkdn = false;
Cbtn._kkrt = false;
Cbtn._kklt = false;
Cbtn._kk_z = false;
Cbtn._kk_x = false;
Cbtn._kk_c = false;
Cbtn._kk_s = false;
Ccvs.canvas = null;
Ccvs.context = null;
Ccvs.mdn = false;
Ccvs.mx = 0;
Ccvs.my = 0;
Ccvs.cx0 = 0;
Ccvs.cy0 = 0;
Ccvs.cx1 = 0;
Ccvs.cy1 = 0;
Ccvs.cxmax = 0;
Ccvs.cymax = 0;
Ccvs.cxmin = 0;
Ccvs.cymin = 0;
Ccvs.scale = 0;
Ccvs.rotv = 0;
Ccvs.roth = 0;
Ccvs.sinv = 0;
Ccvs.cosv = 0;
Ccvs.sinh = 0;
Ccvs.cosh = 0;
Ccvs.color = "";
Ccvs._tempmdn = false;
Ccvs._tempmx = 0;
Ccvs._tempmy = 0;
var js = { global: function () { return this; }() };
$__jsx_lazy_init(dom, "window", function () {
	return js.global.window;
});
$__jsx_lazy_init(dom, "document", function () {
	return (function ($v) {
		if (! ($v == null || $v instanceof HTMLDocument)) {
			debugger;
			throw new Error("[/usr/local/lib/node_modules/jsx/lib/js/js/web.jsx:23:50] detected invalid cast, value is not an instance of the designated type or null\n    static const document = js.global[\"document\"] as __noconvert__ HTMLDocument;\n                                                  ^^\n");
		}
		return $v;
	}(js.global.document));
});
$__jsx_lazy_init(Timer, "_requestAnimationFrame", function () {
	return Timer$_getRequestAnimationFrameImpl$B(true);
});
$__jsx_lazy_init(Timer, "_cancelAnimationFrame", function () {
	return Timer$_getCancelAnimationFrameImpl$B(true);
});

var $__jsx_classMap = {
	"system:lib/built-in.jsx": {
		g_StopIteration: g_StopIteration,
		g_StopIteration$: g_StopIteration
	},
	"/tmp/wgSM3b81rn.jsx": {
		_Main: _Main,
		_Main$: _Main,
		Game: Game,
		Game$: Game,
		Field: Field,
		Field$: Field,
		GameCharacter: GameCharacter,
		GameCharacter$SNNN: GameCharacter,
		GamePlayer: GamePlayer,
		GamePlayer$SNNN: GamePlayer,
		DrawUnit: DrawUnit,
		DrawUnit$: DrawUnit,
		DrawEffect: DrawEffect,
		DrawEffect$NNNN: DrawEffect,
		DrawCharacter: DrawCharacter,
		DrawCharacter$LHTMLImageElement$NHAANHAHAN: DrawCharacter,
		DrawCharacterParts: DrawCharacterParts,
		DrawCharacterParts$LDrawCharacter$NNNIIIB: DrawCharacterParts,
		DrawShadow: DrawShadow,
		DrawShadow$N: DrawShadow,
		Ctrl: Ctrl,
		Ctrl$: Ctrl,
		Cbtn: Cbtn,
		Cbtn$: Cbtn,
		Ccvs: Ccvs,
		Ccvs$: Ccvs
	},
	"system:lib/js/js/web.jsx": {
		dom: dom,
		dom$: dom,
		EventInit: EventInit,
		EventInit$: EventInit,
		CustomEventInit: CustomEventInit,
		CustomEventInit$: CustomEventInit,
		MutationObserverInit: MutationObserverInit,
		MutationObserverInit$: MutationObserverInit,
		UIEventInit: UIEventInit,
		UIEventInit$: UIEventInit,
		FocusEventInit: FocusEventInit,
		FocusEventInit$: FocusEventInit,
		MouseEventInit: MouseEventInit,
		MouseEventInit$: MouseEventInit,
		WheelEventInit: WheelEventInit,
		WheelEventInit$: WheelEventInit,
		KeyboardEventInit: KeyboardEventInit,
		KeyboardEventInit$: KeyboardEventInit,
		CompositionEventInit: CompositionEventInit,
		CompositionEventInit$: CompositionEventInit,
		ProgressEventInit: ProgressEventInit,
		ProgressEventInit$: ProgressEventInit,
		XMLHttpRequestOptions: XMLHttpRequestOptions,
		XMLHttpRequestOptions$: XMLHttpRequestOptions,
		TrackEventInit: TrackEventInit,
		TrackEventInit$: TrackEventInit,
		PopStateEventInit: PopStateEventInit,
		PopStateEventInit$: PopStateEventInit,
		HashChangeEventInit: HashChangeEventInit,
		HashChangeEventInit$: HashChangeEventInit,
		PageTransitionEventInit: PageTransitionEventInit,
		PageTransitionEventInit$: PageTransitionEventInit,
		DragEventInit: DragEventInit,
		DragEventInit$: DragEventInit,
		CloseEventInit: CloseEventInit,
		CloseEventInit$: CloseEventInit,
		StorageEventInit: StorageEventInit,
		StorageEventInit$: StorageEventInit,
		MessageEventInit: MessageEventInit,
		MessageEventInit$: MessageEventInit,
		ErrorEventInit: ErrorEventInit,
		ErrorEventInit$: ErrorEventInit,
		EventSourceInit: EventSourceInit,
		EventSourceInit$: EventSourceInit,
		IDBObjectStoreParameters: IDBObjectStoreParameters,
		IDBObjectStoreParameters$: IDBObjectStoreParameters,
		IDBIndexParameters: IDBIndexParameters,
		IDBIndexParameters$: IDBIndexParameters,
		IDBVersionChangeEventInit: IDBVersionChangeEventInit,
		IDBVersionChangeEventInit$: IDBVersionChangeEventInit,
		NotificationOptions: NotificationOptions,
		NotificationOptions$: NotificationOptions,
		RTCSessionDescriptionInit: RTCSessionDescriptionInit,
		RTCSessionDescriptionInit$: RTCSessionDescriptionInit,
		RTCIceCandidateInit: RTCIceCandidateInit,
		RTCIceCandidateInit$: RTCIceCandidateInit,
		RTCIceServer: RTCIceServer,
		RTCIceServer$: RTCIceServer,
		RTCConfiguration: RTCConfiguration,
		RTCConfiguration$: RTCConfiguration,
		DataChannelInit: DataChannelInit,
		DataChannelInit$: DataChannelInit,
		RTCPeerConnectionIceEventInit: RTCPeerConnectionIceEventInit,
		RTCPeerConnectionIceEventInit$: RTCPeerConnectionIceEventInit,
		MediaStreamEventInit: MediaStreamEventInit,
		MediaStreamEventInit$: MediaStreamEventInit,
		DataChannelEventInit: DataChannelEventInit,
		DataChannelEventInit$: DataChannelEventInit,
		MediaStreamConstraints: MediaStreamConstraints,
		MediaStreamConstraints$: MediaStreamConstraints,
		MediaTrackConstraints: MediaTrackConstraints,
		MediaTrackConstraints$: MediaTrackConstraints,
		HitRegionOptions: HitRegionOptions,
		HitRegionOptions$: HitRegionOptions,
		WebGLContextAttributes: WebGLContextAttributes,
		WebGLContextAttributes$: WebGLContextAttributes,
		WebGLContextEventInit: WebGLContextEventInit,
		WebGLContextEventInit$: WebGLContextEventInit,
		DeviceOrientationEventInit: DeviceOrientationEventInit,
		DeviceOrientationEventInit$: DeviceOrientationEventInit,
		DeviceMotionEventInit: DeviceMotionEventInit,
		DeviceMotionEventInit$: DeviceMotionEventInit
	},
	"system:lib/js/timer.jsx": {
		Timer: Timer,
		Timer$: Timer,
		TimerHandle: TimerHandle,
		TimerHandle$: TimerHandle
	}
};


/**
 * launches _Main.main(:string[]):void invoked by jsx --run|--executable
 */
JSX.runMain = function (sourceFile, args) {
	var module = JSX.require(sourceFile);
	if (! module) {
		throw new ReferenceError("entry point module not found in " + sourceFile);
	}
	if (! module._Main) {
		throw new ReferenceError("entry point _Main not found in " + sourceFile);
	}
	if (! module._Main.main) {
		throw new ReferenceError("entry point _Main.main(:string[]):void not found in " + sourceFile);
	}
	module._Main.main(args);
};

/**
 * launches _Test#test*():void invoked by jsx --test
 */
JSX.runTests = function (sourceFile, tests) {
	var module = JSX.require(sourceFile);
	var testClass = module._Test;

	if (!testClass) return; // skip if there's no test class

	if(tests.length === 0) {
		var p = testClass.prototype;
		for (var m in p) {
			if (p[m] instanceof Function && m.match(/^test\w*$/)) {
				tests.push(m);
			}
		}
	}

	var testCase = new testClass();

	if (testCase.beforeClass != null)
		testCase.beforeClass(tests);

	for (var i = 0; i < tests.length; ++i) {
		(function (method) {
			if (method in testCase) {
				testCase.run(method, function() { testCase[method](); });
			}
			else {
				throw new ReferenceError("No such test method: " + method);
			}
		}(tests[i]));
	}

	if (testCase.afterClass != null)
		testCase.afterClass();
};
/**
 * call a function on load/DOMContentLoaded
 */
function $__jsx_onload (event) {
	window.removeEventListener("load", $__jsx_onload);
	document.removeEventListener("DOMContentLoaded", $__jsx_onload);
	JSX.runMain("/tmp/wgSM3b81rn.jsx", []);
}

window.addEventListener("load", $__jsx_onload);
document.addEventListener("DOMContentLoaded", $__jsx_onload);

})(JSX);
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer