# copperdevs/copperdevs.dearimgui architecture

> Architecture diagram of the GitHub repository copperdevs/copperdevs.dearimgui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/copperdevs/copperdevs.dearimgui
- Repository: https://github.com/copperdevs/copperdevs.dearimgui

## Overview

##### Project Type and Purpose
- This project is a C# library that provides a custom, layered abstraction around the popular DearImGui library. Its primary purpose is to deliver an improved interface (including layout, theming, and window management) for using DearImGui in C# applications.
- In addition, the project is organized to support multiple rendering backends (e.g., Raylib, OpenGl via Silk.NET, and Vulkan) and to showcase examples and testing setups for each.

##### Analyzing the File Structure
- The “src” directory is the heart of the project and is split across several important sub-directories:
- Core (src/Core): Contains the primary library code including the layering (Theme, Window, Utility, Data Layering) around DearImGui. It also includes a dedicated Testing module for internal verification.
- Renderers (src/Renderers): Contains dedicated folders for various rendering backends (OpenGl, Raylib, Vulkan). Each renderer folder further contains their specific implementations such as internal rendering utilities and wrappers that integrate with third-party graphics libraries (e.g., Silk.NET for OpenGl, Raylib for Raylib based renderers).
- Examples (src/Examples): Provides sample implementations per rendering backend (libraries for “Sparkle”, Raylib examples using different renderers, etc.) to demonstrate usage.
- The “.run” directory holds configuration files for running/testing/publishing the project in different contexts.

##### Key Insights from the README
- The README emphasizes that the core package enhances DearImGui’s feel in C#, and recommends installing specific renderer packages depending on the chosen rendering backend.
- It highlights available examples and lists “To Do” items, most notably around documentation and examples, indicating current active support for Raylib and OpenGl while Vulkan is planned.
- The installation instructions and dependency notes imply the architecture relies on a plugin-like approach where the core library is renderer-agnostic with renderer packages adding rendering capabilities.

A. Identify Major Components:
- Core Library (CopperDevs.DearImGui):
- Contains application logic such as theming, layering, window management, and data binding/ImGui reflection.
- Internally subdivided into modules (e.g., Rendering, Window Management, Utility, Resources).
- Renderer Modules:
- Each renderer plugin is a separate component (e.g., Raylib Renderers, OpenGl Renderers via Silk.NET, and Vulkan Renderers) that depend on the core library.
- They contain their own internal organization (e.g., Field Renderers for various data types, low-level graphics controller integrations, shaders, etc.).
- Testing Module:
- Represents a separate module for the testing console/application (in src/Core/CopperDevs.DearImGui.Testing).
- Examples:
- These demonstrate the usage of the core library and renderer modules in sample applications, each possibly focused on a different renderer backend.
- External Dependencies:
- DearImGui (the original library), Silk.NET, Raylib and potentially others depending on the renderer.

- That the Examples and Testing modules use the Core Library (and by extension, the renderer plugins).
- A connection between the Utility/Reflection layer and the Field Renderer components in each Renderer module to show how user-defined types and fields are rendered dynamically.

C. Highlight Architectural Patterns:
- Decoupling between the core logic and the renderer-specific implementations. The core “does not care” about which renderer is used.
- Abstraction layers present in the core for theming, window management, and each type of field rendering.
- Point out that the renderer plugins act as “adapters” converting core library drawing commands into renderer-specific API calls.

D. Include Relevant Technologies:
- In the Core, reference standard C#/.NET libraries.
- For Renderer Modules, annotate with external libraries: Silk.NET for OpenGl, Raylib for the Raylib implementations, and mention Vulkan (planned) using Silk.NET.
- Mention integration with DearImGui as the underlying immediate mode GUI engine.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Dependencies
    dearimgui["DearImGui Library"]:::external
    silk["Silk.NET"]:::external
    raylib_ext["Raylib Library"]:::external
    vulkan_ext["Vulkan API"]:::external

    %% Core Library
    core["CopperDevs.DearImGui (Core Library)\n(Theming,WindowManagement,Utility)"]:::core

    %% Renderer Modules
    raylib["Renderer: Raylib"]:::renderer
    opengl["Renderer: OpenGl (Silk.NET)"]:::renderer
    vulkan["Renderer: Vulkan (Planned)"]:::renderer

    %% Other Modules
    testing["Testing Module"]:::testing
    examples["Examples"]:::example

    %% Connections: External Providers
    dearimgui -->|"provides"| core
    silk -->|"provides"| opengl
    raylib_ext -->|"provides"| raylib
    vulkan_ext -->|"provides"| vulkan

    %% Connections: Renderer Dependencies on Core
    raylib -->|"dependsOn"| core
    opengl -->|"dependsOn"| core
    vulkan -->|"dependsOn"| core

    %% Connections: Modules Using Core
    testing -->|"uses"| core
    examples -->|"uses"| core

    %% Click Events
    click core "https://github.com/copperdevs/copperdevs.dearimgui/blob/master/src/Core/CopperDevs.DearImGui"
    click testing "https://github.com/copperdevs/copperdevs.dearimgui/blob/master/src/Core/CopperDevs.DearImGui.Testing"
    click opengl "https://github.com/copperdevs/copperdevs.dearimgui/blob/master/src/Renderers/OpenGl/CopperDevs.DearImGui.Renderer.OpenGl.SilkNet"
    click raylib "https://github.com/copperdevs/copperdevs.dearimgui/tree/master/src/Renderers/Raylib"
    click vulkan "https://github.com/copperdevs/copperdevs.dearimgui/tree/master/src/Renderers/Vulkan"
    click examples "https://github.com/copperdevs/copperdevs.dearimgui/tree/master/src/Examples"

    %% Styles
    classDef core fill:#ffe6e6,stroke:#cc0000,stroke-width:2px;
    classDef renderer fill:#e6ffe6,stroke:#009900,stroke-width:2px;
    classDef external fill:#e6e6ff,stroke:#0000cc,stroke-width:2px;
    classDef testing fill:#ffffcc,stroke:#cccc00,stroke-width:2px;
    classDef example fill:#ffe6ff,stroke:#cc0099,stroke-width:2px;
```
