diff --git a/PrismOS/Kernel.cs b/PrismOS/Kernel.cs index 7651f1b1..32b35e68 100644 --- a/PrismOS/Kernel.cs +++ b/PrismOS/Kernel.cs @@ -23,141 +23,137 @@ public unsafe class Kernel : Cosmos.System.Kernel (() => { VFS.Initialize(true); }, "Initilizing VFS..."), (() => { VFSManager.RegisterVFS(VFS); }, "Registering VFS..."), (() => { new DHCPClient().SendDiscoverPacket(); DNS = new(); }, "Starting network services..."), - (() => + (() => { Booting = false; }, "Updating boot status..."), + }; + public static WindowManager WM = new() + { + Windows = new() { - WM = new() + new() { - Windows = new() + X = 0, + Y = Canvas.Height - 32, + Width = Canvas.Width, + Height = 32, + Draggable = false, + TitleVisible = false, + Elements = new() { - new() + // Task bar and start button + new Panel() { X = 0, - Y = Canvas.Height - 32, - Width = Canvas.Width, + Y = -300, + Width = 150, + Height = 300, + Color = new(Color.Black, 128), + Visible = false, + }, + new Button() + { + X = 0, + Y = 0, + Width = 64, Height = 32, - Draggable = false, - TitleVisible = false, - Elements = new() - { - // Task bar and start button - new Panel() - { - X = 0, - Y = -300, - Width = 150, - Height = 300, - Color = new(Color.Black, 128), - Visible = false, - }, - new Button() - { - X = 0, - Y = 0, - Width = 64, - Height = 32, - Text = "Start", - OnClick = (ref Element E, ref Window Parent) => { Parent.Elements[0].Visible = !Parent.Elements[0].Visible; }, - }, + Text = "Start", + OnClick = (ref Element E, ref Window Parent) => { Parent.Elements[0].Visible = !Parent.Elements[0].Visible; }, + }, - // App buttons - new Button() + // App buttons + new Button() + { + X = 70, + Y = 0, + Width = 32, + Height = 32, + Text = "C", + OnClick = (ref Element E, ref Window Parent) => + { + WM.Windows.Add(new() { - X = 70, - Y = 0, - Width = 32, - Height = 32, - Text = "C", - OnClick = (ref Element E, ref Window Parent) => + X = 200, + Y = 50, + Width = 300, + Height = 150, + Text = "Clock", + Elements = new() { - WM.Windows.Add(new() + new Clock() { - X = 200, - Y = 50, - Width = 300, - Height = 150, - Text = "Clock", - Elements = new() - { - new Clock() - { - X = 150, - Y = 75, - Radius = 50, - OnUpdate = (ref Element E, ref Window Parent) => { ((Clock)E).Time = DateTime.Now; }, - }, - new Button() - { - X = 285, - Y = -15, - Width = 15, - Height = 15, - Text = "X", - OnClick = (ref Element E, ref Window Parent) => { WM.Windows.Remove(Parent); }, - }, - }, - }); + X = 150, + Y = 75, + Radius = 50, + OnUpdate = (ref Element E, ref Window Parent) => { ((Clock)E).Time = DateTime.Now; }, + }, + new Button() + { + X = 285, + Y = -15, + Width = 15, + Height = 15, + Text = "X", + OnClick = (ref Element E, ref Window Parent) => { WM.Windows.Remove(Parent); }, + }, }, - }, - new Button() + }); + }, + }, + new Button() + { + X = 108, + Y = 0, + Width = 32, + Height = 32, + Text = "TT", + OnClick = (ref Element E, ref Window Parent) => + { + WM.Windows.Add(new() { - X = 108, - Y = 0, - Width = 32, - Height = 32, - Text = "TT", - OnClick = (ref Element E, ref Window Parent) => + X = 200, + Y = 50, + Width = 300, + Height = 150, + Text = "typing test", + Elements = new() { - WM.Windows.Add(new() + new Textbox() { - X = 200, - Y = 50, + X = 0, + Y = 150 - 12, Width = 300, - Height = 150, - Text = "typing test", - Elements = new() + Height = 12, + OnUpdate = (ref Element E, ref Window Parent) => { - new Textbox() - { - X = 0, - Y = 150 - 12, - Width = 300, - Height = 12, - OnUpdate = (ref Element E, ref Window Parent) => - { - if (KeyboardManager.TryReadKey(out var Key) && Key.Key == ConsoleKeyEx.Enter) - { - ((Label)Parent.Elements[1]).Text += '\n' + ((Textbox)E).Text; - } - } - }, - new Label() - { - X = 0, - Y = 0, - Color = Color.White, - Text = "", - }, - new Button() + if (KeyboardManager.TryReadKey(out var Key) && Key.Key == ConsoleKeyEx.Enter) { - X = 285, - Y = -15, - Width = 15, - Height = 15, - Text = "X", - OnClick = (ref Element E, ref Window Parent) => { WM.Windows.Remove(Parent); }, - }, - }, - }); + ((Label)Parent.Elements[1]).Text += '\n' + ((Textbox)E).Text; + } + } + }, + new Label() + { + X = 0, + Y = 0, + Color = Color.White, + Text = "", + }, + new Button() + { + X = 285, + Y = -15, + Width = 15, + Height = 15, + Text = "X", + OnClick = (ref Element E, ref Window Parent) => { WM.Windows.Remove(Parent); }, + }, }, - }, + }); }, - } + }, }, - }; - }, "Starting desktop..."), - (() => { Booting = false; }, "Updating boot status..."), + } + }, }; - public static WindowManager WM; public static CosmosVFS VFS; public static DnsClient DNS; public static Canvas Canvas; diff --git a/PrismOS/Libraries/Graphics/Canvas.cs b/PrismOS/Libraries/Graphics/Canvas.cs index 701c293f..9db0a28a 100644 --- a/PrismOS/Libraries/Graphics/Canvas.cs +++ b/PrismOS/Libraries/Graphics/Canvas.cs @@ -389,6 +389,7 @@ public void Update(bool ShowMouse) DrawImage((int)Mouse.X, (int)Mouse.Y, Cursor); } + //MemoryOperations.Copy(*(uint**)0xE0000000, GCImplementation.GetPointer(Buffer), Width * Height * 4); Global.BaseIOGroups.VBE.LinearFrameBuffer.Copy((int[])(object)Buffer); MemoryOperations.Copy((int[])(object)Buffer, (int[])(object)Wallpaper.Buffer); } diff --git a/PrismOS/Libraries/Graphics/GUI/Elements/Element.cs b/PrismOS/Libraries/Graphics/GUI/Elements/Element.cs index c86bbe29..5cc13301 100644 --- a/PrismOS/Libraries/Graphics/GUI/Elements/Element.cs +++ b/PrismOS/Libraries/Graphics/GUI/Elements/Element.cs @@ -9,6 +9,6 @@ public abstract class Element public Event OnClick, OnUpdate; public bool Clicked, Hovering, Visible = true; - public abstract void Update(Canvas canvas, Window Parent); + public abstract void Update(Canvas Canvas, Window Parent); } } \ No newline at end of file diff --git a/PrismOS/Libraries/Numerics/Math.cs b/PrismOS/Libraries/Numerics/Math.cs index aac17099..06a43c61 100644 --- a/PrismOS/Libraries/Numerics/Math.cs +++ b/PrismOS/Libraries/Numerics/Math.cs @@ -28,6 +28,7 @@ public static int Abs(int Number) { return +Number; } + public static double Abs(double Number) { return +Number; diff --git a/PrismOS/Text/Tests.txt b/PrismOS/Text/Tests.txt index 92a73942..0274f10e 100644 --- a/PrismOS/Text/Tests.txt +++ b/PrismOS/Text/Tests.txt @@ -1,4 +1,4 @@ -Canvas.DrawString(15, 15, "VBE Version: " + Cosmos.Core.VBE.getControllerInfo().vbeVersion, Color.White); +vCanvas.DrawString(15, 15, "VBE Version: " + Cosmos.Core.VBE.getControllerInfo().vbeVersion, Color.White); Canvas.DrawString(15, 15, "Total VRAM: " + Cosmos.Core.VBE.getControllerInfo().totalmemory, Color.White); Canvas.DrawString(15, 15, "Total RAM: " + ((Cosmos.Core.GCImplementation.GetAvailableRAM() + Cosmos.Core.GCImplementation.GetUsedRAM()) / 1024) + " MB", Color.White); Canvas.DrawString(15, 15, "Used RAM: " + (Cosmos.Core.GCImplementation.GetUsedRAM() / 1024) + " MB", Color.White); @@ -116,21 +116,48 @@ if (Cosmos.System.KeyboardManager.ControlPressed || ShowMenu) "