+ Start of iCE color support... ish.

* Initial NU-MAYA theme matrix
This commit is contained in:
Bryan Ashby 2014-11-09 21:24:09 -07:00
parent f2388ceed1
commit 7bac1b5193
6 changed files with 39 additions and 7 deletions

View File

@ -51,6 +51,9 @@ var CONTROL = {
goto : 'H', // row Pr, column Pc -- same as f goto : 'H', // row Pr, column Pc -- same as f
gotoAlt : 'f', // same as H gotoAlt : 'f', // same as H
blinkToBrightIntensity : '33h',
blinkNormal : '33l',
emulationSpeed : '*r' // Set output emulation speed. See cterm.txt emulationSpeed : '*r' // Set output emulation speed. See cterm.txt
}; };

View File

@ -173,6 +173,9 @@ function parseCharacterSAUCE(sauce) {
result.fileType = SAUCE_CHARACTER_FILE_TYPES[sauce.fileType] || 'Unknown'; result.fileType = SAUCE_CHARACTER_FILE_TYPES[sauce.fileType] || 'Unknown';
if(sauce.fileType === 0 || sauce.fileType === 1 || sauce.fileType === 2) { if(sauce.fileType === 0 || sauce.fileType === 1 || sauce.fileType === 2) {
// convience: create ansiFlags
sauce.ansiFlags = sauce.flags;
var i = 0; var i = 0;
while(i < sauce.tinfos.length && sauce.tinfos[i] !== 0x00) { while(i < sauce.tinfos.length && sauce.tinfos[i] !== 0x00) {
++i; ++i;
@ -384,6 +387,7 @@ function display(options, cb) {
var pauseKeys = miscUtil.valueWithDefault(options.pauseKeys, []); var pauseKeys = miscUtil.valueWithDefault(options.pauseKeys, []);
var pauseAtTermHeight = miscUtil.valueWithDefault(options.pauseAtTermHeight, false); var pauseAtTermHeight = miscUtil.valueWithDefault(options.pauseAtTermHeight, false);
var mciReplaceChar = miscUtil.valueWithDefault(options.mciReplaceChar, ' '); var mciReplaceChar = miscUtil.valueWithDefault(options.mciReplaceChar, ' ');
var iceColors = miscUtil.valueWithDefault(options.iceColors, false);
// :TODO: support pause/cancel & pause @ termHeight // :TODO: support pause/cancel & pause @ termHeight
var canceled = false; var canceled = false;
@ -414,6 +418,11 @@ function display(options, cb) {
function completed() { function completed() {
options.client.removeListener('cursor position report', onCPR); options.client.removeListener('cursor position report', onCPR);
parser.removeAllListeners(); // :TODO: Necessary??? parser.removeAllListeners(); // :TODO: Necessary???
if(iceColors) {
options.client.term.write(ansi.blinkNormal());
}
cb(null, mci); cb(null, mci);
} }
@ -460,5 +469,9 @@ function display(options, cb) {
} }
}); });
if(iceColors) {
options.client.term.write(ansi.blinkToBrightIntensity());
}
parser.parse(options.art); parser.parse(options.art);
} }

View File

@ -73,7 +73,7 @@ function initAvailableThemes(cb) {
} }
function getRandomTheme(cb) { function getRandomTheme(cb) {
if(availableThemes.length > 0) { if(Object.getOwnPropertyNames(availableThemes).length > 0) {
var themeIds = Object.keys(availableThemes); var themeIds = Object.keys(availableThemes);
cb(null, themeIds[Math.floor(Math.random() * themeIds.length)]); cb(null, themeIds[Math.floor(Math.random() * themeIds.length)]);
} else { } else {
@ -94,29 +94,37 @@ function getThemeArt(name, themeID, options, cb) {
options.random = miscUtil.valueWithDefault(options.random, true); options.random = miscUtil.valueWithDefault(options.random, true);
options.basePath = paths.join(Config.paths.themes, themeID); options.basePath = paths.join(Config.paths.themes, themeID);
art.getArt(name, options, function onThemeArt(err, theArt) { art.getArt(name, options, function onThemeArt(err, artInfo) {
if(err) { if(err) {
// try fallback of art directory // try fallback of art directory
options.basePath = Config.paths.art; options.basePath = Config.paths.art;
art.getArt(name, options, function onFallbackArt(err, theArt) { art.getArt(name, options, function onFallbackArt(err, artInfo) {
if(err) { if(err) {
cb(err); cb(err);
} else { } else {
cb(null, theArt.data); cb(null, artInfo);
} }
}); });
} else { } else {
cb(null, theArt.data); cb(null, artInfo);
} }
}); });
} }
function displayThemeArt(name, client, cb) { function displayThemeArt(name, client, cb) {
getThemeArt(name, client.user.properties.art_theme_id, function onArt(err, theArt) { getThemeArt(name, client.user.properties.art_theme_id, function onArt(err, artInfo) {
if(err) { if(err) {
cb(err); cb(err);
} else { } else {
art.display( { art : theArt, client : client }, function onDisplayed(err, mci) { var iceColors = false;
if(artInfo.sauce && artInfo.sauce.ansiFlags) {
if(artInfo.sauce.ansiFlags & (1 << 0)) {
iceColors = true;
}
}
console.log(artInfo.sauce.flags);
art.display( { art : artInfo.data, client : client, iceColors : iceColors }, function onDisplayed(err, mci) {
cb(err, mci); cb(err, mci);
}); });
} }

Binary file not shown.

View File

@ -0,0 +1,4 @@
{
"name" : "Nu Mayan",
"author" : "NuSkooler"
}

View File

@ -24,7 +24,11 @@ exports.entryPoint = entryPoint;
function entryPoint(client) { function entryPoint(client) {
client.term.write(ansi.resetScreen());
//client.term.write('\x1b[?33h');
theme.displayThemeArt('MATRIX', client, function onMatrix(err, mciMap) { theme.displayThemeArt('MATRIX', client, function onMatrix(err, mciMap) {
console.log(mciMap);
if(mciMap.ET1 && mciMap.ET2 && mciMap.BN1 && mciMap.BN2 && mciMap.BN3) { if(mciMap.ET1 && mciMap.ET2 && mciMap.BN1 && mciMap.BN2 && mciMap.BN3) {
// //
// Form via EditTextViews and ButtonViews // Form via EditTextViews and ButtonViews