logo for the shell

This commit is contained in:
minjaesong
2020-09-30 18:30:25 +09:00
parent 516eced8e5
commit 084a9f7aab
8 changed files with 65 additions and 18 deletions

View File

@@ -17,13 +17,13 @@ con.getch = function() {
return sys.readKey();
};
con.move = function(y, x) {
print(String.fromCharCode(27,91)+y+";"+x+"H");
print(String.fromCharCode(27,91)+(y|0)+";"+(x|0)+"H");
};
con.addch = function(c) {
graphics.putSymbol(c);
graphics.putSymbol(c|0);
};
con.mvaddch = function(y, x, c) {
move(y, x); addch(c);
con.move(y, x); con.addch(c);
};
con.getmaxyx = function() {
return graphics.getTermDimension();
@@ -48,13 +48,13 @@ con.color_fore = function(n) { // 0..7; -1 for transparent
if (n < 0)
print(String.fromCharCode(27,91)+"38;5;255m");
else
print(String.fromCharCode(27,91)+((n % 8)+30)+"m");
print(String.fromCharCode(27,91)+(((n|0) % 8)+30)+"m");
};
con.color_back = function(n) { // 0..7; -1 for transparent
if (n < 0)
print(String.fromCharCode(27,91)+"48;5;255m");
else
print(String.fromCharCode(27,91)+((n % 8)+40)+"m");
print(String.fromCharCode(27,91)+(((n|0) % 8)+40)+"m");
};
con.color_pair = function(fore, back) { // 0..255
print(String.fromCharCode(27,91)+"38;5;"+fore+"m");
@@ -64,7 +64,7 @@ con.clear = function() {
print(String.fromCharCode(27,91)+"2J");
};
con.curs_set = function(arg) {
print(String.fromCharCode(27,91)+"?25"+((arg == 0) ? "l" : "h"));
print(String.fromCharCode(27,91)+"?25"+(((arg|0) == 0) ? "l" : "h"));
};
Object.freeze(con);
// system management function

View File

@@ -1,10 +1,32 @@
graphics.setBackground(3,3,3);
var _fsh = {};
_fsh.titlebartex = new GL.Tex(2, 14, [254, 239, 254, 254, 253, 254, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 252, 253, 253, 252, 252, 252, 252, 251, 251, 251]);
_fsh.titlebarTex = new GL.Tex(2, 14, base64.atobarr("/u/+/v3+/f39/f39/f39/f39/P39/Pz8/Pv7+w=="));
_fsh.scrdim = con.getmaxyx();
_fsh.scrwidth = _fsh.scrdim[1];
_fsh.scrheight = _fsh.scrdim[0];
_fsh.brandName = "f\xb3Sh";
_fsh.brandLogoTexSmall = new GL.Tex(24, 14, base64.atobarr("///////////////////////////////////////////z///////////////////////////////z///////////////////////z8/Pz///z////8/Pz8/Pz8/P///////Pz///////z///z8///////8/P///////Pz///////z///z8///////8/Pz8/P/8/Pz8/Pz///z////8/Pz////8/P///Pz//Pz///////z///////z8///8/P///Pz//Pz///////z////////8/P/8/P///Pz//Pz///////z////////8/P/8/P///Pz//Pz///////z///z8/Pz8///8/P///Pz///////////z///////////////////////////////z////////////////////////////////////////////////////"));
GL.drawTexPattern(_fsh.titlebartex, 0, 0, 560, 14);
_fsh.drawTitlebar = function(titletext) {
GL.drawTexPattern(_fsh.titlebarTex, 0, 0, 560, 14);
if (titletext === undefined || titletext.length == 0) {
con.move(1,1);
print(" ".repeat(_fsh.scrwidth));
GL.drawTexImageOver(_fsh.brandLogoTexSmall, 268, 0);
}
else {
con.color_pair(240, 255);// vvv this number must be even
GL.drawTexPattern(_fsh.titlebarTex, 268, 0, 24, 14);
con.move(1, 1 + (_fsh.scrwidth - titletext.length) / 2);
print(titletext);
}
con.color_pair(254, 255);
};
// screen init
con.color_pair(254, 255);
con.clear();
con.curs_set(0);
_fsh.drawTitlebar();

View File

@@ -20,7 +20,23 @@ GL.drawTexPattern = function(tex, x, y, width, height) {
}
}
};
/*
* Draws a texture verbatim - color of 255 will be written to the screen buffer
*/
GL.drawTexImage = function(tex, x, y) {
GL.drawTexPattern(tex, x, y, tex.width, tex.height);
};
/*
* Draws texture with blitting - color of 255 will pass-thru what's already on the screen buffer
*/
GL.drawTexImageOver = function(tex, x, y) {
for (var ty = 0; ty < tex.height; ty++) {
for (var tx = 0; tx < tex.width; tx++) {
var c = tex.texData[ty * tex.width + tx];
if (c != 255) {
graphics.plotPixel(x + tx, y + ty, c);
}
}
}
};
Object.freeze(GL);