SWWL 7.0.0

dotnet add package SWWL --version 7.0.0
                    
NuGet\Install-Package SWWL -Version 7.0.0
                    
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="SWWL" Version="7.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SWWL" Version="7.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SWWL" />
                    
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 SWWL --version 7.0.0
                    
#r "nuget: SWWL, 7.0.0"
                    
#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 SWWL@7.0.0
                    
#: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=SWWL&version=7.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SWWL&version=7.0.0
                    
Install as a Cake Tool

SWWL (WinWindow)

.NET

SWWL is a Windows-only, renderer-agnostic native windowing library for .NET 10.

It owns Win32 window creation, lifetime, native handles and message/event dispatch. Renderers consume the native HWND/HINSTANCE and own their graphics API integration.

Installation

Once the package is published to NuGet.org, install it with the .NET CLI:

dotnet add package SWWL

SWWL targets net10.0-windows and requires .NET 10 on Windows.

License

SWWL is open source under the permissive MIT License. You may use, modify, distribute, and include it in commercial projects, subject to the license notice and disclaimer.

Requirements

  • Windows 10/11
  • .NET 10 SDK
  • x64 or ARM64

Build and test

dotnet build .\SWWL.sln
dotnet test .\SWWL.sln
dotnet run --project .\samples\SWWL.Sample

Quick start

using SWWL;

using var window = Windowing.CreateWindow(new WindowOptions
{
    Title = "Renderer host",
    Width = 1280,
    Height = 720
});

NativeWindowHandle native = window.NativeHandle;
// Pass native.HWND / native.HINSTANCE to your renderer's platform layer.

window.CloseRequested += (_, _) => Console.WriteLine("Close requested; Win32 will close the window by default.");
window.Resized += (_, e) =>
{
    // Notify your renderer/swap chain using e.Width and e.Height.
};
window.KeyDown += (_, e) => Console.WriteLine($"Key: {e.KeyCode}");
window.MouseMoved += (_, e) => Console.WriteLine($"Pointer: {e.X}, {e.Y}");
window.CallbackException += (_, exception) => Console.Error.WriteLine(exception);

while (window.IsOpen)
{
    Windowing.PollEvents();
    // renderer.Render();
}

// The event queue is also available when polling callbacks is not desired:
while (window.TryGetEvent(out WindowEvent? e))
{
    // Handle queued events.
}

Callbacks and actions

Subscribe to strongly named callbacks directly on Window or IWindow:

  • CloseRequested, Closed
  • Resized, Moved
  • FocusGained, FocusLost
  • KeyDown, KeyUp, CharacterInput
  • MouseMoved, MouseButtonDown, MouseButtonUp, MouseWheel
  • EventReceived for every event
  • CallbackException for exceptions thrown by a callback

Callbacks run synchronously on the window's creating thread during Windowing.PollEvents() (or a synchronous Win32 operation that causes a window message). The event queue remains available through TryGetEvent. Callback exceptions are reported through CallbackException and are prevented from crossing the native Win32 window procedure.

Appearance

SWWL requests a dark native title bar by default on supported Windows versions. It uses the DWM immersive dark-mode attribute and falls back to the legacy Windows 10 attribute when needed. Unsupported systems or DWM failures leave the normal system title bar in place without preventing window creation. Disable the request with new WindowOptions { UseDarkTitleBar = false }. This setting affects only the native title bar; the application remains responsible for its client-area colors.

Cursor

The client-area cursor defaults to the standard arrow. Set another standard cursor with:

window.SetCursor(WindowCursor.Hand);
// Restore the arrow:
window.SetCursor(WindowCursor.Arrow);

SWWL explicitly handles WM_SETCURSOR for the client area, so a non-client resize cursor is replaced when the pointer returns inside the window. The standard resize cursors are still handled by Windows while resizing the border.

Transparency

Set whole-window alpha from 0 (invisible) to 255 (opaque). The default is fully opaque:

using var window = Windowing.CreateWindow(new WindowOptions { Opacity = 220 });
// Or change it later:
window.SetOpacity(180);

This uses Win32 layered-window alpha. It applies uniform opacity to the entire native window; per-pixel transparency requires a renderer/compositor path and is not provided by this API.

Cursor controls

Cursor positions use desktop/screen coordinates:

var (x, y) = window.GetCursorPosition();
window.SetCursorPosition(x + 20, y + 20);
window.HideCursor();
window.ShowCursor();

// Load custom cursor artwork from a file (.cur or .ani):
window.SetCursorIcon("assets\\pointer.cur");

// Or load .cur bytes from any readable stream (FileStream, MemoryStream, etc.):
using var cursorStream = File.OpenRead("assets\\pointer.cur");
window.SetCursorIcon(cursorStream);
// The stream remains owned by the caller and is read from its current position.

window.SetCursor(WindowCursor.Arrow); // return to a standard system cursor

The stream overload accepts Windows .cur data (the file-path overload also supports .ani). Cursor visibility is controlled by Win32's shared desktop cursor visibility counter. Pair HideCursor() with ShowCursor(); SWWL also restores visibility when the window is destroyed.

Window icon

Load an .ico file for both the small title-bar/task-switcher icon and large window icon:

window.SetWindowIcon("assets\\app.ico");

SWWL owns and releases the loaded native icon/cursor handles.

Native renderer integration

Renderer Handles supplied by SWWL
Vulkan HWND + HINSTANCE for Win32 surface creation
OpenGL HWND; acquire HDC and create WGL context in renderer integration
DirectX 12 HWND for DXGI swap-chain creation
bgfx HWND through bgfx platform data
Custom NativeWindowHandle / IWindow

Design constraints

  • Create, pump, and destroy windows on the same thread.
  • Call Windowing.PollEvents() regularly on the creating thread.
  • Resize events report client-area dimensions; the renderer resizes its own swap chain/resources.
  • WM_CLOSE produces a CloseRequested event. The default window procedure then continues with normal Win32 close behavior. Call Destroy() yourself if you consume/cancel that default behavior in a future custom close policy.
  • Update() requests and synchronously services a paint; it is not a graphics present call.

Scope

The initial release provides window creation/lifetime, common keyboard/mouse/focus/move/resize events, native handles, title/position/size/visibility controls, and a non-blocking message pump. DPI policy, raw input, monitor enumeration, fullscreen transitions and cursor capture are intentionally separate follow-up work.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.0.0 51 11/11/2026

Initial NuGet package for the SWWL Win32 windowing library.