# fafato1/tictac architecture

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

- Interactive diagram: https://gitdiagram.com/fafato1/tictac
- Repository: https://github.com/fafato1/tictac

## Overview

##### Project Type and Purpose
- This is a *game template* / *framework* built with CMake that:
- Fetches and builds the external raylib engine
- Compiles your game code (in C or C++)
- Loads assets from an assets folder
- It provides a simple example (`main.cpp`) showing how to bootstrap raylib and use the Core/UI modules.

##### File Structure
- Top-level:
- CMakeLists.txt + CMakeSettings.json → build system
- README.md, LICENSE → docs/legal
- assets/ → image, sound, other runtime resources
- sources/ → your game’s source code
- Under sources/:
- Core/ → game-logic classes (Core, Game)
- UI/ → UI framework (UIManager, BaseUI, Screens)
- lib/ → small helper (resource_dir.h)
- main.cpp → entry point, instantiates Core & UI
- CMake FetchContent will pull raylib, link it into the build alongside your sources.

##### README Insights
- It explains:
- How raylib is fetched and compiled
- Asset‐path macro (ASSETS_PATH) for runtime loading
- Switching between C and C++

a. Main Components
1. Build System Layer
- CMake (CMakeLists.txt + CMakeSettings.json)
- FetchContent → raylib (external)
2. Runtime Engine Layer
- raylib library
3. Application Layer
- main.cpp (EntryPoint)
- Core Module
- UI Module
- assets folder
b. Relationships & Interactions
- Build System → compiles → raylib + your sources
- main.cpp → initializes → raylib window & context
- main.cpp → uses → Core API (Game loop, state)
- Core Module ↔ UI Module (Core updates game state; UIManager renders screens based on state)
- Both Core and UI → request assets → via ASSETS_PATH → assets/
c. Architectural Patterns / Principles
- Layered architecture:
- Build / infrastructure (CMake, raylib)
- Domain logic (Core / Game)
- Presentation (UI, Screens)
- Separation of concerns: game logic vs. UI vs. build orchestration
- Modular design: private/public headers, clear module boundaries
d. Key Technologies / Frameworks
- CMake + FetchContent
- raylib (graphics/audio/input engine)
- Standard C / C++ (switchable via CMake)

##### Putting It All Together
- Under Runtime, place “Application”:
- A central “main.cpp” node
- To the left, “Core Module” (Core.h/.cpp, Game.h/.cpp)
- To the right, “UI Module” (UIManager, BaseUI, Screens)
- Core and UI to main.cpp; connect both to Assets

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Build System Layer"
        CMake["CMakeLists.txt"]:::external
        CMakeSettings["CMakeSettings.json"]:::external
    end

    CMake -->|"FetchContent & compile"| Raylib["raylib (external)"]:::external
    CMake -->|"compile sources"| ProjectSources["Project Sources"]:::external

    Raylib -->|"runtime engine"| ApplicationLayer[/"Application Layer"/]
    ProjectSources --> ApplicationLayer

    subgraph ApplicationLayer
        Main["main.cpp"] 
        subgraph "Core Module"
            CoreH["Core.h"]:::domain
            GameH["Game.h"]:::domain
            CoreCPP["Core.cpp"]:::domain
            GameCPP["Game.cpp"]:::domain
        end
        subgraph "UI Module"
            UIManagerH["UIManager.h"]:::ui
            BaseUIH["BaseUI.h"]:::ui
            UIManagerCPP["UIManager.cpp"]:::ui
            BaseUICPP["BaseUI.cpp"]:::ui
            subgraph "Screens"
                GameScreenH["GameScreen.h"]:::ui
                GameScreenCPP["GameScreen.cpp"]:::ui
            end
        end
        ResourceDir["resource_dir.h"]:::domain
        Assets["assets/"]:::assets
    end

    ProjectSources --> Main
    Main -->|"initialize"| Raylib
    Main -->|"uses Core API"| CoreH
    Main -->|"uses UI API"| UIManagerH

    CoreH <-->|"state/render"| UIManagerH

    CoreH -->|"ASSETS_PATH"| ResourceDir
    UIManagerH -->|"ASSETS_PATH"| ResourceDir
    ResourceDir -->|"resource path"| Assets

    classDef external fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef domain fill:#90EE90,stroke:#333,stroke-width:1px
    classDef ui fill:#FFA500,stroke:#333,stroke-width:1px
    classDef assets fill:#FFFF00,stroke:#333,stroke-width:1px

    click CMake "https://github.com/fafato1/tictac/blob/main/CMakeLists.txt"
    click CMakeSettings "https://github.com/fafato1/tictac/blob/main/CMakeSettings.json"
    click Main "https://github.com/fafato1/tictac/blob/main/sources/main.cpp"
    click CoreH "https://github.com/fafato1/tictac/blob/main/sources/Core/Public/Core.h"
    click GameH "https://github.com/fafato1/tictac/blob/main/sources/Core/Public/Game.h"
    click CoreCPP "https://github.com/fafato1/tictac/blob/main/sources/Core/Private/Core.cpp"
    click GameCPP "https://github.com/fafato1/tictac/blob/main/sources/Core/Private/Game.cpp"
    click UIManagerH "https://github.com/fafato1/tictac/blob/main/sources/UI/Public/UIManager.h"
    click BaseUIH "https://github.com/fafato1/tictac/blob/main/sources/UI/Public/BaseUI.h"
    click UIManagerCPP "https://github.com/fafato1/tictac/blob/main/sources/UI/Private/UIManager.cpp"
    click BaseUICPP "https://github.com/fafato1/tictac/blob/main/sources/UI/Private/BaseUI.cpp"
    click GameScreenH "https://github.com/fafato1/tictac/blob/main/sources/UI/Screens/Public/GameScreen.h"
    click GameScreenCPP "https://github.com/fafato1/tictac/blob/main/sources/UI/Screens/Private/GameScreen.cpp"
    click Assets "https://github.com/fafato1/tictac/tree/main/assets/"
    click ResourceDir "https://github.com/fafato1/tictac/blob/main/sources/lib/resource_dir.h"
```
