improved logo for the shell

This commit is contained in:
minjaesong
2020-10-01 12:03:43 +09:00
parent 084a9f7aab
commit e8ddf6f9a1
8 changed files with 71 additions and 9 deletions

View File

@@ -80,7 +80,7 @@ Object.freeze(system);
var base64 = {};
base64._lookup = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
base64._revLookup = {"":0,"=":0,"A":0,"B":1,"C":2,"D":3,"E":4,"F":5,"G":6,"H":7,"I":8,"J":9,"K":10,"L":11,"M":12,"N":13,"O":14,"P":15,"Q":16,"R":17,"S":18,"T":19,"U":20,"V":21,"W":22,"X":23,"Y":24,"Z":25,"a":26,"b":27,"c":28,"d":29,"e":30,"f":31,"g":32,"h":33,"i":34,"j":35,"k":36,"l":37,"m":38,"n":39,"o":40,"p":41,"q":42,"r":43,"s":44,"t":45,"u":46,"v":47,"w":48,"x":49,"y":50,"z":51,"0":52,"1":53,"2":54,"3":55,"4":56,"5":57,"6":58,"7":59,"8":60,"9":61,"+":62,"/":63};
base64.atobarr = function(base64str) {
base64.atob = function(base64str) {
var modulo = base64str.length % 4;
var ret = [];
for (var i = 0; i < base64str.length + modulo; i += 4) {
@@ -93,7 +93,7 @@ base64.atobarr = function(base64str) {
}
return ret;
};
base64.atob = function(base64str) {
base64.atobstr = function(base64str) {
var modulo = base64str.length % 4;
var ret = "";
for (var i = 0; i < base64str.length + modulo; i += 4) {

File diff suppressed because one or more lines are too long

View File

@@ -1,12 +1,13 @@
graphics.setBackground(3,3,3);
graphics.resetPalette();
var _fsh = {};
_fsh.titlebarTex = new GL.Tex(2, 14, base64.atobarr("/u/+/v3+/f39/f39/f39/f39/P39/Pz8/Pv7+w=="));
_fsh.titlebarTex = new GL.Tex(2, 14, base64.atob("/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////////////////////////////////////////////////////"));
_fsh.brandLogoTexSmall = new GL.Tex(24, 14, base64.atob("//////////////////////////////////////////j///////////////////////////////j////////////////////////z8/P///j///+hoaGhof+hof////////Pz//////j//6Gh//////+hof////////Pz//////j//6Gh//////+hoaGhof//8/Pz8/P///j///+hoaH///+hof//oaH///Pz//////j//////6Gh//+hof//oaH///Pz//////j///////+hof+hof//oaH///Pz//////j///////+hof+hof//oaH///Pz//////j//6GhoaGh//+hof//oaH///////////j///////////////////////////////j/////////////////////////////////////////////////////"));
_fsh.drawTitlebar = function(titletext) {
GL.drawTexPattern(_fsh.titlebarTex, 0, 0, 560, 14);
@@ -16,7 +17,7 @@ _fsh.drawTitlebar = function(titletext) {
GL.drawTexImageOver(_fsh.brandLogoTexSmall, 268, 0);
}
else {
con.color_pair(240, 255);// vvv this number must be even
con.color_pair(240, 255);
GL.drawTexPattern(_fsh.titlebarTex, 268, 0, 24, 14);
con.move(1, 1 + (_fsh.scrwidth - titletext.length) / 2);
print(titletext);

View File

@@ -5,10 +5,36 @@ Has no affiliation with OpenGL by Khronos Group
*/
var GL = {};
GL.Tex = function(w, h, bytes) {
this.width = w;
this.height = h;
this.texData = bytes;
if (!Array.isArray(bytes)) {
throw "Texture data is not an instance of array";
}
};
GL.SpriteSheet = function(tilew, tileh, tex) {
this.tileWidth = tilew;
this.tileHeight = tile;
this.texture = tex;
if (!tex instanceof GL.Tex) {
throw "Texture is not an instance of GL.Tex";
}
this.getOffX = function(x) { // THIS, or: GL.SpriteSheet.prototype.getOffX
var tx = tileWidth * x;
if (tx + tileWidth > tex.width) throw "Sprite x-offset of "+tx+" is greater than sprite width "+tex.width;
return tx;
};
this.getOffY = function(y) {
var ty = tileHeight * y;
if (ty + tileHeight > tex.height) throw "Sprite y-offset of "+ty+" is greater than sprite height "+tex.height;
return ty;
};
};
GL.drawTexPattern = function(tex, x, y, width, height) {
for (var yy = 0; yy < height; yy++) {
@@ -20,6 +46,18 @@ GL.drawTexPattern = function(tex, x, y, width, height) {
}
}
};
GL.drawTexPatternOver = function(tex, x, y, width, height) {
for (var yy = 0; yy < height; yy++) {
for (var xx = 0; xx < width; xx++) {
var tx = xx % tex.width;
var ty = yy % tex.height;
var c = tex.texData[ty * tex.width + tx];
if (c != 255) {
graphics.plotPixel(x + xx, y + yy, c);
}
}
}
};
/*
* Draws a texture verbatim - color of 255 will be written to the screen buffer
*/
@@ -39,4 +77,27 @@ GL.drawTexImageOver = function(tex, x, y) {
}
}
};
GL.drawSprite = function(sheet, xi, yi, x, y) {
var offx = sheet.getOffX(xi);
var offy = sheet.getOffY(yi);
for (var ty = 0; ty < sheet.tileHeight; ty++) {
for (var tx = 0; tx < sheet.tileWidth; tx++) {
var c = sheet.tex.texData[(ty + offy) * tex.width + (tx + offx)];
graphics.plotPixel(x + tx, y + ty, c);
}
}
};
GL.drawSpriteOver = function(sheet, xi, yi, x, y) {
var offx = sheet.getOffX(xi);
var offy = sheet.getOffY(yi);
for (var ty = 0; ty < sheet.tileHeight; ty++) {
for (var tx = 0; tx < sheet.tileWidth; tx++) {
var c = sheet.tex.texData[(ty + offy) * tex.width + (tx + offx)];
if (c != 255) {
graphics.plotPixel(x + tx, y + ty, c);
}
}
}
};
Object.freeze(GL);

BIN
fsh_clockdigits.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 571 B

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

View File

@@ -91,7 +91,7 @@ object VMRunnerFactory {
catch (e: javax.script.ScriptException) {
System.err.println("ScriptException from the script:")
System.err.println(command.substring(0, minOf(1024, command.length)))
System.err.println(e)
throw e
}
}