removed unused TermIO class

This commit is contained in:
Djeeberjr 2023-03-21 01:10:58 +01:00
parent 347e210f5f
commit 9f6bdf6851

View File

@ -1,51 +0,0 @@
package lib;
import lib.Color;
import kernel.ui.TermWriteable;
/**
Helpfull class for writing onto a `TermWriteable`.
**/
class TermIO {
private var output:TermWriteable;
public function new(output:TermWriteable) {
this.output = output;
output.reset();
output.setCursorPos(0, 0);
}
public function writeLn(text:String, ?textColor:Color) {
if (textColor != null) {
output.setTextColor(textColor);
}
var size = output.getSize();
var cPos = output.getCursorPos();
if (cPos.y >= size.y){
newLine();
}
for (i in 0...Math.floor(text.length / size.x) + 1) {
output.write(text.substr(i * size.x, size.x));
newLine();
}
if (textColor != null) {
output.setTextColor(White);
}
}
private function newLine() {
var cPos = output.getCursorPos();
if (cPos.y == output.getSize().y) {
output.scroll(1);
output.setCursorPos(0, cPos.y - 1);
} else {
output.setCursorPos(0, cPos.y + 1);
}
}
}