### Manage Overlay Lifecycle with Start and Run Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates the difference between the blocking Run() method and the non-blocking Start() method for managing overlay execution. ```csharp using ClickableTransparentOverlay; using ImGuiNET; public class AsyncOverlay : Overlay { protected override void Render() { ImGui.Begin("Status"); ImGui.Text("Overlay is running!"); ImGui.End(); } } // Option 1: Run() - blocks until overlay closes async Task RunBlocking() { using var overlay = new AsyncOverlay(); await overlay.Run(); Console.WriteLine("Overlay closed"); } // Option 2: Start() - non-blocking, returns when overlay is ready async Task RunNonBlocking() { using var overlay = new AsyncOverlay(); await overlay.Start(); Console.WriteLine("Overlay started, doing other work..."); await overlay.Run(); } ``` -------------------------------- ### Install Clickable Transparent Overlay via NuGet Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Command to add the ClickableTransparentOverlay package to your .NET project using the dotnet CLI. ```bash dotnet add package ClickableTransparentOverlay ``` -------------------------------- ### Initialize Overlays with Constructor Overloads Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Examples of various constructor configurations for the Overlay class, including custom titles, dimensions, and DPI-aware settings. ```csharp using ClickableTransparentOverlay; // Default: 800x600 window titled "Overlay", not DPI-aware public class BasicOverlay : Overlay { public BasicOverlay() : base() { } protected override void Render() { } } // Custom window title public class TitledOverlay : Overlay { public TitledOverlay() : base("My Custom Title") { } protected override void Render() { } } // Custom window dimensions public class SizedOverlay : Overlay { public SizedOverlay() : base(1920, 1080) { } protected override void Render() { } } // Custom title and dimensions public class FullCustomOverlay : Overlay { public FullCustomOverlay() : base("Game HUD", 2560, 1440) { } protected override void Render() { } } // DPI-aware overlay (scales with Windows display scaling) public class DpiAwareOverlay : Overlay { public DpiAwareOverlay() : base("DPI Aware", true, 1920, 1080) { } protected override void Render() { } } ``` -------------------------------- ### Initialize Overlay Window with PostInitialized() Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates overriding the PostInitialized method to perform setup after the overlay window and rendering resources are fully initialized. This is the recommended place to access overlay properties like Size and window handle. ```csharp using ClickableTransparentOverlay; using ImGuiNET; using System.Threading.Tasks; public class InitializedOverlay : Overlay { private string status = "Initializing..."; public InitializedOverlay() : base(1920, 1080) { } protected override Task PostInitialized() { // Access overlay properties safely here status = $"Ready! Window size: {this.Size.Width}x{this.Size.Height}"; // window property is available after initialization var handle = this.window.Handle; Console.WriteLine($"Window handle: {handle}"); return Task.CompletedTask; } protected override void Render() { ImGui.Begin("Status Window"); ImGui.Text(status); ImGui.End(); } } ``` -------------------------------- ### Get Number of Connected Video Displays Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates how to use the static NumberVideoDisplays property to retrieve the count of monitors connected to the system. It also shows how to position the overlay on different displays. ```csharp using ClickableTransparentOverlay; using ImGuiNET; public class MultiMonitorOverlay : Overlay { public MultiMonitorOverlay() : base(800, 600) { } protected override void Render() { ImGui.Begin("Display Information", ImGuiWindowFlags.AlwaysAutoResize); int displays = Overlay.NumberVideoDisplays; ImGui.Text($"Connected Displays: {displays}"); // Position overlay on different monitors if (ImGui.Button("Move to Primary (0, 0)")) { this.Position = new System.Drawing.Point(0, 0); } if (displays > 1 && ImGui.Button("Move to Secondary (1920, 0)")) { this.Position = new System.Drawing.Point(1920, 0); } ImGui.End(); } } ``` -------------------------------- ### Implement a Basic Overlay with ImGui Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates how to create a custom overlay by inheriting from the Overlay base class and implementing the Render method to define UI elements. ```csharp using ClickableTransparentOverlay; using ImGuiNET; public class MyOverlay : Overlay { private bool showWindow = true; private int counter = 0; public MyOverlay() : base("My Overlay", 1920, 1080) { this.FPSLimit = 60; } protected override void Render() { ImGui.Begin("Control Panel", ref showWindow, ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text($"Counter: {counter}"); if (ImGui.Button("Increment")) { counter++; } if (ImGui.Button("Close Overlay")) { this.Close(); } ImGui.End(); if (!showWindow) { this.Close(); } } } // Program.cs - Entry point using var overlay = new MyOverlay(); await overlay.Run(); ``` -------------------------------- ### AddOrGetImagePointer() with Runtime Images (C#) Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates creating and displaying images generated at runtime using ImageSharp. It covers dynamic image generation, updating images periodically, and displaying them both in the main overlay and on the background draw list. Dependencies include ClickableTransparentOverlay, ImGuiNET, and SixLabors.ImageSharp. ```csharp using ClickableTransparentOverlay; using ImGuiNET; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using System; using System.Numerics; public class DynamicImageOverlay : Overlay { private Image dynamicImage; private int frameCount = 0; public DynamicImageOverlay() : base(800, 600) { // Create a 200x200 image dynamicImage = new Image(200, 200); GenerateNoiseImage(); } private void GenerateNoiseImage() { var random = new Random(); for (int y = 0; y < dynamicImage.Height; y++) { for (int x = 0; x < dynamicImage.Width; x++) { dynamicImage[x, y] = new Rgba32( (byte)random.Next(256), (byte)random.Next(256), (byte)random.Next(256), 255); } } } protected override void Render() { ImGui.Begin("Dynamic Image", ImGuiWindowFlags.AlwaysAutoResize); // Regenerate image periodically frameCount++; if (frameCount % 60 == 0) // Every 60 frames { // Remove old texture before updating this.RemoveImage("noise"); GenerateNoiseImage(); } // Load runtime image with custom name this.AddOrGetImagePointer( "noise", // Unique name for caching dynamicImage, // Image instance true, // sRGB color space out IntPtr handle); ImGui.Text($"Frame: {frameCount}"); ImGui.Image(handle, new Vector2(dynamicImage.Width, dynamicImage.Height)); // Draw on background layer ImGui.Text("Background overlay:"); ImGui.GetBackgroundDrawList().AddImage( handle, new Vector2(400, 100), // Top-left position new Vector2(600, 300)); // Bottom-right position ImGui.End(); } protected override void Dispose(bool disposing) { dynamicImage?.Dispose(); base.Dispose(disposing); } } ``` -------------------------------- ### Load and Display Images with AddOrGetImagePointer Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Shows how to load images from disk and display them in ImGui using the AddOrGetImagePointer method. This method automatically caches images for efficient rendering and provides options for displaying at original size, scaled, or with custom UV coordinates for cropping. Ensure the image file (e.g., image.png) is in the executable directory. ```csharp using ClickableTransparentOverlay; using ImGuiNET; using System; using System.IO; using System.Numerics; public class ImageOverlay : Overlay { public ImageOverlay() : base(800, 600) { } protected override void Render() { ImGui.Begin("Image Display", ImGuiWindowFlags.AlwaysAutoResize); string imagePath = "image.png"; if (File.Exists(imagePath)) { // Load image and get texture pointer // Parameters: filePath, sRGB, out handle, out width, out height this.AddOrGetImagePointer( imagePath, false, // Use false for standard images, true for sRGB color space out IntPtr textureHandle, out uint width, out uint height); ImGui.Text($"Image size: {width}x{height}"); // Display at original size ImGui.Image(textureHandle, new Vector2(width, height)); // Display scaled ImGui.Text("Scaled 50%:"); ImGui.Image(textureHandle, new Vector2(width / 2f, height / 2f)); // Display with custom UV coordinates (crop/tile) ImGui.Text("Cropped (top-left quarter):"); ImGui.Image(textureHandle, new Vector2(width / 2f, height / 2f), new Vector2(0, 0), new Vector2(0.5f, 0.5f)); } else { ImGui.Text($"Place '{imagePath}' in the executable directory"); } ImGui.End(); } } ``` -------------------------------- ### AddOrGetImagePointer() with Runtime Images Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates how to create and display images generated at runtime using ImageSharp. This method allows for dynamic image content that can be updated periodically. ```APIDOC ## AddOrGetImagePointer() with Runtime Images ### Description Create and display images generated at runtime using ImageSharp. This example shows how to generate a dynamic noise image and update it periodically. ### Method This is a conceptual example demonstrating the usage of the `AddOrGetImagePointer` method within a custom `Overlay` class. ### Endpoint N/A (This is a C# code example, not a web API endpoint) ### Parameters #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Code Example ```csharp using ClickableTransparentOverlay; using ImGuiNET; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using System; using System.Numerics; public class DynamicImageOverlay : Overlay { private Image dynamicImage; private int frameCount = 0; public DynamicImageOverlay() : base(800, 600) { // Create a 200x200 image dynamicImage = new Image(200, 200); GenerateNoiseImage(); } private void GenerateNoiseImage() { var random = new Random(); for (int y = 0; y < dynamicImage.Height; y++) { for (int x = 0; x < dynamicImage.Width; x++) { dynamicImage[x, y] = new Rgba32( (byte)random.Next(256), (byte)random.Next(256), (byte)random.Next(256), 255); } } } protected override void Render() { ImGui.Begin("Dynamic Image", ImGuiWindowFlags.AlwaysAutoResize); // Regenerate image periodically frameCount++; if (frameCount % 60 == 0) // Every 60 frames { // Remove old texture before updating this.RemoveImage("noise"); GenerateNoiseImage(); } // Load runtime image with custom name this.AddOrGetImagePointer( "noise", // Unique name for caching dynamicImage, // Image instance true, // sRGB color space out IntPtr handle); ImGui.Text($"Frame: {frameCount}"); ImGui.Image(handle, new Vector2(dynamicImage.Width, dynamicImage.Height)); // Draw on background layer ImGui.Text("Background overlay:"); ImGui.GetBackgroundDrawList().AddImage( handle, new Vector2(400, 100), // Top-left position new Vector2(600, 300)); // Bottom-right position ImGui.End(); } protected override void Dispose(bool disposing) { dynamicImage?.Dispose(); base.Dispose(disposing); } } ``` ``` -------------------------------- ### Control Overlay Window Position and Size at Runtime Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Shows how to dynamically control the overlay window's position and dimensions using the Position and Size properties. It includes sliders and buttons for interactive manipulation and presets for common resolutions. ```csharp using ClickableTransparentOverlay; using ImGuiNET; using System.Drawing; public class ResizableOverlay : Overlay { private int[] positionValues = { 0, 0 }; private int[] sizeValues = { 800, 600 }; public ResizableOverlay() : base(800, 600) { } protected override void Render() { ImGui.Begin("Window Controls", ImGuiWindowFlags.AlwaysAutoResize); // Display current position and size ImGui.Text($"Current Position: {this.Position.X}, {this.Position.Y}"); ImGui.Text($"Current Size: {this.Size.Width}x{this.Size.Height}"); ImGui.Separator(); // Position controls ImGui.SliderInt2("Position (X, Y)", ref positionValues[0], 0, 3840); if (ImGui.Button("Set Position")) { this.Position = new Point(positionValues[0], positionValues[1]); } // Size controls ImGui.SliderInt2("Size (W, H)", ref sizeValues[0], 100, 3840); if (ImGui.Button("Set Size")) { this.Size = new Size(sizeValues[0], sizeValues[1]); } // Quick presets if (ImGui.Button("Fullscreen 1080p")) { this.Position = new Point(0, 0); this.Size = new Size(1920, 1080); } if (ImGui.Button("Fullscreen 4K")) { this.Position = new Point(0, 0); this.Size = new Size(3840, 2160); } ImGui.End(); } } ``` -------------------------------- ### Implement Multi-Threaded Overlay Pattern Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Shows how to separate render and logic loops for performance-critical applications. It uses a dedicated thread for logic updates and volatile variables for thread-safe data communication. ```csharp using ClickableTransparentOverlay; using ImGuiNET; using System; using System.Threading; public class MultiThreadedOverlay : Overlay { private volatile bool isRunning = true; private volatile int logicCounter = 0; private volatile float logicDelta = 0; private readonly Thread logicThread; public MultiThreadedOverlay() : base(800, 600) { logicThread = new Thread(LogicLoop); logicThread.Start(); } private void LogicLoop() { var lastTick = DateTime.Now; while (isRunning) { var now = DateTime.Now; logicDelta = (float)(now - lastTick).TotalSeconds; lastTick = now; logicCounter++; Thread.Sleep(16); } } public override void Close() { isRunning = false; logicThread?.Join(1000); base.Close(); } protected override void Render() { ImGui.Begin("Multi-Threaded Stats", ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text("=== Render Thread ==="); ImGui.Text($"Render FPS: {ImGui.GetIO().Framerate:F1}"); ImGui.Separator(); ImGui.Text("=== Logic Thread ==="); ImGui.Text($"Logic Updates: {logicCounter}"); ImGui.End(); } } ``` -------------------------------- ### Manage Overlay Frame Rate with FPSLimit and VSync Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Explains how to control the overlay's frame rate using FPSLimit for software-based limiting or VSync for hardware synchronization. It displays current FPS and provides controls to adjust these settings. ```csharp using ClickableTransparentOverlay; using ImGuiNET; public class FrameControlOverlay : Overlay { private int fpsValue = 60; public FrameControlOverlay() : base(800, 600) { // Default FPS limit is 60 this.FPSLimit = 60; // VSync is disabled by default this.VSync = false; } protected override void Render() { ImGui.Begin("Frame Rate Control", ImGuiWindowFlags.AlwaysAutoResize); // Display current frame rate ImGui.Text($"Current FPS: {ImGui.GetIO().Framerate:F1}"); ImGui.Text($"Frame Time: {ImGui.GetIO().DeltaTime * 1000:F2} ms"); ImGui.Separator(); // FPS limit control if (ImGui.SliderInt("FPS Limit", ref fpsValue, 0, 240)) { this.FPSLimit = fpsValue; } ImGui.Text("Set to 0 for unlimited FPS"); // VSync toggle if (ImGui.Checkbox("Enable VSync", ref this.VSync)) { // VSync takes priority over FPSLimit when enabled } ImGui.Text("VSync overrides FPS limit when enabled"); ImGui.End(); } } ``` -------------------------------- ### Terminate Overlay Window Safely Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates how to safely close an overlay window and terminate the render loop using the Close() method. It includes a confirmation modal pattern to prevent accidental closures. ```csharp using ClickableTransparentOverlay; using ImGuiNET; public class CloseableOverlay : Overlay { private bool showConfirmation = false; public CloseableOverlay() : base(800, 600) { } protected override void Render() { ImGui.Begin("Main Window", ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text("Press the button to close the overlay"); if (ImGui.Button("Close Overlay")) { showConfirmation = true; } ImGui.End(); if (showConfirmation) { ImGui.OpenPopup("Confirm Close"); } if (ImGui.BeginPopupModal("Confirm Close", ref showConfirmation, ImGuiWindowFlags.AlwaysAutoResize)) { ImGui.Text("Are you sure you want to close?"); ImGui.Separator(); if (ImGui.Button("Yes", new System.Numerics.Vector2(80, 0))) { this.Close(); } ImGui.SameLine(); if (ImGui.Button("No", new System.Numerics.Vector2(80, 0))) { showConfirmation = false; ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } } } ``` -------------------------------- ### Replace Default Font with Language-Specific Glyphs Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates how to use the ReplaceFont method to load system fonts with predefined language glyph ranges such as English, Chinese, Japanese, or Korean. It also shows how to reset the font to the default ImGui configuration. ```csharp using ClickableTransparentOverlay; using ImGuiNET; public class FontOverlay : Overlay { private int fontSize = 16; public FontOverlay() : base(800, 600) { } protected override void Render() { ImGui.Begin("Font Settings", ImGuiWindowFlags.AlwaysAutoResize); ImGui.DragInt("Font Size", ref fontSize, 0.5f, 8, 48); ImGui.Separator(); if (ImGui.Button("Load Arial (English)")) { this.ReplaceFont(@"C:\Windows\Fonts\arial.ttf", fontSize, FontGlyphRangeType.English); } if (ImGui.Button("Load Chinese Font (中文)")) { this.ReplaceFont(@"C:\Windows\Fonts\msyh.ttc", fontSize, FontGlyphRangeType.ChineseSimplifiedCommon); } if (ImGui.Button("Load Japanese Font (日本語)")) { this.ReplaceFont(@"C:\Windows\Fonts\msgothic.ttc", fontSize, FontGlyphRangeType.Japanese); } if (ImGui.Button("Load Korean Font (한국어)")) { this.ReplaceFont(@"C:\Windows\Fonts\malgun.ttf", fontSize, FontGlyphRangeType.Korean); } if (ImGui.Button("Reset to Default")) { this.ReplaceFont(); } ImGui.Separator(); ImGui.Text("Sample text: Hello 你好 こんにちは 안녕하세요"); ImGui.End(); } } ``` -------------------------------- ### Configure Font Glyph Ranges in Overlay Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates how to inherit from the Overlay class and use the ReplaceFont method with FontGlyphRangeType to support specific language character sets. This ensures that the ImGui renderer can display non-Latin characters correctly. ```csharp using ClickableTransparentOverlay; public class LanguageOverlay : Overlay { public LanguageOverlay() : base(800, 600) { } protected override System.Threading.Tasks.Task PostInitialized() { this.ReplaceFont(@"C:\Windows\Fonts\msyh.ttc", 18, FontGlyphRangeType.ChineseSimplifiedCommon); return System.Threading.Tasks.Task.CompletedTask; } protected override void Render() { ImGuiNET.ImGui.Begin("Language Demo"); ImGuiNET.ImGui.Text("English: Hello World"); ImGuiNET.ImGui.Text("Chinese: 你好世界"); ImGuiNET.ImGui.End(); } } ``` -------------------------------- ### Advanced Font Loading with ReplaceFont Delegate Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Demonstrates using the ReplaceFont delegate overload to load multiple fonts or merge font files for advanced text rendering in ImGui. It handles loading primary and secondary fonts, as well as merging icon fonts with base text fonts. Ensure the font files (e.g., arial.ttf, arialbd.ttf, fa-brands-400.ttf) are accessible. ```csharp using ClickableTransparentOverlay; using ImGuiNET; using System; using System.IO; public class AdvancedFontOverlay : Overlay { private ImFontPtr? secondaryFont = null; private readonly ushort[] iconRange = new ushort[] { 0xE005, 0xF8FF, 0x00 }; public AdvancedFontOverlay() : base(800, 600) { } protected override unsafe void Render() { ImGui.Begin("Advanced Fonts", ImGuiWindowFlags.AlwaysAutoResize); // Load multiple fonts if (ImGui.Button("Load Two Fonts")) { this.ReplaceFont(config => { var io = ImGui.GetIO(); // Primary font (default) if (File.Exists(@"C:\\Windows\\Fonts\\arial.ttf")) { io.Fonts.AddFontFromFileTTF(@"C:\\Windows\\Fonts\\arial.ttf", 16, config, io.Fonts.GetGlyphRangesDefault()); } // Secondary font (larger, for headers) if (File.Exists(@"C:\\Windows\\Fonts\\arialbd.ttf")) { secondaryFont = io.Fonts.AddFontFromFileTTF(@"C:\\Windows\\Fonts\\arialbd.ttf", 24, config, io.Fonts.GetGlyphRangesDefault()); } }); } // Merge fonts (combine text + icons) if (ImGui.Button("Merge Text + Icons")) { secondaryFont = null; this.ReplaceFont(config => { var io = ImGui.GetIO(); // Base font io.Fonts.AddFontFromFileTTF(@"C:\\Windows\\Fonts\\arial.ttf", 16, config, io.Fonts.GetGlyphRangesDefault()); // Merge icon font into base font config->MergeMode = 1; config->OversampleH = 1; config->OversampleV = 1; fixed (ushort* p = &iconRange[0]) { if (File.Exists("fa-brands-400.ttf")) { io.Fonts.AddFontFromFileTTF("fa-brands-400.ttf", 16, config, new IntPtr(p)); } } }); } ImGui.Separator(); // Use secondary font for headers if (secondaryFont != null) { ImGui.PushFont(secondaryFont.Value); ImGui.Text("Large Header Text"); ImGui.PopFont(); } ImGui.Text("Normal body text"); ImGui.End(); } } ``` -------------------------------- ### RemoveImage() Method for Image Management (C#) Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Illustrates how to remove cached images from the overlay to free up GPU memory or prepare for image updates. This method is useful for managing resources when images are no longer needed or are being replaced. Dependencies include ClickableTransparentOverlay and ImGuiNET. ```csharp using ClickableTransparentOverlay; using ImGuiNET; using System; using System.IO; using System.Numerics; public class ImageManagementOverlay : Overlay { private bool imageLoaded = false; public ImageManagementOverlay() : base(800, 600) { } protected override void Render() { ImGui.Begin("Image Management", ImGuiWindowFlags.AlwaysAutoResize); string imagePath = "image.png"; if (File.Exists(imagePath)) { if (imageLoaded) { // Display cached image this.AddOrGetImagePointer(imagePath, false, out IntPtr handle, out uint w, out uint h); ImGui.Image(handle, new Vector2(w, h)); if (ImGui.Button("Unload Image")) { // Remove from cache and free GPU memory bool removed = this.RemoveImage(imagePath); if (removed) { imageLoaded = false; ImGui.Text("Image unloaded successfully"); } } } else { if (ImGui.Button("Load Image")) { this.AddOrGetImagePointer(imagePath, false, out _, out _, out _); imageLoaded = true; } } } ImGui.End(); } } ``` -------------------------------- ### Create Non-Clickable Overlay Windows Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Explains how to create HUD elements that do not capture mouse input by utilizing ImGui window flags like NoInputs. This allows for transparent overlays that display information without interfering with underlying application interactions. ```csharp using ClickableTransparentOverlay; using ImGuiNET; using System; using System.Numerics; public class HUDOverlay : Overlay { private bool showClickableMenu = true; public HUDOverlay() : base(1920, 1080) { } protected override void Render() { ImGui.SetNextWindowPos(new Vector2(10, 10)); ImGui.SetNextWindowBgAlpha(0.7f); ImGui.Begin("HUD", ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.AlwaysAutoResize); ImGui.Text($"Time: {DateTime.Now:HH:mm:ss}"); ImGui.Text($"FPS: {ImGui.GetIO().Framerate:F0}"); ImGui.End(); if (showClickableMenu) { ImGui.Begin("Settings", ref showClickableMenu, ImGuiWindowFlags.AlwaysAutoResize); if (ImGui.Button("Close Overlay")) { this.Close(); } ImGui.End(); } } } ``` -------------------------------- ### Replace Font with Custom Unicode Glyph Ranges Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Shows how to load fonts using specific custom Unicode glyph ranges defined as ushort arrays. This is useful for loading icon fonts or specific character subsets not covered by standard language ranges. ```csharp using ClickableTransparentOverlay; using ImGuiNET; public class CustomFontOverlay : Overlay { private readonly ushort[] customRange = new ushort[] { 0x0020, 0x00FF, 0x00 }; private readonly ushort[] iconRange = new ushort[] { 0xE005, 0xF8FF, 0x00 }; public CustomFontOverlay() : base(800, 600) { } protected override void Render() { ImGui.Begin("Custom Glyph Range", ImGuiWindowFlags.AlwaysAutoResize); if (ImGui.Button("Load Custom Range")) { this.ReplaceFont(@"C:\Windows\Fonts\arial.ttf", 18, customRange); } if (ImGui.Button("Load Icon Font")) { this.ReplaceFont("fa-brands-400.ttf", 18, iconRange); } ImGui.End(); } } ``` -------------------------------- ### RemoveImage() Method Source: https://context7.com/zaafar/clickabletransparentoverlay/llms.txt Explains how to remove cached images using the `RemoveImage` method. This is useful for freeing GPU memory or preparing an image for an update. ```APIDOC ## RemoveImage() Method ### Description Remove cached images to free GPU memory or prepare for image updates. This example demonstrates loading an image, displaying it, and then unloading it using the `RemoveImage` method. ### Method This is a conceptual example demonstrating the usage of the `AddOrGetImagePointer` and `RemoveImage` methods within a custom `Overlay` class. ### Endpoint N/A (This is a C# code example, not a web API endpoint) ### Parameters #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ### Code Example ```csharp using ClickableTransparentOverlay; using ImGuiNET; using System; using System.IO; using System.Numerics; public class ImageManagementOverlay : Overlay { private bool imageLoaded = false; public ImageManagementOverlay() : base(800, 600) { } protected override void Render() { ImGui.Begin("Image Management", ImGuiWindowFlags.AlwaysAutoResize); string imagePath = "image.png"; if (File.Exists(imagePath)) { if (imageLoaded) { // Display cached image this.AddOrGetImagePointer(imagePath, false, out IntPtr handle, out uint w, out uint h); ImGui.Image(handle, new Vector2(w, h)); if (ImGui.Button("Unload Image")) { // Remove from cache and free GPU memory bool removed = this.RemoveImage(imagePath); if (removed) { imageLoaded = false; ImGui.Text("Image unloaded successfully"); } } } else { if (ImGui.Button("Load Image")) { this.AddOrGetImagePointer(imagePath, false, out _, out _, out _); imageLoaded = true; } } } ImGui.End(); } } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.