Compare commits
3 Commits
ce45bf2726
...
335992a338
| Author | SHA1 | Date | |
|---|---|---|---|
| 335992a338 | |||
| 6b3f0760ca | |||
| df77704d1c |
@@ -2,12 +2,13 @@ package kernel;
|
|||||||
|
|
||||||
import kernel.ui.WindowContext;
|
import kernel.ui.WindowContext;
|
||||||
import kernel.ui.WindowManager;
|
import kernel.ui.WindowManager;
|
||||||
import lib.TermWriteable;
|
import kernel.ui.TermWriteable;
|
||||||
import lib.TermIO;
|
import lib.TermIO;
|
||||||
#if webconsole
|
#if webconsole
|
||||||
import kernel.net.Net;
|
import kernel.net.Net;
|
||||||
import util.Debug;
|
import util.Debug;
|
||||||
#end
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Log messages to specified output.
|
Log messages to specified output.
|
||||||
**/
|
**/
|
||||||
@@ -29,34 +30,49 @@ class Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function info(msg:Dynamic, ?pos:haxe.PosInfos) {
|
public static function info(msg:Dynamic, ?pos:haxe.PosInfos) {
|
||||||
writer.writeLn("[INFO][" + pos.className + "]: " + Std.string(msg));
|
writer.writeLn(logLine("INFO",pos,msg));
|
||||||
#if webconsole
|
#if webconsole
|
||||||
Debug.printWeb("[INFO][" + pos.className + "]: " + Std.string(msg));
|
Debug.printWeb(logLine("INFO",pos,msg));
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function warn(msg:Dynamic, ?pos:haxe.PosInfos) {
|
public static function warn(msg:Dynamic, ?pos:haxe.PosInfos) {
|
||||||
writer.writeLn("[WARN][" + pos.className + "]: " + Std.string(msg), Yellow);
|
writer.writeLn(logLine("WARN",pos,msg), Yellow);
|
||||||
#if webconsole
|
#if webconsole
|
||||||
Debug.printWeb("[WARN][" + pos.className + "]: " + Std.string(msg));
|
Debug.printWeb(logLine("WARN",pos,msg));
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function error(msg:Dynamic, ?pos:haxe.PosInfos) {
|
public static function error(msg:Dynamic, ?pos:haxe.PosInfos) {
|
||||||
writer.writeLn("[ERRO][" + pos.className + "]: " + Std.string(msg), Red);
|
writer.writeLn(logLine("ERRO",pos,msg), Red);
|
||||||
#if webconsole
|
#if webconsole
|
||||||
Debug.printWeb("[ERRO][" + pos.className + "]: " + Std.string(msg));
|
Debug.printWeb(logLine("ERRO",pos,msg));
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function debug(msg:Dynamic, ?pos:haxe.PosInfos) {
|
public static function debug(msg:Dynamic, ?pos:haxe.PosInfos) {
|
||||||
writer.writeLn("[DEBG][" + pos.className + "]: " + Std.string(msg), Gray);
|
writer.writeLn(logLine("DEBG",pos,msg), Gray);
|
||||||
#if webconsole
|
#if webconsole
|
||||||
Debug.printWeb("[DEBG][" + pos.className + "]: " + Std.string(msg));
|
Debug.printWeb(logLine("DEBG",pos,msg));
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function silly(msg:Dynamic, ?pos:haxe.PosInfos) {
|
||||||
|
writer.writeLn(logLine("SILY",pos,msg), LightGrey);
|
||||||
|
#if webconsole
|
||||||
|
Debug.printWeb(logLine("SILY",pos,msg));
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function moveToOutput(addr:String) {
|
public static function moveToOutput(addr:String) {
|
||||||
WindowManager.instance.focusContextToOutput(context, addr);
|
WindowManager.instance.focusContextToOutput(context, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static function logLine(tag: String,pos: haxe.PosInfos,msg: Dynamic): String {
|
||||||
|
#if debug
|
||||||
|
return '[$tag][${pos.className}:${pos.lineNumber}]: ${Std.string(msg)}';
|
||||||
|
#else
|
||||||
|
return '[$tag]: ${Std.string(msg)}';
|
||||||
|
#end
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package kernel;
|
|||||||
|
|
||||||
using tink.CoreApi;
|
using tink.CoreApi;
|
||||||
|
|
||||||
import lib.TermWriteable;
|
import kernel.ui.TermWriteable;
|
||||||
import cc.Term;
|
import cc.Term;
|
||||||
import util.Vec.Vec2;
|
import util.Vec.Vec2;
|
||||||
import util.Color;
|
import util.Color;
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ class Loopback implements INetworkInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function listen(chan:Int) {
|
public function listen(chan:Int) {
|
||||||
// TODO
|
if (!this.openChans.contains(chan)){
|
||||||
|
this.openChans.push(chan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close(chan:Int) {
|
public function close(chan:Int) {
|
||||||
// TODO
|
this.openChans.remove(chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isListening(chan:Int):Bool {
|
public function isListening(chan:Int):Bool {
|
||||||
@@ -34,7 +36,11 @@ class Loopback implements INetworkInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function send(chan:Int, replyChan:Int, payload:Any) {
|
public function send(chan:Int, replyChan:Int, payload:Any) {
|
||||||
this.onMessageTrigger.trigger(payload);
|
if (this.openChans.contains(chan)){
|
||||||
|
this.onMessageTrigger.trigger(payload);
|
||||||
|
}else{
|
||||||
|
Log.silly("Loopback got package on non open channel");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function name():String {
|
public function name():String {
|
||||||
|
|||||||
@@ -22,22 +22,6 @@ enum PackageTypes {
|
|||||||
public final data:Dynamic;
|
public final data:Dynamic;
|
||||||
public var ttl: Int;
|
public var ttl: Int;
|
||||||
|
|
||||||
/**
|
|
||||||
Parse package from an `modem_message` event.
|
|
||||||
**/
|
|
||||||
public static function fromEvent(params:Array<Dynamic>):Package {
|
|
||||||
var payload = params[4];
|
|
||||||
|
|
||||||
return {
|
|
||||||
fromID: params[3],
|
|
||||||
toID: params[2],
|
|
||||||
msgID: payload.msgID,
|
|
||||||
type: payload.type,
|
|
||||||
data: payload.data,
|
|
||||||
ttl: payload.ttl,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create package that can be used as a response.
|
Create package that can be used as a response.
|
||||||
**/
|
**/
|
||||||
|
|||||||
90
src/kernel/peripherals/Drive.hx
Normal file
90
src/kernel/peripherals/Drive.hx
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
package kernel.peripherals;
|
||||||
|
|
||||||
|
import kernel.net.Package;
|
||||||
|
using tink.CoreApi;
|
||||||
|
|
||||||
|
class Drive implements IPeripheral {
|
||||||
|
public final onDiskInsert:Signal<Noise>;
|
||||||
|
public final onDiskEject:Signal<Noise>;
|
||||||
|
|
||||||
|
private final addr:String;
|
||||||
|
private final native:cc.periphs.Disk;
|
||||||
|
private final onDiskInsertTrigger:SignalTrigger<Noise> = Signal.trigger();
|
||||||
|
private final onDiskEjectTrigger:SignalTrigger<Noise> = Signal.trigger();
|
||||||
|
|
||||||
|
@:allow(kernel.peripherals)
|
||||||
|
private function new(native: cc.periphs.Disk,addr: String) {
|
||||||
|
this.addr = addr;
|
||||||
|
this.native = native;
|
||||||
|
|
||||||
|
this.onDiskInsert = this.onDiskInsertTrigger.asSignal();
|
||||||
|
this.onDiskEject = this.onDiskEjectTrigger.asSignal();
|
||||||
|
|
||||||
|
KernelEvents.instance.onDisk.handle((addr) ->{
|
||||||
|
if (addr == this.addr){
|
||||||
|
this.onDiskInsertTrigger.trigger(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
KernelEvents.instance.onDiskEject.handle((addr)->{
|
||||||
|
if (addr == this.addr){
|
||||||
|
this.onDiskEjectTrigger.trigger(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAddr():String {
|
||||||
|
return this.addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function isDiskPresent(): Bool {
|
||||||
|
return this.native.isDiskPresent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The label of the disk, or `null` if either no disk is inserted or the disk doesn't have a label.
|
||||||
|
**/
|
||||||
|
public inline function getDiskLabel(): Null<String> {
|
||||||
|
return this.native.getDiskLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function clearDiskLabel() {
|
||||||
|
this.native.setDiskLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function setDiskLabel(label: String) {
|
||||||
|
this.native.setDiskLabel(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function hasData():Bool {
|
||||||
|
return this.native.hasData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function hasAudio():Bool {
|
||||||
|
return this.native.hasAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function getMountPath():Null<String> {
|
||||||
|
return this.getMountPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function getAudioTitle(): Null<String> {
|
||||||
|
return this.native.getAudioTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function playAudio() {
|
||||||
|
this.native.playAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function stopAudio() {
|
||||||
|
this.native.stopAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function ejectDisk() {
|
||||||
|
this.native.ejectDisk();
|
||||||
|
}
|
||||||
|
|
||||||
|
public inline function getDiskID(): Int {
|
||||||
|
return this.native.getDiskID();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package kernel.peripherals;
|
package kernel.peripherals;
|
||||||
|
|
||||||
import kernel.net.INetworkInterface;
|
|
||||||
import kernel.peripherals.Modem;
|
import kernel.peripherals.Modem;
|
||||||
import kernel.peripherals.Screen;
|
import kernel.peripherals.Screen;
|
||||||
|
|
||||||
using lua.Table;
|
using lua.Table;
|
||||||
using Lambda;
|
using Lambda;
|
||||||
|
using tink.CoreApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Class responseable for retrieving peripherals.
|
Class responseable for retrieving peripherals.
|
||||||
@@ -18,6 +18,7 @@ class Peripheral {
|
|||||||
|
|
||||||
private var screens: Array<Screen> = [];
|
private var screens: Array<Screen> = [];
|
||||||
private var modes: Array<Modem> = [];
|
private var modes: Array<Modem> = [];
|
||||||
|
private var drives:Array<Drive> = [];
|
||||||
|
|
||||||
@:allow(kernel.Init)
|
@:allow(kernel.Init)
|
||||||
private function new() {
|
private function new() {
|
||||||
@@ -29,6 +30,7 @@ class Peripheral {
|
|||||||
private function updatePeripherals() {
|
private function updatePeripherals() {
|
||||||
findScreens();
|
findScreens();
|
||||||
findModems();
|
findModems();
|
||||||
|
findDrives();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,8 +56,28 @@ class Peripheral {
|
|||||||
return this.modes;
|
return this.modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getModem(addr: String): Null<Modem> {
|
||||||
|
return this.modes.find(item -> item.getAddr() == addr);
|
||||||
|
}
|
||||||
|
|
||||||
private function findModems():Void {
|
private function findModems():Void {
|
||||||
var allModems = cc.Peripheral.getNames().toArray().filter(s -> cc.Peripheral.getType(s) == "modem");
|
var allModems = cc.Peripheral.getNames().toArray().filter(s -> cc.Peripheral.getType(s) == "modem");
|
||||||
this.modes = allModems.map(s -> return new Modem((cc.Peripheral.wrap(s) : Dynamic), s));
|
this.modes = allModems.map(s -> return new Modem((cc.Peripheral.wrap(s) : Dynamic), s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get all connected drives.
|
||||||
|
**/
|
||||||
|
public function getDrives(): Array<Drive> {
|
||||||
|
return this.drives;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDrive(addr: String): Null<Drive> {
|
||||||
|
return this.drives.find(item -> item.getAddr() == addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function findDrives() {
|
||||||
|
var allDrives = cc.Peripheral.getNames().toArray().filter(s -> cc.Peripheral.getType(s) == "drive");
|
||||||
|
this.drives = allDrives.map(s -> return new Drive((cc.Peripheral.wrap(s) : Dynamic), s));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
package kernel.peripherals;
|
package kernel.peripherals;
|
||||||
|
|
||||||
using tink.CoreApi;
|
|
||||||
|
|
||||||
import cc.Term.TerminalSize;
|
import cc.Term.TerminalSize;
|
||||||
import lib.TermWriteable;
|
import kernel.ui.TermWriteable;
|
||||||
import util.Vec.Vec2;
|
import util.Vec.Vec2;
|
||||||
import util.Color;
|
import util.Color;
|
||||||
|
|
||||||
|
using tink.CoreApi;
|
||||||
|
|
||||||
class Screen implements TermWriteable implements IPeripheral {
|
class Screen implements TermWriteable implements IPeripheral {
|
||||||
private final nativ:cc.periphs.Monitor.Monitor;
|
private final nativ:cc.periphs.Monitor.Monitor;
|
||||||
private final addr:String;
|
private final addr:String;
|
||||||
|
|
||||||
private final onResizeTrigger:SignalTrigger<Vec2<Int>>;
|
private final onResizeTrigger:SignalTrigger<Vec2<Int>> = Signal.trigger();
|
||||||
|
|
||||||
public var onResize(default, null):Signal<Vec2<Int>>;
|
public final onResize:Signal<Vec2<Int>>;
|
||||||
|
|
||||||
@:allow(kernel.peripherals)
|
@:allow(kernel.peripherals)
|
||||||
public function new(nativePeripherals:cc.periphs.Monitor.Monitor, addr:String) {
|
public function new(nativePeripherals:cc.periphs.Monitor.Monitor, addr:String) {
|
||||||
this.onResizeTrigger = Signal.trigger();
|
|
||||||
this.onResize = onResizeTrigger.asSignal();
|
this.onResize = onResizeTrigger.asSignal();
|
||||||
|
|
||||||
this.nativ = nativePeripherals;
|
this.nativ = nativePeripherals;
|
||||||
@@ -73,7 +73,6 @@ class Screen implements TermWriteable implements IPeripheral {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getSize():Vec2<Int> {
|
public function getSize():Vec2<Int> {
|
||||||
// FIXME: this will not compile. Has to be changes upstream
|
|
||||||
var size:TerminalSize = nativ.getSize();
|
var size:TerminalSize = nativ.getSize();
|
||||||
return {
|
return {
|
||||||
x: size.width,
|
x: size.width,
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
package kernel.ui;
|
package kernel.ui;
|
||||||
|
|
||||||
using tink.CoreApi;
|
|
||||||
|
|
||||||
import util.Vec.Vec2;
|
import util.Vec.Vec2;
|
||||||
import util.Color;
|
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 {
|
class TermBuffer implements TermWriteable {
|
||||||
/**
|
/**
|
||||||
format [y][x]. First index is the line. Second index the char in the line.
|
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 cursorPos:Vec2<Int> = {x: 0, y: 0};
|
||||||
private var currentTextColor:Color = White;
|
private var currentTextColor:Color = White;
|
||||||
private var currentBgColor:Color = Black;
|
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
|
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() {
|
private function new() {
|
||||||
this.onResizeTrigger = Signal.trigger();
|
|
||||||
this.onResize = onResizeTrigger.asSignal();
|
this.onResize = onResizeTrigger.asSignal();
|
||||||
initScreenBuffer(size);
|
initScreenBuffer(size);
|
||||||
}
|
}
|
||||||
@@ -126,11 +132,11 @@ class TermBuffer implements TermWriteable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getCursorBlink():Bool {
|
public function getCursorBlink():Bool {
|
||||||
throw new haxe.exceptions.NotImplementedException();
|
return this.cursorBlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCursorBlink(blink:Bool) {
|
public function setCursorBlink(blink:Bool) {
|
||||||
// TODO
|
this.cursorBlink = blink;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSize():Vec2<Int> {
|
public function getSize():Vec2<Int> {
|
||||||
@@ -164,7 +170,7 @@ class TermBuffer implements TermWriteable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function isColor():Bool {
|
public function isColor():Bool {
|
||||||
throw new haxe.exceptions.NotImplementedException();
|
return true; // Lets return true for now.
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reset() {
|
public function reset() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package lib;
|
package kernel.ui;
|
||||||
|
|
||||||
using tink.CoreApi;
|
using tink.CoreApi;
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ interface TermWriteable {
|
|||||||
public function getBackgroundColor():Color;
|
public function getBackgroundColor():Color;
|
||||||
public function setBackgroundColor(color:Color):Void;
|
public function setBackgroundColor(color:Color):Void;
|
||||||
public function isColor():Bool;
|
public function isColor():Bool;
|
||||||
// setPaletteColor(...)
|
// public function setPaletteColor(...);
|
||||||
// getPaletteColor(colour)
|
// public function getPaletteColor(colour);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Clears the screen, resetes the courser to (0,0) and resetes the color to Black and White.
|
Clears the screen, resetes the courser to (0,0) and resetes the color to Black and White.
|
||||||
@@ -4,8 +4,12 @@ using tink.CoreApi;
|
|||||||
|
|
||||||
import util.Vec.Vec2;
|
import util.Vec.Vec2;
|
||||||
import util.Color;
|
import util.Color;
|
||||||
import lib.TermWriteable;
|
import kernel.ui.TermWriteable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
A term writer that can switch beetween its internal buffer and another termwriter.
|
||||||
|
The other target is most of the time a real screen
|
||||||
|
**/
|
||||||
class VirtualTermWriter implements TermWriteable extends TermBuffer {
|
class VirtualTermWriter implements TermWriteable extends TermBuffer {
|
||||||
private static final defaultSize:Vec2<Int> = {x: 50, y: 50};
|
private static final defaultSize:Vec2<Int> = {x: 50, y: 50};
|
||||||
|
|
||||||
@@ -13,7 +17,8 @@ class VirtualTermWriter implements TermWriteable extends TermBuffer {
|
|||||||
private var enabled:Bool = false;
|
private var enabled:Bool = false;
|
||||||
private var onResizeLink:CallbackLink;
|
private var onResizeLink:CallbackLink;
|
||||||
|
|
||||||
public function new(?target:TermWriteable) {
|
@:allow(kernel.ui)
|
||||||
|
private function new(?target:TermWriteable) {
|
||||||
setTarget(target);
|
setTarget(target);
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
@@ -52,6 +57,8 @@ class VirtualTermWriter implements TermWriteable extends TermBuffer {
|
|||||||
setSuperSize(newSize);
|
setSuperSize(newSize);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
newTarget.reset();
|
||||||
|
|
||||||
target = newTarget;
|
target = newTarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,11 +102,18 @@ class VirtualTermWriter implements TermWriteable extends TermBuffer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override function getCursorBlink():Bool {
|
public override function getCursorBlink():Bool {
|
||||||
throw new haxe.exceptions.NotImplementedException();
|
if (isEnabled()){
|
||||||
|
return target.getCursorBlink();
|
||||||
|
}else{
|
||||||
|
return super.getCursorBlink();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function setCursorBlink(blink:Bool) {
|
public override function setCursorBlink(blink:Bool) {
|
||||||
// TODO
|
if (isEnabled()){
|
||||||
|
target.setCursorBlink(blink);
|
||||||
|
}
|
||||||
|
super.setCursorBlink(blink);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function getSize():Vec2<Int> {
|
public override function getSize():Vec2<Int> {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using tink.CoreApi;
|
|||||||
import util.Color;
|
import util.Color;
|
||||||
import kernel.ButtonType;
|
import kernel.ButtonType;
|
||||||
import util.Vec.Vec2;
|
import util.Vec.Vec2;
|
||||||
import lib.TermWriteable;
|
import kernel.ui.TermWriteable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The main object you interact with when writing anything to the screen.
|
The main object you interact with when writing anything to the screen.
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package kernel.ui;
|
package kernel.ui;
|
||||||
|
|
||||||
import lib.TermWriteable;
|
import kernel.ui.TermWriteable;
|
||||||
import kernel.peripherals.Peripherals.Peripheral;
|
import kernel.peripherals.Peripherals.Peripheral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Responsable for creating window context, forwarding UI events to the context
|
||||||
|
and switching context to real screens.
|
||||||
|
**/
|
||||||
class WindowManager {
|
class WindowManager {
|
||||||
/**
|
/**
|
||||||
Depends on: KernelEvents, Peripheral
|
Depends on: KernelEvents, Peripheral
|
||||||
@@ -45,9 +49,9 @@ class WindowManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
KernelEvents.instance.onMouseUp.handle(params -> {
|
KernelEvents.instance.onMouseUp.handle(params -> {
|
||||||
// if (currentMainContext != null) {
|
if (currentMainContext != null) {
|
||||||
currentMainContext.onMouseUpTrigger.trigger(params);
|
currentMainContext.onMouseUpTrigger.trigger(params);
|
||||||
// }
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
KernelEvents.instance.onPaste.handle(text -> {
|
KernelEvents.instance.onPaste.handle(text -> {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package lib;
|
package lib;
|
||||||
|
|
||||||
import util.Color;
|
import util.Color;
|
||||||
import lib.TermWriteable;
|
import kernel.ui.TermWriteable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Helpfull class for writing onto a `TermWriteable`.
|
Helpfull class for writing onto a `TermWriteable`.
|
||||||
|
|||||||
Reference in New Issue
Block a user