# onelonecoder/olcpixelgameengine architecture

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

- Interactive diagram: https://gitdiagram.com/onelonecoder/olcpixelgameengine
- Repository: https://github.com/onelonecoder/olcpixelgameengine

## Overview

##### Main Components

a) Core Engine (Central Component):
- Primary features: pixel drawing, user interface, and platform abstraction

b) Extension System (PGEX):
- Extensions by functionality:
- Graphics (Graphics2D, Graphics3D, Wireframe)
- Input/Interface (PopUpMenu, QuickGUI)
- Audio (Sound)
- Networking (Network)
- Visualization (TransformedView, RayCastWorld)

c) Utility Layer:
- Utilities by purpose:
- Graphics (Animate2D, Camera2D, Palette)
- Data Structures (Container, QuadTree)
- File Handling (DataFile)
- Mathematics (Geometry2D)

d) Platform Support Layer:
- Supported platforms:
- Windows
- Linux
- Web (WASM)
- Other platforms (marked as community-supported)

- Blue: Core dependencies
- Green: Extension relationships
- Orange: Platform-specific implementations

**[Platform Layer]**
- ↑
**[Core Engine]**
- ↓
**[Extensions] ← [Utilities]**

##### Additional Elements

b) Version Information:
- Current version number
- Compatibility notes

c) Integration Points:
- How user code interfaces with the engine
- Extension points

##### Technical Details

- Header-only nature of the engine
- Cross-platform compilation paths
- Extension mechanism
- Resource management flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Platform_Layer
        Windows[Windows]:::platform
        Linux[Linux]:::platform
        WASM[Web/WASM]:::platform
        click WASM "https://github.com/OneLoneCoder/olcPixelGameEngine/tree/master/tools/wasm/"
        Other[Other Platforms]:::platform
    end

    subgraph Core
        PGE[olcPixelGameEngine]:::core
        click PGE "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/olcPixelGameEngine.h"
        Example[Example Program]:::core
        click Example "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/olcExampleProgram.cpp"
    end

    subgraph Extensions
        subgraph Graphics
            G2D[Graphics2D]:::graphics
            click G2D "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_Graphics2D.h"
            G3D[Graphics3D]:::graphics
            click G3D "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_Graphics3D.h"
            Wire[Wireframe]:::graphics
            click Wire "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_Wireframe.h"
        end

        subgraph Interface
            PopUp[PopUp Menu]:::interface
            click PopUp "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_PopUpMenu.h"
            GUI[Quick GUI]:::interface
            click GUI "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_QuickGUI.h"
        end

        subgraph Features
            Sound[Sound System]:::feature
            click Sound "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_Sound.h"
            Network[Network System]:::feature
            click Network "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_Network.h"
            RayCast[Ray Casting]:::feature
            click RayCast "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_RayCastWorld.h"
            Transform[Transform View]:::feature
            click Transform "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/extensions/olcPGEX_TransformedView.h"
        end
    end

    subgraph Utilities
        Anim[Animation System]:::utility
        click Anim "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/utilities/olcUTIL_Animate2D.h"
        Camera[Camera System]:::utility
        click Camera "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/utilities/olcUTIL_Camera2D.h"
        Container[Data Management]:::utility
        click Container "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/utilities/olcUTIL_Container.h"
        DataFile[File Handling]:::utility
        click DataFile "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/utilities/olcUTIL_DataFile.h"
        Geometry[Geometry System]:::utility
        click Geometry "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/utilities/olcUTIL_Geometry2D.h"
        Palette[Color Management]:::utility
        click Palette "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/utilities/olcUTIL_Palette.h"
        QuadTree[Spatial Partitioning]:::utility
        click QuadTree "https://github.com/OneLoneCoder/olcPixelGameEngine/blob/master/utilities/olcUTIL_QuadTree.h"
    end

    %% Platform connections
    Windows --> PGE
    Linux --> PGE
    WASM --> PGE
    Other --> PGE

    %% Core connections
    PGE --> Example

    %% Extension connections
    PGE --> Graphics
    PGE --> Interface
    PGE --> Features

    %% Utility connections
    Utilities --> Extensions

    %% Styling
    classDef core fill:#2b5797,stroke:#fff,stroke-width:2px,color:#fff
    classDef graphics fill:#00a300,stroke:#fff,stroke-width:1px,color:#fff
    classDef interface fill:#2d89ef,stroke:#fff,stroke-width:1px,color:#fff
    classDef feature fill:#1e7145,stroke:#fff,stroke-width:1px,color:#fff
    classDef utility fill:#ff8c00,stroke:#fff,stroke-width:1px,color:#fff
    classDef platform fill:#666,stroke:#fff,stroke-width:1px,color:#fff
```
