GUI测试+Lua增加计时器

This commit is contained in:
2026-02-05 13:15:17 +08:00
parent 66790be755
commit 33012c48e6
15 changed files with 174 additions and 27 deletions

View File

@@ -184,6 +184,9 @@ namespace CMLeonOS.shell
case "lua":
shell.ExecuteLuaScript(args);
break;
case "testgui":
shell.ProcessTestGui();
break;
default:
shell.ShowError($"Unknown command: {command}");
break;

View File

@@ -0,0 +1,44 @@
using System;
using Sys = Cosmos.System;
using Cosmos.System.Graphics;
namespace CMLeonOS.Commands
{
public static class TestGuiCommand
{
public static void RunTestGui()
{
Canvas canvas;
Console.WriteLine("Cosmos booted successfully. Let's go in Graphical Mode");
canvas = FullScreenCanvas.GetFullScreenCanvas(new Mode(640, 480, ColorDepth.ColorDepth32));
canvas.Clear(global::System.Drawing.Color.FromArgb(0, 0, 255));
try
{
canvas.DrawPoint(global::System.Drawing.Color.FromArgb(255, 0, 0), 69, 69);
canvas.DrawLine(global::System.Drawing.Color.FromArgb(173, 255, 47), 250, 100, 400, 100);
canvas.DrawLine(global::System.Drawing.Color.FromArgb(205, 92, 92), 350, 150, 350, 250);
canvas.DrawLine(global::System.Drawing.Color.FromArgb(245, 245, 220), 250, 150, 400, 250);
canvas.DrawRectangle(global::System.Drawing.Color.FromArgb(219, 112, 147), 350, 350, 80, 60);
canvas.DrawRectangle(global::System.Drawing.Color.FromArgb(50, 205, 50), 450, 450, 80, 60);
canvas.Display();
Console.WriteLine("Press any key to return to shell...");
Console.ReadKey(true);
}
catch (Exception e)
{
Console.WriteLine("Exception occurred: " + e.Message);
}
}
}
}

View File

@@ -1216,6 +1216,11 @@ namespace CMLeonOS
Commands.Script.LuaCommand.ExecuteLuaScript(args, fileSystem, this, ShowError, ShowWarning);
}
public void ProcessTestGui()
{
Commands.TestGuiCommand.RunTestGui();
}
public void SetDnsServer(string args)
{
if (string.IsNullOrWhiteSpace(args))