format
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package lib;
|
||||
|
||||
import util.Vec.Vec2;
|
||||
import util.Color;
|
||||
import lib.TermWriteable;
|
||||
|
||||
@@ -8,28 +7,28 @@ import lib.TermWriteable;
|
||||
Helpfull class for writing onto a `TermWriteable`.
|
||||
**/
|
||||
class TermIO {
|
||||
private var output: TermWriteable;
|
||||
private var output:TermWriteable;
|
||||
|
||||
public function new(output: TermWriteable) {
|
||||
public function new(output:TermWriteable) {
|
||||
this.output = output;
|
||||
|
||||
output.clear();
|
||||
output.setCursorPos(0,0);
|
||||
output.setCursorPos(0, 0);
|
||||
}
|
||||
|
||||
public function writeLn(text: String,?textColor: Color){
|
||||
if (textColor != null){
|
||||
|
||||
public function writeLn(text:String, ?textColor:Color) {
|
||||
if (textColor != null) {
|
||||
output.setTextColor(textColor);
|
||||
}
|
||||
|
||||
var size = output.getSize();
|
||||
|
||||
for (i in 0...Math.floor(text.length / size.x) + 1){
|
||||
output.write(text.substr(i * size.x,size.x));
|
||||
for (i in 0...Math.floor(text.length / size.x) + 1) {
|
||||
output.write(text.substr(i * size.x, size.x));
|
||||
newLine();
|
||||
}
|
||||
|
||||
if (textColor != null){
|
||||
if (textColor != null) {
|
||||
output.setTextColor(White);
|
||||
}
|
||||
}
|
||||
@@ -37,12 +36,11 @@ class TermIO {
|
||||
private function newLine() {
|
||||
var cPos = output.getCursorPos();
|
||||
|
||||
if (cPos.y == output.getSize().y){
|
||||
if (cPos.y == output.getSize().y) {
|
||||
output.scroll(1);
|
||||
output.setCursorPos(0,cPos.y);
|
||||
}else{
|
||||
output.setCursorPos(0,cPos.y + 1);
|
||||
output.setCursorPos(0, cPos.y);
|
||||
} else {
|
||||
output.setCursorPos(0, cPos.y + 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user