# txfx/plus7 architecture

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

- Interactive diagram: https://gitdiagram.com/txfx/plus7
- Repository: https://github.com/txfx/plus7

## Overview

##### Project type and purpose
- From the README and file tree, Plus7 is an experimental, C++-based game engine.
- It is organized as a monorepo with a core task/pipeline system, multiple engine modules (graphics, input, UI, SDL application layer), third-party libraries, and sample usage.

##### File structure
- Top-level:
– CMakeLists.txt, build config, CI workflows
– Libs: bundled third-party dependencies (SDL2, ImGui, fmtlib)
– Plus7: engine code subdirectories
– Samples: example client code
- Plus7/Core: lightweight task scheduling and utilities
- Plus7/Modules:
– Gfx: abstract renderer interfaces + back-ends (Dummy, SDL+OpenGL)
– Inputs: platform-agnostic input APIs + SDL backend
– ImGui: wrapper for immediate-mode UI library
– SdlApp: application shell (window, main loop, context init)
- Dependencies flow inward: Modules depend on Core. Sample depends on SdlApp + other modules. Third-party libs feed modules.

##### README for additional insights
- CI status indicates standard CMake based continuous integration

##### Elements
- Clear labels: e.g., “Core: Task Pipeline,” “Gfx Module,” “SDL2”
– from SdlApp to SDL2 (init, loop)
– from Input module to SDL2 (poll)
– from Gfx module to glad/OpenGL, to SDL2 window
– from UI module into Gfx module
– from Sample app into SdlApp and Core

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Layer
    subgraph "Core Layer"
        direction TB
        CLI["Task Pipeline Interfaces"]:::interface
        CLI["Core Utilities"]:::interface
        CLIImpl["Core Task Pipeline Implementation"]:::implementation
    end

    %% Graphics Module
    subgraph "Graphics Module"
        direction TB
        GfxInt["Gfx Interfaces"]:::interface
        subgraph "Dummy Backend"
            direction TB
            DummyInt["Dummy Headers"]:::interface
            DummyImpl["Dummy Implementation"]:::implementation
        end
        subgraph "SDL+OpenGL Backend"
            direction TB
            SdlGlInt["SdlGl Headers"]:::interface
            SdlGlImpl["SdlGl Implementation"]:::implementation
        end
    end

    %% Input Module
    subgraph "Input Module"
        direction TB
        InputInt["Input Interfaces"]:::interface
        subgraph "SDL Input Backend"
            direction TB
            SdlInputInt["SDL Input Headers"]:::interface
            SdlInputImpl["SDL Input Implementation"]:::implementation
        end
    end

    %% UI Module
    subgraph "UI Module"
        direction TB
        UIInt["ImGui Wrapper Interface"]:::interface
        UIImpl["ImGui Wrapper Implementation"]:::implementation
    end

    %% Application Module
    subgraph "Application Module"
        direction TB
        AppInt["SDL App Shell Interface"]:::interface
        AppImpl["SDL App Shell Implementation"]:::implementation
    end

    %% Third-Party Libraries
    subgraph "Third-Party Libraries"
        direction TB
        SDL2["SDL2"]:::thirdparty
        ImGuiLib["ImGui"]:::thirdparty
        Fmt["fmtlib"]:::thirdparty
        Glad["glad"]:::thirdparty
    end

    %% Sample Client
    Sample["HelloWorld Sample"]:::sample

    %% Dependencies
    CLIImpl -->|implements| CLI
    CLI -->|defines interfaces for| CLIImpl
    CLInterfaceBinder["Core Interfaces"]:::interface

    %% Core relationships
    CLInterfaceBinder["Task Pipeline Interfaces"]:::interface
    CLInterfaceBinder -->|used by| CLIImpl

    %% Module dependencies on Core
    GfxInt -->|depends on| CLInterfaceBinder
    InputInt -->|depends on| CLInterfaceBinder
    UIInt -->|depends on| CLInterfaceBinder
    AppInt -->|depends on| CLInterfaceBinder

    %% Backends implement interfaces
    DummyInt -->|implements| GfxInt
    DummyImpl -->|implements| DummyInt
    SdlGlInt -->|implements| GfxInt
    SdlGlImpl -->|implements| SdlGlInt

    SdlInputInt -->|implements| InputInt
    SdlInputImpl -->|implements| SdlInputInt

    %% Runtime flow
    Sample -->|calls| AppInt
    AppImpl -->|initializes| SDL2
    AppImpl -->|drives loop->| InputInt
    InputInt -->|polls| SDL2
    InputInt -->|updates state| CLInterfaceBinder
    CLIImpl -->|schedules tasks| GfxInt
    CLIImpl -->|schedules tasks| UIInt
    UIInt -->|issues draw calls| GfxInt
    GfxInt -->|renders via| SdlGlImpl
    SdlGlImpl -->|calls| Glad
    SdlGlImpl -->|renders on| SDL2

    %% Third-party usage
    UIImpl -->|wraps| ImGuiLib
    CLIImpl -->|uses| Fmt

    %% Sample edges
    Sample -->|registers tasks in| CLIImpl

    %% Click Events
    click CLI "https://github.com/txfx/plus7/tree/master/Plus7/Core/Include/Tasks"
    click CLIImpl "https://github.com/txfx/plus7/blob/master/Plus7/Core/Src/Tasks/Pipeline.cpp"
    click CLIUtilities "https://github.com/txfx/plus7/tree/master/Plus7/Core/Include/Utils"
    click GfxInt "https://github.com/txfx/plus7/tree/master/Plus7/Modules/Gfx/Include"
    click DummyInt "https://github.com/txfx/plus7/tree/master/Plus7/Modules/Gfx/Include/Dummy"
    click DummyImpl "https://github.com/txfx/plus7/blob/master/Plus7/Modules/Gfx/Src/DummyRenderer.cpp"
    click SdlGlInt "https://github.com/txfx/plus7/tree/master/Plus7/Modules/Gfx/Include/SdlGl"
    click SdlGlImpl "https://github.com/txfx/plus7/tree/master/Plus7/Modules/Gfx/Src/SdlGl"
    click InputInt "https://github.com/txfx/plus7/tree/master/Plus7/Modules/Inputs/Include"
    click SdlInputInt "https://github.com/txfx/plus7/tree/master/Plus7/Modules/Inputs/Include/Sdl"
    click SdlInputImpl "https://github.com/txfx/plus7/tree/master/Plus7/Modules/Inputs/Src/Sdl"
    click UIInt "https://github.com/txfx/plus7/blob/master/Plus7/Modules/ImGui/Include/ImGui.hpp"
    click UIImpl "https://github.com/txfx/plus7/blob/master/Plus7/Modules/ImGui/Src/ImGui.cpp"
    click AppInt "https://github.com/txfx/plus7/blob/master/Plus7/Modules/SdlApp/Include/SdlApp.hpp"
    click AppImpl "https://github.com/txfx/plus7/blob/master/Plus7/Modules/SdlApp/Src/SdlApp.cpp"
    click SDL2 "https://github.com/txfx/plus7/tree/master/Libs/SDL2"
    click ImGuiLib "https://github.com/txfx/plus7/tree/master/Libs/ImGui"
    click Fmt "https://github.com/txfx/plus7/tree/master/Libs/fmtlib"
    click Glad "https://github.com/txfx/plus7/blob/master/Plus7/Modules/Gfx/Include/SdlGl/glad.h"
    click Glad "https://github.com/txfx/plus7/blob/master/Plus7/Modules/Gfx/Src/SdlGl/glad.c"
    click Sample "https://github.com/txfx/plus7/blob/master/Samples/HelloWorld.cpp"

    %% Styles
    classDef interface fill:#f9f,stroke:#333,stroke-width:1px
    classDef implementation fill:#bbf,stroke:#333,stroke-width:1px
    classDef thirdparty fill:#afa,stroke:#333,stroke-width:1px
    classDef sample fill:#faa,stroke:#333,stroke-width:1px
```
