better track the resulting javascript too.
This commit is contained in:
parent
a06a65bb95
commit
d2092d9189
12 changed files with 1265 additions and 0 deletions
89
16col/tundra.js
Normal file
89
16col/tundra.js
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
// Generated by CoffeeScript 1.7.1
|
||||
(function() {
|
||||
var __hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
||||
|
||||
this.ImageTextModeTundra = (function(_super) {
|
||||
__extends(ImageTextModeTundra, _super);
|
||||
|
||||
function ImageTextModeTundra(options) {
|
||||
var k, v;
|
||||
ImageTextModeTundra.__super__.constructor.apply(this, arguments);
|
||||
for (k in options) {
|
||||
if (!__hasProp.call(options, k)) continue;
|
||||
v = options[k];
|
||||
this[k] = v;
|
||||
}
|
||||
}
|
||||
|
||||
ImageTextModeTundra.prototype.parse = function(content) {
|
||||
var bg, ch, colors, command, fg, palidx, rgb, x, y, _i;
|
||||
colors = [[0, 0, 0]];
|
||||
palidx = 1;
|
||||
x = 0;
|
||||
y = 0;
|
||||
fg = 0;
|
||||
bg = 0;
|
||||
this.screen[y] = [];
|
||||
content = content.substr(8).split('');
|
||||
while (command = content.shift()) {
|
||||
if (command === "\x1a") {
|
||||
break;
|
||||
}
|
||||
command = command.charCodeAt(0);
|
||||
if (command === 1) {
|
||||
y = this.unpackLong(content.splice(0, 4).join(''));
|
||||
x = this.unpackLong(content.splice(0, 4).join(''));
|
||||
if (this.screen[y] == null) {
|
||||
this.screen[y] = [];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
ch = null;
|
||||
if (command === 2) {
|
||||
ch = content.shift();
|
||||
rgb = this.unpackLong(content.splice(0, 4).join(''));
|
||||
fg = palidx++;
|
||||
colors.push([(rgb >> 16) & 0x000000ff, (rgb >> 8) & 0x000000ff, rgb & 0x000000ff]);
|
||||
} else if (command === 4) {
|
||||
ch = content.shift();
|
||||
rgb = this.unpackLong(content.splice(0, 4).join(''));
|
||||
bg = palidx++;
|
||||
colors.push([(rgb >> 16) & 0x000000ff, (rgb >> 8) & 0x000000ff, rgb & 0x000000ff]);
|
||||
} else if (command === 6) {
|
||||
ch = content.shift();
|
||||
fg = palidx++;
|
||||
bg = palidx++;
|
||||
for (_i = 0; _i <= 1; _i++) {
|
||||
rgb = this.unpackLong(content.splice(0, 4).join(''));
|
||||
colors.push([(rgb >> 16) & 0x000000ff, (rgb >> 8) & 0x000000ff, rgb & 0x000000ff]);
|
||||
}
|
||||
}
|
||||
if (ch == null) {
|
||||
ch = String.fromCharCode(command);
|
||||
}
|
||||
this.screen[y][x] = {
|
||||
'ch': ch,
|
||||
'fg': fg,
|
||||
'bg': bg
|
||||
};
|
||||
x++;
|
||||
if (x === 80) {
|
||||
x = 0;
|
||||
y++;
|
||||
this.screen[y] = [];
|
||||
}
|
||||
}
|
||||
if (this.screen[y].length === 0) {
|
||||
this.screen.pop();
|
||||
}
|
||||
return this.palette = new ImageTextModePalette({
|
||||
colors: colors
|
||||
});
|
||||
};
|
||||
|
||||
return ImageTextModeTundra;
|
||||
|
||||
})(this.ImageTextMode);
|
||||
|
||||
}).call(this);
|
||||
Loading…
Add table
Add a link
Reference in a new issue