removed unused TermIO class
This commit is contained in:
parent
347e210f5f
commit
9f6bdf6851
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user