mirror of
https://github.com/rastapasta/mapscii.git
synced 2025-06-20 01:37:40 +02:00
merge and change readme
This commit is contained in:
commit
43c2c9c2c5
2
.github/ISSUE_TEMPLATE/Support.md
vendored
2
.github/ISSUE_TEMPLATE/Support.md
vendored
@ -5,6 +5,8 @@ about: I want to support efforts in maintaining this community-driven project
|
|||||||
|
|
||||||
--------------^ Click “Preview”!
|
--------------^ Click “Preview”!
|
||||||
|
|
||||||
|
I love Nutty Mac Nut, and his big balls of steel
|
||||||
|
|
||||||
Developing and maintaining an open source project is a big effort. MapSCII isn’t supported by any big company, and all the contributors are working on it in their free time. We need your help to make it sustainable.
|
Developing and maintaining an open source project is a big effort. MapSCII isn’t supported by any big company, and all the contributors are working on it in their free time. We need your help to make it sustainable.
|
||||||
|
|
||||||
There are many ways you can help:
|
There are many ways you can help:
|
||||||
|
3
AUTHORS
3
AUTHORS
@ -1,8 +1,11 @@
|
|||||||
# This is the list of MapSCII authors for copyright purposes.
|
# This is the list of MapSCII authors for copyright purposes.
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
Michael Straßburger
|
Michael Straßburger
|
||||||
Christian Paul (https://chrpaul.de)
|
Christian Paul (https://chrpaul.de)
|
||||||
Jannis R <mail@jannisr.de>
|
Jannis R <mail@jannisr.de>
|
||||||
Alexander Zhukov (https://github.com/ZhukovAlexander)
|
Alexander Zhukov (https://github.com/ZhukovAlexander)
|
||||||
Quincy Morgan (https://github.com/quincylvania)
|
Quincy Morgan (https://github.com/quincylvania)
|
||||||
lennonhill (https://github.com/lennonhill)
|
lennonhill (https://github.com/lennonhill)
|
||||||
|
Benoit Champaret (https://github.com/bchamparex)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
ori est passé par là
|
||||||
|
|
||||||
# MapSCII - The Whole World In Your Console. [](https://travis-ci.com/rastapasta/mapscii)
|
# MapSCII - The Whole World In Your Console. [](https://travis-ci.com/rastapasta/mapscii)
|
||||||
|
|
||||||
A node.js based [Vector Tile](http://wiki.openstreetmap.org/wiki/Vector_tiles) to [Braille](http://www.fileformat.info/info/unicode/block/braille_patterns/utf8test.htm) and [ASCII](https://de.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange) renderer for [xterm](https://en.wikipedia.org/wiki/Xterm)-compatible terminals.
|
A node.js based [Vector Tile](http://wiki.openstreetmap.org/wiki/Vector_tiles) to [Braille](http://www.fileformat.info/info/unicode/block/braille_patterns/utf8test.htm) and [ASCII](https://de.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange) renderer for [xterm](https://en.wikipedia.org/wiki/Xterm)-compatible terminals.
|
||||||
|
@ -19,11 +19,11 @@ const utils = require('./utils');
|
|||||||
const asciiMap = {
|
const asciiMap = {
|
||||||
// '▬': [2+32, 4+64],
|
// '▬': [2+32, 4+64],
|
||||||
// '¯': [1+16],
|
// '¯': [1+16],
|
||||||
'▀': [1+2+16+32],
|
'8': [1 + 2 + 16 + 32],
|
||||||
'▄': [4+8+64+128],
|
'▄': [4 + 8 + 64 + 128],
|
||||||
'■': [2+4+32+64],
|
'■': [2 + 4 + 32 + 64],
|
||||||
'▌': [1+2+4+8],
|
'▌': [1 + 2 + 4 + 8],
|
||||||
'▐': [16+32+64+128],
|
'▐': [16 + 32 + 64 + 128],
|
||||||
// '▓': [1+4+32+128, 2+8+16+64],
|
// '▓': [1+4+32+128, 2+8+16+64],
|
||||||
'█': [255],
|
'█': [255],
|
||||||
};
|
};
|
||||||
@ -31,7 +31,7 @@ const termReset = '\x1B[39;49m';
|
|||||||
|
|
||||||
class BrailleBuffer {
|
class BrailleBuffer {
|
||||||
constructor(width, height) {
|
constructor(width, height) {
|
||||||
this.brailleMap = [[0x1, 0x8],[0x2, 0x10],[0x4, 0x20],[0x40, 0x80]];
|
this.brailleMap = [[0x1, 0x8], [0x2, 0x10], [0x4, 0x20], [0x40, 0x80]];
|
||||||
|
|
||||||
this.pixelBuffer = null;
|
this.pixelBuffer = null;
|
||||||
this.charBuffer = null;
|
this.charBuffer = null;
|
||||||
@ -45,7 +45,7 @@ class BrailleBuffer {
|
|||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
||||||
const size = width*height/8;
|
const size = width * height / 8;
|
||||||
this.pixelBuffer = Buffer.alloc(size);
|
this.pixelBuffer = Buffer.alloc(size);
|
||||||
this.foregroundBuffer = Buffer.alloc(size);
|
this.foregroundBuffer = Buffer.alloc(size);
|
||||||
this.backgroundBuffer = Buffer.alloc(size);
|
this.backgroundBuffer = Buffer.alloc(size);
|
||||||
@ -86,7 +86,7 @@ class BrailleBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_project(x, y) {
|
_project(x, y) {
|
||||||
return (x>>1) + (this.width>>1)*(y>>2);
|
return (x >> 1) + (this.width >> 1) * (y >> 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
_locate(x, y, cb) {
|
_locate(x, y, cb) {
|
||||||
@ -118,7 +118,7 @@ class BrailleBuffer {
|
|||||||
const results = [];
|
const results = [];
|
||||||
for (i = k = 1; k <= 255; i = ++k) {
|
for (i = k = 1; k <= 255; i = ++k) {
|
||||||
const braille = (i & 7) + ((i & 56) << 1) + ((i & 64) >> 3) + (i & 128);
|
const braille = (i & 7) + ((i & 56) << 1) + ((i & 64) >> 3) + (i & 128);
|
||||||
results.push(this.asciiToBraille[i] = masks.reduce((function(best, mask) {
|
results.push(this.asciiToBraille[i] = masks.reduce((function (best, mask) {
|
||||||
const covered = utils.population(mask.mask & braille);
|
const covered = utils.population(mask.mask & braille);
|
||||||
if (!best || best.covered < covered) {
|
if (!best || best.covered < covered) {
|
||||||
return {
|
return {
|
||||||
@ -151,11 +151,11 @@ class BrailleBuffer {
|
|||||||
let currentColor = null;
|
let currentColor = null;
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
|
|
||||||
for (let y = 0; y < this.height/4; y++) {
|
for (let y = 0; y < this.height / 4; y++) {
|
||||||
skip = 0;
|
skip = 0;
|
||||||
|
|
||||||
for (let x = 0; x < this.width/2; x++) {
|
for (let x = 0; x < this.width / 2; x++) {
|
||||||
const idx = y*this.width/2 + x;
|
const idx = y * this.width / 2 + x;
|
||||||
|
|
||||||
if (idx && !x) {
|
if (idx && !x) {
|
||||||
output.push(config.delimeter);
|
output.push(config.delimeter);
|
||||||
@ -168,14 +168,14 @@ class BrailleBuffer {
|
|||||||
|
|
||||||
const char = this.charBuffer[idx];
|
const char = this.charBuffer[idx];
|
||||||
if (char) {
|
if (char) {
|
||||||
skip += stringWidth(char)-1;
|
skip += stringWidth(char) - 1;
|
||||||
if (skip+x < this.width/2) {
|
if (skip + x < this.width / 2) {
|
||||||
output.push(char);
|
output.push(char);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
if (config.useBraille) {
|
if (config.useBraille) {
|
||||||
output.push(String.fromCharCode(0x2800+this.pixelBuffer[idx]));
|
output.push(String.fromCharCode(0x2800 + this.pixelBuffer[idx]));
|
||||||
} else {
|
} else {
|
||||||
output.push(this.asciiToBraille[this.pixelBuffer[idx]]);
|
output.push(this.asciiToBraille[this.pixelBuffer[idx]]);
|
||||||
}
|
}
|
||||||
@ -186,7 +186,7 @@ class BrailleBuffer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output.push(termReset+config.delimeter);
|
output.push(termReset + config.delimeter);
|
||||||
return output.join('');
|
return output.join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,10 +200,10 @@ class BrailleBuffer {
|
|||||||
|
|
||||||
writeText(text, x, y, color, center = true) {
|
writeText(text, x, y, color, center = true) {
|
||||||
if (center) {
|
if (center) {
|
||||||
x -= text.length/2+1;
|
x -= text.length / 2 + 1;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < text.length; i++) {
|
for (let i = 0; i < text.length; i++) {
|
||||||
this.setChar(text.charAt(i), x+i*2, y, color);
|
this.setChar(text.charAt(i), x + i * 2, y, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user