# larpon/shy architecture

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

- Interactive diagram: https://gitdiagram.com/larpon/shy
- Repository: https://github.com/larpon/shy

## Overview

- CLI and Command Tools – Represented by the directories “cli” and “cmd” (which includes subcommands like “cleancode”, “complete”, “export”, etc.). This component handles parsing user commands, live coding, exporting projects, and invoking the game engine.
- Asset and Resource Management – Shown in folders like “assets” and upcoming work-in-progress features noted in the README (the assets system for loading images, sound, fonts, etc.).
- UI and Interaction Components – Represented by the “ui” folder (with buttons, events, themes, etc.) as well as components like “easy” and “ease” that might provide simplified APIs or helper functions for rapid development.
- Examples and Tests – Although these are not part of the runtime architecture, they illustrate the usage patterns and integration of the core modules. They can be noted as demonstration and verification components (“examples”, “tests”).
- Wrappers and External Libraries – The “wraps” directory (for fontstash, miniaudio, sokol, stbi, wren, etc.) highlights integrations with external libraries. This area ties the project’s V code to critical C libraries that handle low-level operations.

##### Relationships and Dependencies
- The CLI tools and commands (from “cli” and “cmd”) are the entry point for users to build, run, and export projects using the core engine.
- How the “wraps” directory serves as a bridge to external dependencies (SDL2, vab, sokol, stbi, etc.), and note that external platform-specific configuration elements (e.g., “paths”, “patches”, “platforms/wasm”) enable cross-platform support.
- That the “extras” directory (like ingrid) contributes additional tools or examples that extend the base functionality.

##### Architectural Patterns and Design Principles
- Cross-platform abstraction: Represent how different platform-specific code (in “platforms”, “export”, “paths”) is abstracted from the engine logic.
- CLI vs. Library usage: Emphasize the dual nature of the project, where one path is using the V module in one’s own game, and the other is using the CLI tool to work with builds and exports.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        CLI_Tools["CLI Tools\n(Parses commands, live coding)"]:::cli
        Command_Modules["Command Modules\n(e.g., cleancode, complete)"]:::cli
    end

    %% Game Development Core
    subgraph "Game Development Core"
        Core_Engine["Core Engine Library\n(Animation, Audio, Drawing, etc.)"]:::engine
    end

    %% Supporting Systems
    subgraph "Supporting Systems"
        Assets["Asset & Resource Management\n(Images, Sounds, Fonts)"]:::asset
        UI["UI & Interaction Components\n(UI elements, ease, easy)"]:::ui
        Wrappers["Wrappers & External Libraries\n(SDL, sokol, etc.)"]:::wrap
        Platform["Platform & Export Abstractions\n(Export, Platforms, Paths)"]:::platform
    end

    %% Supplementary
    subgraph "Supplementary"
        Examples["Examples & Tests\n(Demos and usage patterns)"]:::example
        Extras["Additional Tools & Extras\n(ingrid and demo tools)"]:::extra
    end

    %% Relationships
    CLI_Tools -->|"triggers"| Core_Engine
    Command_Modules -->|"invokes"| Core_Engine
    CLI_Tools -->|"build_export"| Platform
    Core_Engine -->|"loads_assets"| Assets
    Core_Engine -->|"renders_UI"| UI
    Core_Engine -->|"calls_wrappers"| Wrappers
    Core_Engine -->|"uses_platforms"| Platform
    Examples -->|"demonstrates_usage"| Core_Engine

    %% Click Events
    click CLI_Tools "https://github.com/larpon/shy/blob/master/cli/cli.v"
    click Command_Modules "https://github.com/larpon/shy/blob/master/cmd/cleancode.v"
    click Core_Engine "https://github.com/larpon/shy/blob/master/lib/animation.v"
    click Assets "https://github.com/larpon/shy/tree/master/assets"
    click UI "https://github.com/larpon/shy/blob/master/ui/ui.v"
    click Wrappers "https://github.com/larpon/shy/tree/master/wraps/fontstash"
    click Platform "https://github.com/larpon/shy/tree/master/platforms/wasm"
    click Examples "https://github.com/larpon/shy/tree/master/examples/hello_world"
    click Extras "https://github.com/larpon/shy/tree/master/extras/ingrid"

    %% Styles
    classDef cli fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef engine fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef asset fill:#f94144,stroke:#333,stroke-width:2px;
    classDef ui fill:#577590,stroke:#333,stroke-width:2px;
    classDef wrap fill:#f3722c,stroke:#333,stroke-width:2px;
    classDef platform fill:#43aa8b,stroke:#333,stroke-width:2px;
    classDef example fill:#277da1,stroke:#333,stroke-width:2px;
    classDef extra fill:#9b5de5,stroke:#333,stroke-width:2px;
```
