-
Notifications
You must be signed in to change notification settings - Fork 0
Description
I would like to integrate the UltralightNet library (a C# binding for Ultralight 1.3.0) into the client of the Intersect Engine, which is built on top of MonoGame and uses Gwen.NET as its GUI system.
🧩 Goal
Render HTML content (panels, overlays, dynamic HUDs, interactive UIs) inside the client’s interface.
Use Gwen.NET controls (such as ImagePanel) to host the HTML content rendered by Ultralight.
Capture mouse and keyboard input events from Gwen.NET and forward them to Ultralight.
Preserve the current architecture and rendering flow of Intersect Engine and MonoGame.
📚 References
🔗 UltralightNet (C# bindings):
https://github.com/SupinePandora43/UltralightNet/tree/develop
📦 NuGet Packages:
https://github.com/SupinePandora43?tab=packages&repo_name=UltralightNet
📖 Official Ultralight C++ Docs:
https://docs.ultralig.ht/docs/integrating-with-games
📘 API Reference (C++ 1.3.0):
https://ultralig.ht/api/cpp/1_3_0/
🧪 C# Examples:
https://github.com/SupinePandora43/UltralightNet/tree/develop/Examples
🔧 Technical Requirements
- Render HTML as a Texture2D
Use the CPU rendering mode via BitmapSurface (as GPUDriver is not supported in the current C# bindings).
Transfer the rendered image into a MonoGame Texture2D.
Display that texture within a Gwen.NET container, such as ImagePanel, or a custom control.
Ensure real-time updates for animated/dynamic content.
- Input Event Forwarding
Capture mouse and keyboard events from Gwen.NET controls.
Forward those events to Ultralight using methods like View.FireMouseEvent, View.FireKeyEvent, etc.
Handle coordinate translation between Gwen control space and Ultralight view bounds.
- Two Integration Modes
AppCore Mode (Full Browser Window):
Instantiate App, Renderer, and View via UltralightNet's AppCore.
Load dynamic or local URLs.
Embed the rendered output inside a Gwen.NET panel in the layout.
Headless/Embedded Mode:
Create standalone View instances without AppCore.
Use them for rendering dynamic HTML snippets, UI elements, HUD, notifications, etc.
No additional OS window; rendered directly to the game surface.
- Compatibility
Target Ultralight 1.3.0, the version currently supported by UltralightNet.
Ensure compatibility with MonoGame under .NET 6/7.
Consider possible Gwen.NET limitations due to its legacy status, especially for event routing and advanced input handling.
CPU rendering via BitmapSurface is mandatory — the C# bindings do not support GPUDriver at this time.
The integration should aim for high performance by avoiding blocking the main game/render thread.
Techniques like dirty rectangle updates or surface invalidation checks are encouraged to minimize texture uploads and performance impact.