Create a transparent, click-through overlay window on top of any game window and draw shapes, text, and HUD elements. Direct3D 11 backend, immediate-mode API, built-in font rendering.
Install
[]
= "2.0.1"
Quick start
Draw status information and projected debug geometry over a game window:
use ;
Usage
Creating an overlay
Find the target window by title, class name, HWND, or process ID:
// by window title (substring match)
let overlay = new?;
// by window class
let overlay = new?;
// by process ID
let overlay = new?;
// by raw HWND
let overlay = new?;
PID lookup only enumerates windows on the caller's current interactive desktop. The overlay must run in the logged-in desktop session that contains the target window. A process started directly from a noninteractive SSH session cannot discover windows on another desktop or session.
ProcessNotFound means the PID does not exist or cannot be queried. ProcessWindowNotFound means the process exists but has no visible top-level window on the current desktop. Windows does not expose enough information here to reliably distinguish a process with no window from one whose window belongs to another desktop or session.
Lifecycle
begin_frame reports OverlayClosed when the overlay window closes and TargetWindowLost when the target HWND is destroyed or becomes inaccessible. Renderer failures remain renderer errors. The consumer owns reconnection policy and any application-state reset after reconnecting.
Drawing shapes
All drawing happens between begin_frame and end_frame:
overlay.begin_frame?;
// filled and outlined rectangles
overlay.rect_filled;
overlay.rect;
// lines
overlay.line;
// circles
overlay.circle_filled;
overlay.circle;
overlay.end_frame?;
Drawing text
Text rendering uses an embedded font with configurable size:
overlay.text;
overlay.text;
// measure text bounds before drawing
let = overlay.text_bounds;
overlay.text;
Platform support
| Platform | Backend | Status |
|---|---|---|
| Windows | Direct3D 11 | Supported |
| Linux | - | Planned |
| macOS | - | Planned |
The crate compiles on all platforms but only exports the overlay API on Windows.
How it works
The overlay creates a transparent, always-on-top window (WS_EX_LAYERED | WS_EX_TRANSPARENT) positioned over the target game window. All mouse and keyboard input passes through to the game. The overlay tracks the target window's position and resizes automatically.
Rendering uses Direct3D 11 with alpha blending. Shapes are batched into vertex/index buffers and drawn in minimal draw calls. Text is rasterized into a glyph atlas at startup and rendered as textured quads.
Demo
Run the visual demo on Windows to see the overlay in action:
cargo run --example demo
This creates a dark window simulating a game scene, overlays it with ESP boxes, health bars, a crosshair, and text labels. The screenshot above was captured from this demo.
License
MIT