some random shits

This commit is contained in:
minjaesong
2020-09-20 21:29:26 +09:00
parent 75fa682735
commit 50b567d9ce
12 changed files with 127 additions and 20 deletions

View File

@@ -60,6 +60,12 @@ con.color_pair = function(fore, back) { // 0..255
print(String.fromCharCode(27,91)+"38;5;"+fore+"m");
print(String.fromCharCode(27,91)+"48;5;"+back+"m");
};
con.clear = function() {
print(String.fromCharCode(27,91)+"2J");
};
con.curs_set = function(arg) {
print(String.fromCharCode(27,91)+"?25"+((arg == 0) ? "l" : "h"));
};
Object.freeze(con);
// system management function
var system = {};

10
assets/tvdos/fsh.js Normal file
View File

@@ -0,0 +1,10 @@
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]);
GL.drawTexPattern(_fsh.titlebartex, 0, 0, 560, 14);
con.color_pair(254, 255);
con.clear();
con.curs_set(0);

26
assets/tvdos/gl.js Normal file
View File

@@ -0,0 +1,26 @@
/*
TVDOS Graphics Library
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;
};
GL.drawTexPattern = 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];
graphics.plotPixel(x + xx, y + yy, c);
}
}
};
GL.drawTexImage = function(tex, x, y) {
GL.drawTexPattern(tex, x, y, tex.width, tex.height);
};
Object.freeze(GL);