DIR.Lib 1.3.91

This package has a SemVer 2.0.0 package version: 1.3.91+d16bf74832b86dcce2f829c1a3d9764273657ae3.
dotnet add package DIR.Lib --version 1.3.91
                    
NuGet\Install-Package DIR.Lib -Version 1.3.91
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DIR.Lib" Version="1.3.91" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DIR.Lib" Version="1.3.91" />
                    
Directory.Packages.props
<PackageReference Include="DIR.Lib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DIR.Lib --version 1.3.91
                    
#r "nuget: DIR.Lib, 1.3.91"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DIR.Lib@1.3.91
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DIR.Lib&version=1.3.91
                    
Install as a Cake Addin
#tool nuget:?package=DIR.Lib&version=1.3.91
                    
Install as a Cake Tool

DIR.Lib

Device-Independent input + Rendering library for .NET. Provides the shared foundation for both GPU (SDL3 + Vulkan) and terminal (Console) applications.

Rendering Primitives

  • PointInt — 2D integer point
  • RectInt — 2D integer rectangle (upper-left + lower-right)
  • RectF32 — 2D float rectangle (x, y, width, height) for pixel-based layout
  • RGBAColor32 — 32-bit RGBA color with Lerp, WithAlpha, Luminance
  • TextAlign — Near/Center/Far alignment enum
  • Renderer<TSurface> — Abstract renderer: FillRectangle, DrawRectangle, FillEllipse, DrawText, MeasureText
  • GlyphBitmap — Raw RGBA glyph bitmap with bearing/advance info
  • FreeTypeGlyphRasterizer — FreeType2-based glyph rasterizer with COLRv1 color emoji support

Input Handling

  • InputKey — Platform-agnostic key codes (letters, digits, function keys, navigation, symbols)
  • InputModifier — Modifier flags (Shift, Ctrl, Alt)
  • IWidget — Shared interface with HandleKeyDown and HandleMouseWheel for both pixel and terminal widgets

Platform bridges (in downstream packages):

  • SdlVulkan.Renderer provides SdlInputMapping (SDL3 Scancode → InputKey)
  • Console.Lib provides ConsoleInputMapping (ConsoleKey → InputKey)

Widget System

  • IPixelWidget — Extends IWidget with pixel-coordinate hit testing and click dispatch
  • PixelWidgetBase<TSurface> — Base class for pixel widgets: clickable regions, text input, buttons, drawing helpers
  • PixelLayout + PixelDockStyle — Dock-based layout engine (Top/Bottom/Left/Right/Fill)
  • ClickableRegion — Registered during render, walked in reverse for hit testing
  • HitResult — Open discriminated union: TextInputHit, ButtonHit, ListItemHit, SlotHit<T>, SliderHit

Text Input

  • TextInputState — Single-line text input state machine with cursor, selection, undo
  • TextInputKey — Abstract key actions (Backspace, Delete, Left, Right, Home, End, Enter, Escape)
  • TextInputRenderer — Renders text input using any Renderer<T> (blinking cursor, selection highlight)
  • Callbacks: OnCommit (async), OnCancel, OnTextChanged, OnKeyOverride

Async Operations

  • BackgroundTaskTracker — Collects background tasks, checks completions per frame, logs errors via ILogger. Call ProcessCompletions() each frame, DrainAsync() at shutdown.

Usage

using DIR.Lib;

// Rendering
renderer.FillRectangle(rect, new RGBAColor32(0x30, 0x50, 0x90, 0xff));
renderer.DrawText("Hello", fontPath, 14f, white, layout);

// Input handling (SDL3 example)
var key = evt.Key.Scancode.ToInputKey;       // via SdlVulkan.Renderer
var mod = evt.Key.Mod.ToInputModifier;
widget.HandleKeyDown(key, mod);

// Pixel layout
var layout = new PixelLayout(contentRect);
var header = layout.Dock(PixelDockStyle.Top, 28f);
var sidebar = layout.Dock(PixelDockStyle.Left, 200f);
var content = layout.Fill();

// Background tasks
tracker.Run(async () => await SaveAsync(), "Save profile");
if (tracker.ProcessCompletions(logger)) needsRedraw = true;

Dependencies

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on DIR.Lib:

Package Downloads
Console.Lib

Package Description

SdlVulkan.Renderer

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.91 18 3/22/2026
1.3.81 17 3/22/2026
1.3.71 20 3/21/2026
1.3.62 34 3/19/2026
1.3.61 170 3/19/2026
1.1.51 30 3/18/2026
1.1.41 45 3/18/2026
1.1.31 31 3/18/2026
1.0.21 28 3/18/2026
1.0.11 48 3/18/2026