+ Start of iCE color support... ish.
* Initial NU-MAYA theme matrix
This commit is contained in:
parent
f2388ceed1
commit
7bac1b5193
|
@ -51,6 +51,9 @@ var CONTROL = {
|
|||
goto : 'H', // row Pr, column Pc -- same as f
|
||||
gotoAlt : 'f', // same as H
|
||||
|
||||
blinkToBrightIntensity : '33h',
|
||||
blinkNormal : '33l',
|
||||
|
||||
emulationSpeed : '*r' // Set output emulation speed. See cterm.txt
|
||||
};
|
||||
|
||||
|
|
13
core/art.js
13
core/art.js
|
@ -173,6 +173,9 @@ function parseCharacterSAUCE(sauce) {
|
|||
result.fileType = SAUCE_CHARACTER_FILE_TYPES[sauce.fileType] || 'Unknown';
|
||||
|
||||
if(sauce.fileType === 0 || sauce.fileType === 1 || sauce.fileType === 2) {
|
||||
// convience: create ansiFlags
|
||||
sauce.ansiFlags = sauce.flags;
|
||||
|
||||
var i = 0;
|
||||
while(i < sauce.tinfos.length && sauce.tinfos[i] !== 0x00) {
|
||||
++i;
|
||||
|
@ -384,6 +387,7 @@ function display(options, cb) {
|
|||
var pauseKeys = miscUtil.valueWithDefault(options.pauseKeys, []);
|
||||
var pauseAtTermHeight = miscUtil.valueWithDefault(options.pauseAtTermHeight, false);
|
||||
var mciReplaceChar = miscUtil.valueWithDefault(options.mciReplaceChar, ' ');
|
||||
var iceColors = miscUtil.valueWithDefault(options.iceColors, false);
|
||||
|
||||
// :TODO: support pause/cancel & pause @ termHeight
|
||||
var canceled = false;
|
||||
|
@ -414,6 +418,11 @@ function display(options, cb) {
|
|||
function completed() {
|
||||
options.client.removeListener('cursor position report', onCPR);
|
||||
parser.removeAllListeners(); // :TODO: Necessary???
|
||||
|
||||
if(iceColors) {
|
||||
options.client.term.write(ansi.blinkNormal());
|
||||
}
|
||||
|
||||
cb(null, mci);
|
||||
}
|
||||
|
||||
|
@ -460,5 +469,9 @@ function display(options, cb) {
|
|||
}
|
||||
});
|
||||
|
||||
if(iceColors) {
|
||||
options.client.term.write(ansi.blinkToBrightIntensity());
|
||||
}
|
||||
|
||||
parser.parse(options.art);
|
||||
}
|
|
@ -73,7 +73,7 @@ function initAvailableThemes(cb) {
|
|||
}
|
||||
|
||||
function getRandomTheme(cb) {
|
||||
if(availableThemes.length > 0) {
|
||||
if(Object.getOwnPropertyNames(availableThemes).length > 0) {
|
||||
var themeIds = Object.keys(availableThemes);
|
||||
cb(null, themeIds[Math.floor(Math.random() * themeIds.length)]);
|
||||
} else {
|
||||
|
@ -94,29 +94,37 @@ function getThemeArt(name, themeID, options, cb) {
|
|||
options.random = miscUtil.valueWithDefault(options.random, true);
|
||||
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) {
|
||||
// try fallback of art directory
|
||||
options.basePath = Config.paths.art;
|
||||
art.getArt(name, options, function onFallbackArt(err, theArt) {
|
||||
art.getArt(name, options, function onFallbackArt(err, artInfo) {
|
||||
if(err) {
|
||||
cb(err);
|
||||
} else {
|
||||
cb(null, theArt.data);
|
||||
cb(null, artInfo);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cb(null, theArt.data);
|
||||
cb(null, artInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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) {
|
||||
cb(err);
|
||||
} 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);
|
||||
});
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name" : "Nu Mayan",
|
||||
"author" : "NuSkooler"
|
||||
}
|
|
@ -24,7 +24,11 @@ exports.entryPoint = entryPoint;
|
|||
|
||||
function entryPoint(client) {
|
||||
|
||||
client.term.write(ansi.resetScreen());
|
||||
//client.term.write('\x1b[?33h');
|
||||
|
||||
theme.displayThemeArt('MATRIX', client, function onMatrix(err, mciMap) {
|
||||
console.log(mciMap);
|
||||
if(mciMap.ET1 && mciMap.ET2 && mciMap.BN1 && mciMap.BN2 && mciMap.BN3) {
|
||||
//
|
||||
// Form via EditTextViews and ButtonViews
|
||||
|
|
Loading…
Reference in New Issue