minor ui stuff

This commit is contained in:
Djeeberjr 2022-03-04 00:59:32 +01:00
parent 3b6bc85271
commit 1881d8f488
3 changed files with 7 additions and 6 deletions

View File

@ -7,6 +7,9 @@ import kernel.ButtonType;
import util.Vec.Vec2; import util.Vec.Vec2;
import lib.TermWriteable; import lib.TermWriteable;
/**
The main object you interact with when writing anything to the screen.
**/
class WindowContext implements TermWriteable { class WindowContext implements TermWriteable {
private final writer:VirtualTermWriter; private final writer:VirtualTermWriter;
@ -26,7 +29,8 @@ class WindowContext implements TermWriteable {
@:allow(kernel.ui.WindowManager) private final mouseUpTrigger:SignalTrigger<{button:ButtonType, pos:Vec2<Int>}>; @:allow(kernel.ui.WindowManager) private final mouseUpTrigger:SignalTrigger<{button:ButtonType, pos:Vec2<Int>}>;
@:allow(kernel.ui.WindowManager) private final pasteTrigger:SignalTrigger<String>; @:allow(kernel.ui.WindowManager) private final pasteTrigger:SignalTrigger<String>;
public function new(writer:VirtualTermWriter) { @:allow(kernel.ui.WindowManager)
private function new(writer:VirtualTermWriter) {
this.writer = writer; this.writer = writer;
this.onResize = writer.onResize; this.onResize = writer.onResize;

View File

@ -67,10 +67,6 @@ class WindowManager {
allContexts.push(newContext); allContexts.push(newContext);
// newContext.setTarget(MainTerm.instance);
newContext.enable();
currentMainContext = newContext;
return newContext; return newContext;
} }
@ -84,6 +80,7 @@ class WindowManager {
var target:TermWriteable; var target:TermWriteable;
if (output == "main") { if (output == "main") {
target = MainTerm.instance; target = MainTerm.instance;
currentMainContext = context;
} else { } else {
target = Peripheral.instance.getScreen(output); target = Peripheral.instance.getScreen(output);

View File

@ -12,7 +12,7 @@ class TermIO {
public function new(output:TermWriteable) { public function new(output:TermWriteable) {
this.output = output; this.output = output;
output.clear(); output.reset();
output.setCursorPos(0, 0); output.setCursorPos(0, 0);
} }