start using tinker
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package kernel.ui;
|
||||
|
||||
import util.Signal;
|
||||
using tink.CoreApi;
|
||||
|
||||
import util.Vec.Vec2;
|
||||
import util.Color;
|
||||
import lib.TermWriteable;
|
||||
@@ -21,14 +22,19 @@ class TermBuffer implements TermWriteable {
|
||||
private var currentTextColor: Color = White;
|
||||
private var currentBgColor: Color = Black;
|
||||
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>>;
|
||||
private final onResizeTrigger:SignalTrigger<Vec2<Int>>;
|
||||
|
||||
public function new() {
|
||||
this.onResizeTrigger = Signal.trigger();
|
||||
this.onResize = onResizeTrigger.asSignal();
|
||||
initScreenBuffer(size);
|
||||
}
|
||||
|
||||
private function setSize(size: Vec2<Int>) {
|
||||
if (this.size != size){
|
||||
this._onResize.emit(size);
|
||||
this.onResizeTrigger.trigger(size);
|
||||
}
|
||||
|
||||
this.size = size;
|
||||
@@ -96,13 +102,6 @@ class TermBuffer implements TermWriteable {
|
||||
// TermWriteable functions
|
||||
//
|
||||
|
||||
public var onResize(get,null):SignalReadonly<Vec2<Int>>;
|
||||
private final _onResize:Signal<Vec2<Int>> = new Signal();
|
||||
|
||||
function get_onResize():Signal<Vec2<Int>> {
|
||||
return _onResize;
|
||||
}
|
||||
|
||||
public function write(text:String) {
|
||||
for (i in 0...text.length){
|
||||
safeWriteScreenBuffer({x: cursorPos.x,y: cursorPos.y},text.charAt(i));
|
||||
@@ -171,4 +170,3 @@ class TermBuffer implements TermWriteable {
|
||||
throw new haxe.exceptions.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user