Add windowed terminal, basic text, rectangle rendering, and keyboard events

This commit is contained in:
Stone_Red
2026-06-08 17:42:08 +02:00
parent 57f011ffe8
commit fc71af028f
10 changed files with 284 additions and 12 deletions
+7
View File
@@ -18,6 +18,13 @@ public sealed class Window(string title, int processId, int id, IRenderSource re
public bool AutoFlush { get; set; } = false;
public event Action<Cosmos.Kernel.System.Keyboard.KeyEvent>? OnKeyEvent;
public void HandleKeyEvent(Cosmos.Kernel.System.Keyboard.KeyEvent keyEvent)
{
OnKeyEvent?.Invoke(keyEvent);
}
public bool IsFocused
{
get => WindowManager.IsWindowFocused(this);
+8
View File
@@ -5,6 +5,7 @@ using System.Drawing;
using System.Linq;
using Cosmos.Kernel.System.Graphics;
using Cosmos.Kernel.System.Mouse;
using Cosmos.Kernel.System.Keyboard;
using RemSox.Processing;
using RemSox.UI.GUI.Rendering;
@@ -51,6 +52,11 @@ public static class WindowManager
wasLeftButtonDown = leftButtonDown;
if (KeyboardManager.TryReadKey(out KeyEvent keyEvent))
{
focusedWindow?.HandleKeyEvent(keyEvent);
}
Canvas canvas = FullScreenCanvas.GetFullScreenCanvas();
CanvasRenderSource.CompositeAndDisplay(canvas, pointerPosition);
@@ -86,6 +92,8 @@ public static class WindowManager
{
processWindows.Remove(window);
}
renderSource.Render(new[] { new RenderCommand { WindowId = window.Id, ElementId = window.Id, ElementType = "WindowClose", Position = window.Position, Properties = new Dictionary<string, object?>() } });
}
public static List<Window> GetWindowsForProcess(Process process)