added reset to TermWriteable

This commit is contained in:
Djeeberjr 2022-03-03 15:44:32 +01:00
parent 242db10083
commit daff654867
5 changed files with 30 additions and 0 deletions

View File

@ -94,4 +94,11 @@ class MainTerm implements TermWriteable {
public function isColor():Bool { public function isColor():Bool {
return Term.isColor(); return Term.isColor();
} }
public function reset() {
this.setBackgroundColor(Black);
this.setTextColor(White);
this.clear();
this.setCursorPos(0,0);
}
} }

View File

@ -108,4 +108,11 @@ class Screen implements TermWriteable implements IPeripheral {
public function isColor():Bool { public function isColor():Bool {
return nativ.isColor(); return nativ.isColor();
} }
public function reset() {
this.setBackgroundColor(Black);
this.setTextColor(White);
this.clear();
this.setCursorPos(0,0);
}
} }

View File

@ -166,4 +166,11 @@ class TermBuffer implements TermWriteable {
public function isColor():Bool { public function isColor():Bool {
throw new haxe.exceptions.NotImplementedException(); throw new haxe.exceptions.NotImplementedException();
} }
public function reset() {
this.setBackgroundColor(Black);
this.setTextColor(White);
this.clear();
this.setCursorPos(0,0);
}
} }

View File

@ -124,4 +124,8 @@ class WindowContext implements TermWriteable {
public function isColor():Bool { public function isColor():Bool {
return writer.isColor(); return writer.isColor();
} }
public function reset() {
writer.reset();
}
} }

View File

@ -36,4 +36,9 @@ interface TermWriteable {
public function isColor():Bool; public function isColor():Bool;
// setPaletteColor(...) // setPaletteColor(...)
// getPaletteColor(colour) // getPaletteColor(colour)
/**
Clears the screen, resetes the courser to (0,0) and resetes the color to Black and White.
**/
public function reset():Void;
} }