How adamabdelhamed/klooie works
Project type and purpose
• Type: Open-source .NET framework / library for building GUI applications in any .NET-capable console.
• Purpose: Provide controls, containers, animation, theming, input/focus, observability, gaming & physics, audio, video playback, and CLI application hosting. Consumers write console apps that reference the klooie core modules.
File structure
Top-level grouping under src/:
• klooie core libraries:
• Animation, Audio, Containers, Controls, Dialogs, Focus, Forms, Gaming, Geometry, InternalHelpers, Observability, Theming, Video, ConsoleApp (hosting & event loop)
• Supporting projects:
• klooie.Analyzers (Roslyn source generators for observability & pools)
• klooie.Windows (Windows‐only audio playback engine)
• klooie.VideoPlayer (sample console video player)
• Playground (scratch app with resource‐based sound)
• Samples (dozens of sample apps demonstrating features)
• Test projects under src/tests/: cover core libraries and samples.
• Solution & CI: klooie.sln, GitHub Actions workflow (.github/workflows/dotnet.yml), NuGet packaging.
Extract README insights
• High-level categories: Containers & Layout, Controls, Dialogs, Theming, Focus, Forms, Animations, Observability, plus advanced: Physics, Sound (Windows).
• Shows typical usage pattern: derive from ConsoleApp, compose a LayoutRoot with controls, call .Run().
• External placeholder: PowerArgs for CLI parsing.
a. Main components
• ConsoleApp Host (EventLoop, FrameRateMeter, InnerLoopAPIs)
• Core Modules grouped by domain:
• Rendering & Drawing: ConsoleBitmap, Filters, Geometry
• UI Framework: Controls ← Containers ← Forms ← Dialogs
• Input & Focus
• Theming & Styles
• Animation & Easing
• Observability & Data Binding
• Gaming & Physics
• Audio (via ISoundProvider, Windows engine)
• Video Playback (ConsoleBitmapPlayer)
• Source Generators: klooie.Analyzers → augment Observability & pooling
• Sample & Playground Apps: HelloWorld, GamingSample, VideoPlayer, Playground
• Test Harness (UITestManager, AppTest, GamingTest)
• External Dependencies: .NET runtime, PowerArgs, System.Console, Windows APIs
b. Relationships & interactions
• Apps → reference → ConsoleApp Host → uses → Core Modules
• Core Modules layered:
· Rendering calls Geometry & ConsoleBitmap
· Controls composed via Containers; Containers use Layout, Rendering
· Input & Focus broker keyboard to Controls
· Animation sequences values over time, hooking into EventLoop
· Observability supplies change notifications to UI/Animations
· Theming supplies styling metadata to Controls
· Gaming/Physics modules subscribe to EventLoop; use Geometry & Observability; emit rendering commands
· Audio layer pluggable via ISoundProvider; Windows engine implements provider
· VideoPlayer reads/writes ConsoleBitmap streams; uses Rendering & EventLoop
• Source Generators run at build time to inject code into Observability and pooling frameworks.
• Tests execute in-process UI tests via UITestManager and capture ConsoleBitmap output.
c. Architectural patterns & principles
• Layered architecture: Presentation (ConsoleApp, UI) atop Engine (Rendering/Drawing) atop Helpers (Geometry, InternalHelpers).
• MVVM-like data binding via Observability → UI reacts to model changes.
• Plugin / provider pattern for audio, source generators, controls.
• Event Loop driving all time-based services (Animations, Gaming, Video).
• Separation of concerns: each domain in its own folder/project.
d. Key technologies/frameworks
• .NET 6+ / .NET Standard
• Roslyn source generators (klooie.Analyzers)
• System.Console for rendering
• PowerArgs for CLI argument parsing
• GitHub Actions for CI
Essential details to capture
• The EventLoop as the “heartbeat” connecting Animation, Gaming, Video, and ConsoleApp.
• The UI composition: LayoutRoot → Containers → Controls pipelines.
• The build‐time augmentation by klooie.Analyzers into Observability/pooling.
• Sample apps and tests as consumers validating end-to-end scenarios.