Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
terminal-cs committed May 13, 2022
1 parent da88150 commit a5a1a7d
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 157 deletions.
224 changes: 110 additions & 114 deletions PrismOS/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions PrismOS/Libraries/Graphics/Canvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion PrismOS/Libraries/Graphics/GUI/Elements/Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
1 change: 1 addition & 0 deletions PrismOS/Libraries/Numerics/Math.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static int Abs(int Number)
{
return +Number;
}

public static double Abs(double Number)
{
return +Number;
Expand Down
Loading

0 comments on commit a5a1a7d

Please sign in to comment.