# jorabarjomi/rpgcppraylib-public architecture

> Architecture diagram of the GitHub repository jorabarjomi/rpgcppraylib-public, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jorabarjomi/rpgcppraylib-public
- Repository: https://github.com/jorabarjomi/rpgcppraylib-public

## Overview

rpgCppRaylib is a top-down action RPG built with raylib. The principal workflow runs from the game loop into a session that handles player input, combat, enemy spawning and updates, progression, and menu actions, then renders the world and HUD. Core gameplay covers hero and skeleton behavior, shared unit stats and combat, inventory and item use, and level-up progression. Rendering supplies animated views, tiles, inventory and stats UI, and event logging; signals connect gameplay events to logs and sound. The session excerpt shows the main orchestration; unsampled modules are included only where the README or source index supports their role.

Main entry points: [`src/states/game.hpp`](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/states/game.hpp) (Game session), [`src/main.cpp`](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/main.cpp) (Application entry), [`src/core/hero/Hero.cpp`](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/hero/Hero.cpp) (Hero), [`src/core/item/itemDb.cpp`](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/itemDb.cpp) (Item database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_session["Session orchestration"]
  node_main["Application entry<br/>[main.cpp]"]
  node_session_loop["Game session<br/>[game.hpp]"]
end

subgraph group_gameplay["Gameplay domain"]
  node_hero["Hero<br/>[Hero.cpp]"]
  node_skeleton["Skeleton enemy<br/>[Skelet.cpp]"]
  node_unit["Unit stats and combat<br/>[Unit.cpp]"]
  node_random["Random number utility<br/>[random.h]"]
end

subgraph group_items["Items and inventory"]
  node_inventory["Inventory<br/>[inventory.cpp]"]
  node_item_types["Item model<br/>[item.h]"]
  node_item_database["Item database<br/>[itemDb.cpp]"]
  node_potions["Consumable potions<br/>[potion.cpp]"]
  node_rings["Equipable rings<br/>[ring.cpp]"]
end

subgraph group_presentation["Rendering and feedback"]
  node_hero_view["Hero animation<br/>[HeroView.cpp]"]
  node_skeleton_view["Skeleton animation<br/>[skeletView.cpp]"]
  node_tiles["Tile rendering<br/>[TileView.cpp]"]
  node_hud["HUD and menus<br/>[HeroHud.hpp]"]
  node_ui["UI components<br/>[Ui.hpp]"]
  node_potion_view["Potion icons<br/>[PotionView.cpp]"]
  node_textures["Texture and animation tools<br/>[TextureManager.cpp]"]
  node_logger["Event log<br/>[Logger.cpp]"]
  node_sound["Sound playback<br/>[SoundManager.hpp]"]
  node_signals["Signal observer<br/>[Observer.hpp]"]
end

node_player(("Player"))

node_player -.->|"provides input"| node_session_loop
node_main -->|"runs session"| node_session_loop
node_main -->|"loads view"| node_hero_view
node_main -->|"loads view"| node_skeleton_view
node_main -->|"loads tiles"| node_tiles
node_main -->|"loads icons"| node_potion_view
node_session_loop -->|"updates and attacks"| node_hero
node_session_loop -->|"spawns and updates"| node_skeleton
node_session_loop -->|"updates and draws"| node_hero_view
node_session_loop -->|"updates and draws"| node_skeleton_view
node_session_loop -->|"draws tiles"| node_tiles
node_session_loop -->|"draws menus"| node_hud
node_session_loop -->|"updates and draws"| node_logger
node_session_loop -->|"plays effects"| node_sound
node_session_loop -->|"creates starting items"| node_item_database
node_session_loop -->|"passes inventory icons"| node_potion_view
node_session_loop -->|"reads slots and uses items"| node_inventory
node_hero -->|"inherits combat stats"| node_unit
node_skeleton -->|"inherits combat stats"| node_unit
node_hero -->|"owns inventory"| node_inventory
node_inventory -->|"stores items"| node_item_types
node_item_database -->|"constructs item types"| node_potions
node_item_database -->|"constructs item types"| node_rings
node_potions -->|"implements item"| node_item_types
node_rings -->|"implements item"| node_item_types
node_hero -->|"emits gameplay events"| node_signals
node_session_loop -->|"connects hero events"| node_signals
node_signals -->|"routes log events"| node_logger
node_signals -->|"routes sound events"| node_sound
node_hero_view -->|"reads hero state"| node_hero
node_skeleton_view -->|"reads enemy state"| node_skeleton
node_hero_view -->|"uses animations"| node_textures
node_skeleton_view -->|"uses animations"| node_textures
node_tiles -->|"uses atlas tools"| node_textures
node_potion_view -->|"uses atlas tools"| node_textures
node_hud -->|"draws components"| node_ui
node_hud -->|"draws potion icons"| node_potion_view
node_logger -->|"uses UI components"| node_ui
node_sound -->|"varies pitch"| node_random
node_skeleton -->|"uses random behavior"| node_random
node_item_database -->|"generates random items"| node_random

click node_main "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/main.cpp"
click node_session_loop "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/states/game.hpp"
click node_hero "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/hero/Hero.cpp"
click node_skeleton "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/skelet/Skelet.cpp"
click node_unit "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/unit/Unit.cpp"
click node_hero_view "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/heroView/HeroView.cpp"
click node_skeleton_view "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/skeletView/skeletView.cpp"
click node_tiles "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/tilesView/TileView.cpp"
click node_hud "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/heroView/HeroHud.hpp"
click node_ui "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/Ui.hpp"
click node_potion_view "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/itemsView/PotionView.cpp"
click node_textures "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/TextureManager.cpp"
click node_logger "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/logger/Logger.cpp"
click node_sound "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/SoundManager.hpp"
click node_signals "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/Observer.hpp"
click node_inventory "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/hero/inventory/inventory.cpp"
click node_item_types "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/item.h"
click node_item_database "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/itemDb.cpp"
click node_potions "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/potion.cpp"
click node_rings "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/ring.cpp"
click node_random "https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/random.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_session_loop toneBlue
class node_hero,node_skeleton,node_unit,node_random toneAmber
class node_inventory,node_item_types,node_item_database,node_potions,node_rings toneMint
class node_hero_view,node_skeleton_view,node_tiles,node_hud,node_ui,node_potion_view,node_textures,node_logger,node_sound,node_signals toneRose
class node_player toneIndigo
```

## Components

### Session orchestration

- [Application entry](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/main.cpp): `src/main.cpp`
- [Game session](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/states/game.hpp): `src/states/game.hpp`

### Gameplay domain

- [Hero](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/hero/Hero.cpp): `src/core/hero/Hero.cpp`
- [Skeleton enemy](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/skelet/Skelet.cpp): `src/core/skelet/Skelet.cpp`
- [Unit stats and combat](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/unit/Unit.cpp): `src/core/unit/Unit.cpp`
- [Random number utility](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/random.h): `src/random.h`

### Items and inventory

- [Inventory](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/hero/inventory/inventory.cpp): `src/core/hero/inventory/inventory.cpp`
- [Item model](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/item.h): `src/core/item/item.h`
- [Item database](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/itemDb.cpp): `src/core/item/itemDb.cpp`
- [Consumable potions](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/potion.cpp): `src/core/item/potion.cpp`
- [Equipable rings](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/core/item/ring.cpp): `src/core/item/ring.cpp`

### Rendering and feedback

- [Hero animation](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/heroView/HeroView.cpp): `src/render/heroView/HeroView.cpp`
- [Skeleton animation](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/skeletView/skeletView.cpp): `src/render/skeletView/skeletView.cpp`
- [Tile rendering](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/tilesView/TileView.cpp): `src/render/tilesView/TileView.cpp`
- [HUD and menus](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/heroView/HeroHud.hpp): `src/render/heroView/HeroHud.hpp`
- [UI components](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/Ui.hpp): `src/render/Ui.hpp`
- [Potion icons](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/itemsView/PotionView.cpp): `src/render/itemsView/PotionView.cpp`
- [Texture and animation tools](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/TextureManager.cpp): `src/render/TextureManager.cpp`
- [Event log](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/logger/Logger.cpp): `src/render/logger/Logger.cpp`
- [Sound playback](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/SoundManager.hpp): `src/render/SoundManager.hpp`
- [Signal observer](https://github.com/jorabarjomi/rpgcppraylib-public/blob/main/src/render/Observer.hpp): `src/render/Observer.hpp`

### Other components

- **Player**

## Connections

- Player → Game session: provides input
- Application entry → Game session: runs session (evidence: `src/main.cpp`)
- Application entry → Hero animation: loads view (evidence: `src/main.cpp`)
- Application entry → Skeleton animation: loads view (evidence: `src/main.cpp`)
- Application entry → Tile rendering: loads tiles (evidence: `src/main.cpp`)
- Application entry → Potion icons: loads icons (evidence: `src/main.cpp`)
- Game session → Hero: updates and attacks (evidence: `src/states/game.hpp`)
- Game session → Skeleton enemy: spawns and updates (evidence: `src/states/game.hpp`)
- Game session → Hero animation: updates and draws (evidence: `src/states/game.hpp`)
- Game session → Skeleton animation: updates and draws (evidence: `src/states/game.hpp`)
- Game session → Tile rendering: draws tiles (evidence: `src/states/game.hpp`)
- Game session → HUD and menus: draws menus (evidence: `src/states/game.hpp`)
- Game session → Event log: updates and draws (evidence: `src/states/game.hpp`)
- Game session → Sound playback: plays effects (evidence: `src/states/game.hpp`)
- Game session → Item database: creates starting items (evidence: `src/states/game.hpp`)
- Game session → Potion icons: passes inventory icons (evidence: `src/states/game.hpp`)
- Game session → Inventory: reads slots and uses items (evidence: `src/states/game.hpp`)
- Hero → Unit stats and combat: inherits combat stats
- Skeleton enemy → Unit stats and combat: inherits combat stats
- Hero → Inventory: owns inventory
- Inventory → Item model: stores items
- Item database → Consumable potions: constructs item types
- Item database → Equipable rings: constructs item types
- Consumable potions → Item model: implements item
- Equipable rings → Item model: implements item
- Hero → Signal observer: emits gameplay events
- Game session → Signal observer: connects hero events (evidence: `src/states/game.hpp`)
- Signal observer → Event log: routes log events
- Signal observer → Sound playback: routes sound events
- Hero animation → Hero: reads hero state
- Skeleton animation → Skeleton enemy: reads enemy state
- Hero animation → Texture and animation tools: uses animations
- Skeleton animation → Texture and animation tools: uses animations
- Tile rendering → Texture and animation tools: uses atlas tools
- Potion icons → Texture and animation tools: uses atlas tools
- HUD and menus → UI components: draws components (evidence: `src/render/heroView/HeroHud.hpp`)
- HUD and menus → Potion icons: draws potion icons (evidence: `src/render/heroView/HeroHud.hpp`)
- Event log → UI components: uses UI components
- Sound playback → Random number utility: varies pitch (evidence: `src/render/SoundManager.hpp`)
- Skeleton enemy → Random number utility: uses random behavior
- Item database → Random number utility: generates random items
