# sheikh-hashir14/dragon-fist architecture

> Architecture diagram of the GitHub repository sheikh-hashir14/dragon-fist, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sheikh-hashir14/dragon-fist
- Repository: https://github.com/sheikh-hashir14/dragon-fist

## Overview

Dragon Fist is a desktop 2D fighting game. The player enters through the menu, selects a mode and fighter, then plays rounds of movement and combat that resolve into round and match outcomes, with the game loop rendering the scene and HUD. The README documents roster selection, CPU and local multiplayer, and custom sprites and stages; unsampled portions of main.c prevent mapping their detailed dispatch. The graph captures only relationships visible in the excerpts or README; major gameplay capabilities share the single game implementation file.

Main entry points: [`src/main.c`](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c) (Game loop), [`src/resource_dir.h`](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/resource_dir.h) (Resource locator), [`lib/raylib/include/raylib.h`](https://github.com/sheikh-hashir14/dragon-fist/blob/main/lib/raylib/include/raylib.h) (Raylib API), [`resources`](https://github.com/sheikh-hashir14/dragon-fist/tree/main/resources) (Game assets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game flow"]
  node_loop["Game loop<br/>[main.c]"]
  node_menu["Main menu<br/>[main.c]"]
  node_roster["Fighter selection<br/>[main.c]"]
  node_controls["Player controls<br/>[main.c]"]
  node_cpu["CPU opponent<br/>[main.c]"]
  node_fighter["Fighter movement<br/>[main.c]"]
  node_combat["Combat resolution<br/>[main.c]"]
  node_rounds["Round system<br/>[main.c]"]
  node_match["Match results<br/>[main.c]"]
end

subgraph group_presentation["Visuals and assets"]
  node_scene["Stage rendering<br/>[main.c]"]
  node_sprites["Fighter sprites<br/>[main.c]"]
  node_hud["Health HUD<br/>[main.c]"]
  node_assets["Game assets"]
end

subgraph group_platform["Runtime platform"]
  node_resource["Resource locator<br/>[resource_dir.h]"]
  node_raylib["Raylib API<br/>[raylib.h]"]
end

node_player(("Player"))

node_player -->|"plays"| node_loop
node_loop -->|"dispatches"| node_menu
node_menu -->|"offers selection"| node_roster
node_roster -.->|"starts match"| node_loop
node_loop -.->|"reads input"| node_controls
node_controls -.->|"drives"| node_fighter
node_loop -->|"updates opponent"| node_cpu
node_cpu -->|"provides input"| node_fighter
node_loop -->|"updates"| node_fighter
node_fighter -.->|"enables attacks"| node_combat
node_loop -->|"tracks"| node_rounds
node_rounds -->|"counts wins"| node_match
node_loop -.->|"renders"| node_scene
node_loop -->|"renders"| node_sprites
node_loop -->|"draws"| node_hud
node_loop -->|"sets asset directory"| node_resource
node_resource -->|"uses filesystem API"| node_raylib
node_loop -->|"uses graphics API"| node_raylib
node_loop -->|"loads textures"| node_assets

click node_loop "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_menu "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_roster "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_controls "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_cpu "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_fighter "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_combat "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_rounds "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_match "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_scene "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_sprites "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_hud "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c"
click node_assets "https://github.com/sheikh-hashir14/dragon-fist/tree/main/resources"
click node_resource "https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/resource_dir.h"
click node_raylib "https://github.com/sheikh-hashir14/dragon-fist/blob/main/lib/raylib/include/raylib.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_loop,node_menu,node_roster,node_controls,node_cpu,node_fighter,node_combat,node_rounds,node_match toneBlue
class node_scene,node_sprites,node_hud,node_assets toneAmber
class node_resource,node_raylib toneMint
class node_player toneIndigo
```

## Components

### Game flow

- [Game loop](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Main menu](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Fighter selection](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Player controls](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [CPU opponent](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Fighter movement](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Combat resolution](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Round system](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Match results](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`

### Visuals and assets

- [Stage rendering](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Fighter sprites](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Health HUD](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/main.c): `src/main.c`
- [Game assets](https://github.com/sheikh-hashir14/dragon-fist/tree/main/resources): `resources`

### Runtime platform

- [Resource locator](https://github.com/sheikh-hashir14/dragon-fist/blob/main/src/resource_dir.h): `src/resource_dir.h`
- [Raylib API](https://github.com/sheikh-hashir14/dragon-fist/blob/main/lib/raylib/include/raylib.h): `lib/raylib/include/raylib.h`

### Other components

- **Player**

## Connections

- Player → Game loop: plays (evidence: `readme.md`)
- Game loop → Main menu: dispatches (evidence: `readme.md`)
- Main menu → Fighter selection: offers selection (evidence: `readme.md`)
- Fighter selection → Game loop: starts match (evidence: `src/main.c`)
- Game loop → Player controls: reads input (evidence: `src/main.c`)
- Player controls → Fighter movement: drives (evidence: `src/main.c`)
- Game loop → CPU opponent: updates opponent (evidence: `src/main.c`)
- CPU opponent → Fighter movement: provides input (evidence: `src/main.c`)
- Game loop → Fighter movement: updates (evidence: `src/main.c`)
- Fighter movement → Combat resolution: enables attacks (evidence: `src/main.c`)
- Game loop → Round system: tracks (evidence: `src/main.c`)
- Round system → Match results: counts wins (evidence: `src/main.c`)
- Game loop → Stage rendering: renders (evidence: `src/main.c`)
- Game loop → Fighter sprites: renders (evidence: `src/main.c`)
- Game loop → Health HUD: draws (evidence: `src/main.c`)
- Game loop → Resource locator: sets asset directory (evidence: `src/main.c`)
- Resource locator → Raylib API: uses filesystem API (evidence: `src/resource_dir.h`)
- Game loop → Raylib API: uses graphics API (evidence: `src/main.c`)
- Game loop → Game assets: loads textures (evidence: `src/main.c`)
