# freeza222/my_hunter architecture

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

- Interactive diagram: https://gitdiagram.com/freeza222/my_hunter
- Repository: https://github.com/freeza222/my_hunter
- Video tour (about a minute): https://gitdiagram.com/freeza222/my_hunter/video

## Overview

My Hunter is a CSFML duck-shooting game. The player enters through the menu, starts play, shoots moving ducks to score, and manages lives until game over, with restart available. Runtime ownership is centered on the main loop, which dispatches input, updates gameplay, and draws screens; initialization and cleanup support that flow. README capabilities include audio, animated multiple ducks, difficulty, crosshair, and lives. Source excerpts establish most call edges; unsampled details are represented only where documented.

Main entry points: [`src/main.c`](https://github.com/freeza222/my_hunter/blob/main/src/main.c) (Game Loop), [`src/init.c`](https://github.com/freeza222/my_hunter/blob/main/src/init.c) (Game Initialization), [`src/update.c`](https://github.com/freeza222/my_hunter/blob/main/src/update.c) (Duck Movement), [`src/draw.c`](https://github.com/freeza222/my_hunter/blob/main/src/draw.c) (Screen Rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_main["Game Loop<br/>[main.c]"]
  node_events["Input Events<br/>[event.c]"]
  node_initialize["Game Initialization<br/>[init.c]"]
  node_cleanup["Resource Cleanup<br/>[destroy.c]"]
end

subgraph group_gameplay["Gameplay"]
  node_duck_motion["Duck Movement<br/>[update.c]"]
  node_duck_entities["Duck and Dog Setup<br/>[init_entities.c]"]
  node_hit_logic["Hit and Menu Logic<br/>[event.c]"]
  node_score_lives["Score and Lives<br/>[update.c]"]
end

subgraph group_presentation["Presentation"]
  node_rendering["Screen Rendering<br/>[draw.c]"]
end

subgraph group_assets["Assets and State"]
  node_asset_setup["UI and Audio Setup<br/>[init_assets.c]"]
  node_visual_assets["Sprites and Background<br/>[init.c]"]
end

subgraph group_library["Utility Library"]
  node_my_library["C Utility Library<br/>[my.h]"]
end

node_player(("Player"))

node_player -->|"starts game"| node_main
node_main -->|"initializes"| node_initialize
node_main -->|"dispatches events"| node_events
node_main -->|"updates gameplay"| node_duck_motion
node_main -->|"draws frame"| node_rendering
node_main -->|"cleans up"| node_cleanup
node_events -->|"handles clicks"| node_hit_logic
node_hit_logic -->|"resets duck"| node_duck_motion
node_hit_logic -->|"updates score"| node_score_lives
node_duck_motion -->|"decrements lives"| node_score_lives
node_initialize -->|"sets up assets"| node_asset_setup
node_initialize -->|"initializes entities"| node_duck_entities
node_initialize -->|"creates background"| node_visual_assets
node_rendering -->|"renders score lives"| node_score_lives
node_rendering -->|"renders UI assets"| node_asset_setup
node_duck_motion -->|"formats score"| node_my_library
node_player -->|"shoots and restarts"| node_events
node_player -.->|"views game"| node_rendering
node_asset_setup -.->|"loads audio"| node_duck_entities

click node_main "https://github.com/freeza222/my_hunter/blob/main/src/main.c"
click node_events "https://github.com/freeza222/my_hunter/blob/main/src/event.c"
click node_initialize "https://github.com/freeza222/my_hunter/blob/main/src/init.c"
click node_cleanup "https://github.com/freeza222/my_hunter/blob/main/src/destroy.c"
click node_duck_motion "https://github.com/freeza222/my_hunter/blob/main/src/update.c"
click node_duck_entities "https://github.com/freeza222/my_hunter/blob/main/src/init_entities.c"
click node_hit_logic "https://github.com/freeza222/my_hunter/blob/main/src/event.c"
click node_rendering "https://github.com/freeza222/my_hunter/blob/main/src/draw.c"
click node_asset_setup "https://github.com/freeza222/my_hunter/blob/main/src/init_assets.c"
click node_visual_assets "https://github.com/freeza222/my_hunter/blob/main/src/init.c"
click node_score_lives "https://github.com/freeza222/my_hunter/blob/main/src/update.c"
click node_my_library "https://github.com/freeza222/my_hunter/blob/main/lib/my/my.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_events,node_initialize,node_cleanup toneBlue
class node_duck_motion,node_duck_entities,node_hit_logic,node_score_lives toneAmber
class node_rendering toneMint
class node_asset_setup,node_visual_assets toneRose
class node_my_library,node_player toneIndigo
```

## Components

### Game Runtime

- [Game Loop](https://github.com/freeza222/my_hunter/blob/main/src/main.c): `src/main.c`
- [Input Events](https://github.com/freeza222/my_hunter/blob/main/src/event.c): `src/event.c`
- [Game Initialization](https://github.com/freeza222/my_hunter/blob/main/src/init.c): `src/init.c`
- [Resource Cleanup](https://github.com/freeza222/my_hunter/blob/main/src/destroy.c): `src/destroy.c`

### Gameplay

- [Duck Movement](https://github.com/freeza222/my_hunter/blob/main/src/update.c): `src/update.c`
- [Duck and Dog Setup](https://github.com/freeza222/my_hunter/blob/main/src/init_entities.c): `src/init_entities.c`
- [Hit and Menu Logic](https://github.com/freeza222/my_hunter/blob/main/src/event.c): `src/event.c`
- [Score and Lives](https://github.com/freeza222/my_hunter/blob/main/src/update.c): `src/update.c`

### Presentation

- [Screen Rendering](https://github.com/freeza222/my_hunter/blob/main/src/draw.c): `src/draw.c`

### Assets and State

- [UI and Audio Setup](https://github.com/freeza222/my_hunter/blob/main/src/init_assets.c): `src/init_assets.c`
- [Sprites and Background](https://github.com/freeza222/my_hunter/blob/main/src/init.c): `src/init.c`

### Utility Library

- [C Utility Library](https://github.com/freeza222/my_hunter/blob/main/lib/my/my.h): `lib/my/my.h`

### Other components

- **Player**

## Connections

- Player → Game Loop: starts game (evidence: `README.md`)
- Game Loop → Game Initialization: initializes (evidence: `src/main.c`)
- Game Loop → Input Events: dispatches events (evidence: `src/main.c`)
- Game Loop → Duck Movement: updates gameplay (evidence: `src/main.c`)
- Game Loop → Screen Rendering: draws frame (evidence: `src/main.c`)
- Game Loop → Resource Cleanup: cleans up (evidence: `src/main.c`)
- Input Events → Hit and Menu Logic: handles clicks (evidence: `src/event.c`)
- Hit and Menu Logic → Duck Movement: resets duck (evidence: `src/event.c`)
- Hit and Menu Logic → Score and Lives: updates score (evidence: `src/event.c`)
- Duck Movement → Score and Lives: decrements lives (evidence: `src/update.c`)
- Game Initialization → UI and Audio Setup: sets up assets (evidence: `src/init.c`)
- Game Initialization → Duck and Dog Setup: initializes entities (evidence: `src/init.c`)
- Game Initialization → Sprites and Background: creates background (evidence: `src/init.c`)
- Screen Rendering → Score and Lives: renders score lives (evidence: `src/draw.c`)
- Screen Rendering → UI and Audio Setup: renders UI assets (evidence: `src/draw.c`)
- Duck Movement → C Utility Library: formats score (evidence: `src/update.c`)
- Player → Input Events: shoots and restarts (evidence: `README.md`)
- Player → Screen Rendering: views game
- UI and Audio Setup → Duck and Dog Setup: loads audio
