a LOT of minor stuff

This commit is contained in:
2022-03-05 02:41:30 +01:00
parent ce45bf2726
commit df77704d1c
12 changed files with 90 additions and 56 deletions

View File

@@ -1,11 +1,17 @@
package kernel.ui;
using tink.CoreApi;
import util.Vec.Vec2;
import util.Color;
import lib.TermWriteable;
import kernel.ui.TermWriteable;
using tink.CoreApi;
/**
A virtual terminal. With this a GUI program can still write to its "screen"
even if its not displayed right now. When the GUI gets displayed again
this buffer will be written to the screen.
**/
class TermBuffer implements TermWriteable {
/**
format [y][x]. First index is the line. Second index the char in the line.
@@ -15,14 +21,14 @@ class TermBuffer implements TermWriteable {
private var cursorPos:Vec2<Int> = {x: 0, y: 0};
private var currentTextColor:Color = White;
private var currentBgColor:Color = Black;
private var cursorBlink: Bool = false;
private var size:Vec2<Int> = {x: 51, y: 19}; // Default size set to default size of the main terminal
public var onResize(default, null):Signal<Vec2<Int>>;
public final onResize:Signal<Vec2<Int>>;
private final onResizeTrigger:SignalTrigger<Vec2<Int>>;
private final onResizeTrigger:SignalTrigger<Vec2<Int>> = Signal.trigger();
public function new() {
this.onResizeTrigger = Signal.trigger();
private function new() {
this.onResize = onResizeTrigger.asSignal();
initScreenBuffer(size);
}
@@ -126,11 +132,11 @@ class TermBuffer implements TermWriteable {
}
public function getCursorBlink():Bool {
throw new haxe.exceptions.NotImplementedException();
return this.cursorBlink;
}
public function setCursorBlink(blink:Bool) {
// TODO
this.cursorBlink = blink;
}
public function getSize():Vec2<Int> {
@@ -164,7 +170,7 @@ class TermBuffer implements TermWriteable {
}
public function isColor():Bool {
throw new haxe.exceptions.NotImplementedException();
return true; // Lets return true for now.
}
public function reset() {