blob: 3a0c357481f679a9e21961d6699b20cd95a06ba2 [file] [log] [blame] [raw]
"use strict";
/**
* Very simple prototype, mostly incomplete
* @constructor
*/
function NodeScreenTTY()
{
var stdout = process.stdout,
cursor_row = 0,
cursor_col = 0;
clear();
function clear()
{
stdout.write("\x1b[2J");
}
function set_cursor_pos(row, col)
{
stdout.write("\x1b[" + row + ";" + col + "H");
}
function hide_cursor()
{
stdout.write("\x1b[?25l");
}
function show_cursor()
{
stdout.write("\x1b[?25h");
}
this.timer_text = function()
{
};
this.destroy = function()
{
};
this.set_mode = function(is_graphical)
{
if(is_graphical)
{
console.log("Graphical Mode is not supported for NodeScreenTTY");
}
};
this.clear_screen = function()
{
};
this.set_size_text = function(cols, rows)
{
};
this.set_size_graphical = function(width, height)
{
};
this.update_cursor = function(row, col)
{
cursor_row = row;
cursor_col = col;
};
this.update_cursor_scanline = function(start, end)
{
};
this.put_char = function(row, col, chr, bg_color, fg_color)
{
var str = String.fromCharCode(chr);
hide_cursor();
set_cursor_pos(row, col + 1);
stdout.write(str);
set_cursor_pos(cursor_row, cursor_col + 2);
show_cursor();
};
}