# seletz/hello-zig architecture

> Architecture diagram of the GitHub repository seletz/hello-zig, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/seletz/hello-zig
- Repository: https://github.com/seletz/hello-zig

## Overview

##### Main Components

a) Application Layer
- Entry Points (hello-world.zig, triangle.zig)
- Shader Management System
- Graphics Pipeline

b) External Dependencies
- Sokol Graphics Library
- GLSL Shader Compilation Pipeline
- Build System (Zig)

**[Component Layout]**

- Application Layer   |

- Main Program  |   |

- ↓            |

- Graphics Core  |   |

- ↓            |

- ↓

- Shader Pipeline     |

- GLSL Shaders    |  |
- (triangle.glsl) |  |

- Compiled Shaders|  |
- (triangle.glsl.zig) |

- ↓

- Sokol Graphics      |
- Backend          |

##### Important Relationships to Highlight

a) Build Pipeline Flow:
- How build.zig orchestrates the compilation process
- Shader compilation flow from .glsl to .zig files
- Dependency management through build.zig.zon

b) Runtime Flow:
- Main program initialization
- Shader loading and compilation
- Graphics rendering pipeline
- Sokol integration points

##### Architectural Patterns to Emphasize

- The separation between shader code and application logic
- The build-time vs. runtime components
- The graphics pipeline abstraction layers

##### Future Extension Points

Placeholder components for planned features:
- Dynamic library loading system
- Mesh animation system
- Cross-platform compilation support

- Status indicators (implemented vs. planned features)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef app fill:#a8d1f0,stroke:#2c89c4
    classDef shader fill:#90EE90,stroke:#228B22
    classDef external fill:#FFB366,stroke:#FF8000
    classDef build fill:#D3D3D3,stroke:#808080
    classDef planned fill:#ffffff,stroke:#666666,stroke-dasharray: 5 5
    
    subgraph AppLayer["Application Layer"]
        MainProgram["Main Program"]:::app
        TriangleDemo["Triangle Demo"]:::app
        GraphicsCore["Graphics Core"]:::app
    end
    
    subgraph ShaderPipeline["Shader Pipeline"]
        GLSLShaders["GLSL Shaders"]:::shader
        CompiledShaders["Compiled Shaders"]:::shader
        ShaderBuild["Shader Build System"]:::shader
    end
    
    subgraph BuildSystem["Build System"]
        BuildConfig["Build Configuration"]:::build
        DepsConfig["Dependencies Config"]:::build
    end
    
    subgraph External["External Dependencies"]
        Sokol["Sokol Graphics Backend"]:::external
        GLSLCompiler["GLSL Compiler"]:::external
    end
    
    subgraph DevOps["Development & CI/CD"]
        IDEConfig["IDE Configuration"]:::build
        CIPipeline["CI Pipeline"]:::build
    end
    
    subgraph Planned["Planned Features"]
        direction TB
        DynLib["Dynamic Library Loading"]:::planned
        MeshAnim["Mesh Animation System"]:::planned
        CrossPlat["Cross-Platform Support"]:::planned
    end
    
    %% Relationships
    MainProgram --> GraphicsCore
    TriangleDemo --> GraphicsCore
    GraphicsCore --> Sokol
    GLSLShaders --> GLSLCompiler
    GLSLCompiler --> CompiledShaders
    CompiledShaders --> GraphicsCore
    ShaderBuild --> CompiledShaders
    BuildConfig --> ShaderBuild
    BuildConfig --> DepsConfig
    
    %% Click events
    click MainProgram "https://github.com/seletz/hello-zig/blob/develop/src/hello-world.zig"
    click TriangleDemo "https://github.com/seletz/hello-zig/blob/develop/src/triangle.zig"
    click GLSLShaders "https://github.com/seletz/hello-zig/blob/develop/src/shaders/triangle.glsl"
    click CompiledShaders "https://github.com/seletz/hello-zig/blob/develop/src/shaders/triangle.glsl.zig"
    click ShaderBuild "https://github.com/seletz/hello-zig/tree/develop/src/shaders/Makefile"
    click BuildConfig "https://github.com/seletz/hello-zig/blob/develop/build.zig"
    click DepsConfig "https://github.com/seletz/hello-zig/blob/develop/build.zig.zon"
    click CIPipeline "https://github.com/seletz/hello-zig/blob/develop/.github/workflows/CI.yml"
    click IDEConfig "https://github.com/seletz/hello-zig/tree/develop/.vscode/"
```
