Refactor process spawning command and move TestProcess to its own file

This commit is contained in:
Stone_Red
2026-06-10 03:22:27 +02:00
parent a1dc9f4c5e
commit f6e03c052e
5 changed files with 78 additions and 50 deletions
+1 -39
View File
@@ -24,7 +24,7 @@ public class Kernel : Sys.Kernel
new HelpCommand(),
new ClearCommand(),
new HaltCommand(),
new SpawnTestProcessCommand(),
new SpawnProcessCommand(),
new ListProcessesCommand(),
new StopProcessCommand(),
new StartGuiCommand(),
@@ -62,44 +62,6 @@ public class Kernel : Sys.Kernel
}
}
public class TestProcess() : Process("Test Process")
{
internal override void Start(string[] args)
{
Window window = WindowManager.CreateWindow(this, "Test Window", Point.Empty, new Size(200, 150));
window.AutoFlush = true;
Circle circle = window.CreateUIElement<UI.GUI.UIEelements.Shapes.Circle>(rect =>
{
rect.Position = new Point(10, 10);
rect.Radius = 50;
rect.Color = Color.Red;
});
circle.Radius = 40;
SendMessageToAllProcesses(new TestMessage { SenderProcessId = Id });
}
internal override void Tick()
{
// Example tick logic - could be used for animations, timed events, etc.
}
internal override void HandleInterProcessMessage(Message message)
{
if (message is TestMessage testMessage && message.SenderProcessId != Id)
{
Console.WriteLine($"Received message in {Name} (ID: {Id}): {testMessage.MessageText}");
}
}
}
internal class TestMessage : Message
{
public string MessageText { get; set; } = "Hello from TestMessage!";
}
public static unsafe partial class StartupCodeHelpers
{
[RuntimeExport("fmod")]