cc-haxe/src/kernel/Init.hx
2023-01-30 02:47:54 +01:00

42 lines
879 B
Haxe

package kernel;
import kernel.turtle.Turtle;
import haxe.MainLoop;
import kernel.net.Routing;
import cc.OS;
import lib.Debug;
import kernel.ui.WindowManager;
import kernel.peripherals.Peripherals.Peripheral;
import kernel.net.Net;
class Init {
public static function initKernel() {
// Init singeltons here because haxe is confused about the order to create them.
KernelEvents.instance = new KernelEvents();
Peripheral.instance = new Peripheral();
WindowManager.instance = new WindowManager();
if (Turtle.isTurtle()){
Turtle.instance = new Turtle();
}
Routing.instance = new Routing();
Net.instance = new Net();
// Register default terminate handler
KernelEvents.instance.onTerminate.handle(_->{
OS.reboot();
});
Debug.printBuildInfo();
Routing.instance.init();
MainLoop.add(()->{
KernelEvents.instance.startEventLoop();
});
}
}