another big refactor

This commit is contained in:
Djeeberjr 2022-12-19 21:06:23 +01:00
parent 3cb1811dcb
commit a6ed7818da
45 changed files with 85 additions and 95 deletions

View File

@ -1,7 +1,5 @@
import bin.Terminal; import bin.Terminal;
using util.Extender.LambdaExtender;
class Startup { class Startup {
public static function main() { public static function main() {
var terminal = new Terminal(); var terminal = new Terminal();

View File

@ -1,8 +1,9 @@
package bin; package bin;
import lib.cli.TermHandle;
import lib.cli.CLIBase;
using tink.CoreApi; using tink.CoreApi;
import lib.TermHandle;
import lib.CLIBase;
class HelloWorld extends CLIBase { class HelloWorld extends CLIBase {
public function invoke(handle: TermHandle):Future<Bool> { public function invoke(handle: TermHandle):Future<Bool> {

View File

@ -1,12 +1,12 @@
package bin; package bin;
using tink.CoreApi;
import kernel.peripherals.Peripherals.Peripheral; import kernel.peripherals.Peripherals.Peripheral;
import kernel.net.Routing; import kernel.net.Routing;
import haxe.ds.ReadOnlyArray; import haxe.ds.ReadOnlyArray;
import lib.TermHandle; import lib.cli.TermHandle;
import lib.CLIBase; import lib.cli.CLIBase;
using tink.CoreApi;
class Net extends CLIBase { class Net extends CLIBase {
private var handle:TermHandle; private var handle:TermHandle;

View File

@ -1,8 +1,8 @@
package bin; package bin;
import lib.TermHandle; import lib.cli.TermHandle;
import lib.CLIBase; import lib.cli.CLIBase;
import util.Color; import lib.Color;
import kernel.ui.WindowContext; import kernel.ui.WindowContext;
import kernel.ui.WindowManager; import kernel.ui.WindowManager;

View File

@ -4,7 +4,7 @@ import kernel.turtle.Turtle;
import haxe.MainLoop; import haxe.MainLoop;
import kernel.net.Routing; import kernel.net.Routing;
import cc.OS; import cc.OS;
import util.Debug; import lib.Debug;
import kernel.ui.WindowManager; import kernel.ui.WindowManager;
import kernel.peripherals.Peripherals.Peripheral; import kernel.peripherals.Peripherals.Peripheral;
import kernel.net.Net; import kernel.net.Net;

View File

@ -1,10 +1,10 @@
package kernel; package kernel;
import util.Pos; import lib.Pos;
import cc.HTTP.HTTPResponse; import cc.HTTP.HTTPResponse;
import lua.TableTools; import lua.TableTools;
import lua.Coroutine; import lua.Coroutine;
import util.Vec.Vec2; import lib.Vec.Vec2;
import haxe.Exception; import haxe.Exception;
using tink.CoreApi; using tink.CoreApi;

View File

@ -6,7 +6,7 @@ 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 lib.Debug;
#end #end
/** /**

View File

@ -1,12 +1,12 @@
package kernel; package kernel;
import util.Pos; import lib.Pos;
using tink.CoreApi;
import kernel.ui.TermWriteable; import kernel.ui.TermWriteable;
import cc.Term; import cc.Term;
import util.Vec.Vec2; import lib.Vec.Vec2;
import util.Color; import lib.Color;
using tink.CoreApi;
/** /**
Represents the main computer screen. Represents the main computer screen.

View File

@ -1,9 +1,9 @@
package kernel; package kernel;
using tink.CoreApi;
import cc.OS; import cc.OS;
using tink.CoreApi;
/** /**
Wrapper class for using timer. Wrapper class for using timer.
**/ **/

View File

@ -1,16 +1,15 @@
package kernel.net; package kernel.net;
import haxe.ds.ReadOnlyArray; import haxe.ds.ReadOnlyArray;
using tink.CoreApi;
import kernel.net.Package.NetworkID; import kernel.net.Package.NetworkID;
import kernel.peripherals.Peripherals.Peripheral; import kernel.peripherals.Peripherals.Peripheral;
import kernel.Log; import kernel.Log;
import kernel.Timer; import kernel.Timer;
import cc.OS; import cc.OS;
using tink.CoreApi;
using Lambda; using Lambda;
using util.Extender.LambdaExtender; using lib.Extender.LambdaExtender;
/** /**
Class responsible for everything network related. Class responsible for everything network related.

View File

@ -2,11 +2,10 @@ package kernel.net;
import kernel.peripherals.Peripherals.Peripheral; import kernel.peripherals.Peripherals.Peripheral;
import kernel.net.INetworkInterface; import kernel.net.INetworkInterface;
import kernel.net.Package.NetworkID;
using tink.CoreApi; using tink.CoreApi;
import kernel.net.Package.NetworkID;
@:structInit typedef Route = { @:structInit typedef Route = {
interf:INetworkInterface, interf:INetworkInterface,
rep: NetworkID, rep: NetworkID,

View File

@ -1,6 +1,5 @@
package kernel.peripherals; package kernel.peripherals;
import kernel.net.Package;
using tink.CoreApi; using tink.CoreApi;
class Drive implements IPeripheral { class Drive implements IPeripheral {

View File

@ -1,10 +1,10 @@
package kernel.peripherals; package kernel.peripherals;
using tink.CoreApi;
import kernel.net.Package; import kernel.net.Package;
import kernel.net.INetworkInterface; import kernel.net.INetworkInterface;
using tink.CoreApi;
class Modem implements INetworkInterface implements IPeripheral { class Modem implements INetworkInterface implements IPeripheral {
public final addr:String; public final addr:String;
public var onMessage(default, null):Signal<Package>; public var onMessage(default, null):Signal<Package>;

View File

@ -1,7 +1,7 @@
package kernel.peripherals; package kernel.peripherals;
import haxe.ds.ReadOnlyArray; import haxe.ds.ReadOnlyArray;
import util.Color; import lib.Color;
using tink.CoreApi; using tink.CoreApi;

View File

@ -1,11 +1,10 @@
package kernel.peripherals; package kernel.peripherals;
import lib.Pos;
import util.Pos;
import cc.Term.TerminalSize; import cc.Term.TerminalSize;
import kernel.ui.TermWriteable; import kernel.ui.TermWriteable;
import util.Vec.Vec2; import lib.Vec.Vec2;
import util.Color; import lib.Color;
using tink.CoreApi; using tink.CoreApi;

View File

@ -1,6 +1,6 @@
package kernel.ui; package kernel.ui;
import util.Color; import lib.Color;
@:structInit class Pixel { @:structInit class Pixel {
public var char:String; public var char:String;

View File

@ -1,9 +1,8 @@
package kernel.ui; package kernel.ui;
import lib.Pos;
import util.Pos; import lib.Vec.Vec2;
import util.Vec.Vec2; import lib.Color;
import util.Color;
import kernel.ui.TermWriteable; import kernel.ui.TermWriteable;
using tink.CoreApi; using tink.CoreApi;

View File

@ -1,10 +1,10 @@
package kernel.ui; package kernel.ui;
import util.Pos; import lib.Pos;
using tink.CoreApi; import lib.Color;
import lib.Vec.Vec2;
import util.Color; using tink.CoreApi;
import util.Vec.Vec2;
/** /**
Interface describing a terminal. E.g. the main computer screen or a external screen. Interface describing a terminal. E.g. the main computer screen or a external screen.

View File

@ -1,12 +1,12 @@
package kernel.ui; package kernel.ui;
import util.Pos; import lib.Pos;
using tink.CoreApi; import lib.Vec.Vec2;
import lib.Color;
import util.Vec.Vec2;
import util.Color;
import kernel.ui.TermWriteable; import kernel.ui.TermWriteable;
using tink.CoreApi;
/** /**
A term writer that can switch beetween its internal buffer and another termwriter. A term writer that can switch beetween its internal buffer and another termwriter.
The other target is most of the time a real screen The other target is most of the time a real screen

View File

@ -1,13 +1,13 @@
package kernel.ui; package kernel.ui;
import util.Pos; import lib.Pos;
using tink.CoreApi; import lib.Color;
import util.Color;
import kernel.ButtonType; import kernel.ButtonType;
import util.Vec.Vec2; import lib.Vec.Vec2;
import kernel.ui.TermWriteable; import kernel.ui.TermWriteable;
using tink.CoreApi;
/** /**
The main object you interact with when writing anything to the screen. The main object you interact with when writing anything to the screen.
**/ **/

View File

@ -1,4 +1,4 @@
package util; package lib;
/** /**
Macros with static information. Macros with static information.

View File

@ -1,4 +1,4 @@
package util; package lib;
import kernel.peripherals.Redstone.BundleMask; import kernel.peripherals.Redstone.BundleMask;

View File

@ -1,4 +1,4 @@
package util; package lib;
import lua.NativeStringTools; import lua.NativeStringTools;
import lib.ui.Canvas; import lib.ui.Canvas;

View File

@ -1,4 +1,4 @@
package util; package lib;
import haxe.Exception; import haxe.Exception;

View File

@ -1,4 +1,4 @@
package util; package lib;
class MathI { class MathI {
public static function max(a:Int, b:Int):Int { public static function max(a:Int, b:Int):Int {

View File

@ -1,4 +1,4 @@
package util; package lib;
class ObjMerge { class ObjMerge {
public static function merge<T>(obj1:T, obj2:T): T { public static function merge<T>(obj1:T, obj2:T): T {

View File

@ -1,6 +1,6 @@
package util; package lib;
import util.Vec.Vec2; import lib.Vec.Vec2;
/** /**
Reporesents a Point in a 2D `Int` System. Reporesents a Point in a 2D `Int` System.

View File

@ -1,6 +1,6 @@
package util; package lib;
import util.Vec.Vec3; import lib.Vec.Vec3;
/** /**
Reporesents a Point in a 3D `Int` System. Reporesents a Point in a 3D `Int` System.

View File

@ -1,6 +1,4 @@
package util; package lib;
import util.Vec.Vec2;
class Rect { class Rect {

View File

@ -1,6 +1,6 @@
package lib; package lib;
import util.Color; import lib.Color;
import kernel.ui.TermWriteable; import kernel.ui.TermWriteable;
/** /**

View File

@ -1,4 +1,4 @@
package util; package lib;
@:structInit class Vec2<T> { @:structInit class Vec2<T> {
public final x:T; public final x:T;

View File

@ -1,4 +1,4 @@
package lib; package lib.cli;
using tink.CoreApi; using tink.CoreApi;

View File

@ -1,4 +1,4 @@
package lib; package lib.cli;
import haxe.ds.ReadOnlyArray; import haxe.ds.ReadOnlyArray;

View File

@ -1,4 +1,4 @@
package util; package lib.observable;
using tink.CoreApi; using tink.CoreApi;

View File

@ -1,4 +1,4 @@
package util; package lib.observable;
using tink.CoreApi; using tink.CoreApi;

View File

@ -1,4 +1,4 @@
package util; package lib.observable;
class ObservableArray<T> extends ObservableValue<Array<T>> { class ObservableArray<T> extends ObservableValue<Array<T>> {
public function new(value: Array<T>) { public function new(value: Array<T>) {

View File

@ -1,4 +1,4 @@
package util; package lib.observable;
using tink.CoreApi; using tink.CoreApi;

View File

@ -1,8 +1,9 @@
package lib.turtle; package lib.turtle;
import util.Pos; import lib.Pos;
import util.Pos3; import lib.Pos3;
import kernel.turtle.Turtle; import kernel.turtle.Turtle;
using tink.CoreApi; using tink.CoreApi;
class TurtleExecuter { class TurtleExecuter {

View File

@ -10,7 +10,6 @@ import lua.NativeStringTools;
using tink.CoreApi; using tink.CoreApi;
/** /**
Save a set of turtle instructions to a string and execute them. Save a set of turtle instructions to a string and execute them.
**/ **/

View File

@ -1,7 +1,7 @@
package lib.ui; package lib.ui;
import util.Pos; import lib.Pos;
import util.Rect; import lib.Rect;
import kernel.ui.Pixel; import kernel.ui.Pixel;
abstract Canvas(Array<Array<Pixel>>) to Array<Array<Pixel>> from Array<Array<Pixel>>{ abstract Canvas(Array<Array<Pixel>>) to Array<Array<Pixel>> from Array<Array<Pixel>>{

View File

@ -1,8 +1,8 @@
package lib.ui; package lib.ui;
import util.Pos; import lib.Pos;
import util.Vec.Vec2;
import kernel.ButtonType; import kernel.ButtonType;
using tink.CoreApi; using tink.CoreApi;
typedef UIEvents = { typedef UIEvents = {

View File

@ -1,9 +1,9 @@
package lib.ui.reactive; package lib.ui.reactive;
import util.Pos; import lib.Pos;
import util.Rect; import util.Rect;
import util.ObservableArray; import util.ObservableArray;
import util.Vec.Vec2; import lib.Vec.Vec2;
class ListElement extends UIElement { class ListElement extends UIElement {

View File

@ -2,10 +2,10 @@ package lib.ui.reactive;
import lib.ui.Dimensions; import lib.ui.Dimensions;
import util.ObjMerge; import util.ObjMerge;
import util.Pos; import lib.Pos;
import util.Observable; import util.Observable;
import util.Color; import lib.Color;
import util.Vec.Vec2; import lib.Vec.Vec2;
using tink.CoreApi; using tink.CoreApi;

View File

@ -1,8 +1,8 @@
package lib.ui.reactive; package lib.ui.reactive;
import util.Debug; import lib.Debug;
import util.Vec.Vec2; import lib.Vec.Vec2;
import util.Pos; import lib.Pos;
class TurtleController extends UIElement { class TurtleController extends UIElement {
@ -21,8 +21,6 @@ class TurtleController extends UIElement {
canvas.combine(addButton("F"),{x:1,y:1}); canvas.combine(addButton("F"),{x:1,y:1});
canvas.combine(addButton("F"),{x:5,y:2}); canvas.combine(addButton("F"),{x:5,y:2});
Debug.printCanvasToConsole(canvas);
return canvas; return canvas;
} }

View File

@ -1,9 +1,9 @@
package lib.ui.reactive; package lib.ui.reactive;
import util.ObjMerge; import util.ObjMerge;
import util.Pos; import lib.Pos;
import util.Rect; import lib.Rect;
import util.Vec.Vec2; import lib.Vec.Vec2;
using tink.CoreApi; using tink.CoreApi;