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" />
<PackageReference Include="DIR.Lib" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=DIR.Lib&version=1.3.91
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 pointRectInt— 2D integer rectangle (upper-left + lower-right)RectF32— 2D float rectangle (x, y, width, height) for pixel-based layoutRGBAColor32— 32-bit RGBA color with Lerp, WithAlpha, LuminanceTextAlign— Near/Center/Far alignment enumRenderer<TSurface>— Abstract renderer: FillRectangle, DrawRectangle, FillEllipse, DrawText, MeasureTextGlyphBitmap— Raw RGBA glyph bitmap with bearing/advance infoFreeTypeGlyphRasterizer— 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 withHandleKeyDownandHandleMouseWheelfor both pixel and terminal widgets
Platform bridges (in downstream packages):
SdlVulkan.RendererprovidesSdlInputMapping(SDL3 Scancode → InputKey)Console.LibprovidesConsoleInputMapping(ConsoleKey → InputKey)
Widget System
IPixelWidget— Extends IWidget with pixel-coordinate hit testing and click dispatchPixelWidgetBase<TSurface>— Base class for pixel widgets: clickable regions, text input, buttons, drawing helpersPixelLayout+PixelDockStyle— Dock-based layout engine (Top/Bottom/Left/Right/Fill)ClickableRegion— Registered during render, walked in reverse for hit testingHitResult— Open discriminated union: TextInputHit, ButtonHit, ListItemHit, SlotHit<T>, SliderHit
Text Input
TextInputState— Single-line text input state machine with cursor, selection, undoTextInputKey— Abstract key actions (Backspace, Delete, Left, Right, Home, End, Enter, Escape)TextInputRenderer— Renders text input using anyRenderer<T>(blinking cursor, selection highlight)- Callbacks:
OnCommit(async),OnCancel,OnTextChanged,OnKeyOverride
Async Operations
BackgroundTaskTracker— Collects background tasks, checks completions per frame, logs errors viaILogger. CallProcessCompletions()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
- SharpAstro.FreeTypeBindings — FreeType2 native bindings
- Microsoft.Extensions.Logging.Abstractions — ILogger interface for BackgroundTaskTracker
License
MIT
| Product | Versions 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.
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- SharpAstro.FreeTypeBindings (>= 3.2.13)
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.