# thecherno/hazel architecture

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

- Interactive diagram: https://gitdiagram.com/thecherno/hazel
- Repository: https://github.com/thecherno/hazel

## Overview

Hazel is an early-stage Windows-oriented application and rendering engine, with Hazelnut as its scene editor and Sandbox as a client application. The principal workflow is editing a project scene and its entities in Hazelnut, saving or loading that scene, then running or simulating it with rendering and managed scripts. The graph also shows the engine’s application loop, graphics backend, and 2D physics-related scene components. Wiring is limited to relationships shown in sampled source or stated by the README; unsampled subsystems are represented without speculative call edges.

Main entry points: [`Hazelnut/src/EditorLayer.cpp`](https://github.com/thecherno/hazel/blob/master/Hazelnut/src/EditorLayer.cpp) (Editor workflow), [`Hazel/src/Hazel/Core/Application.cpp`](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Core/Application.cpp) (Application loop), [`Hazel/src/Hazel/Scene/Scene.cpp`](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scene/Scene.cpp) (Scene and entities), [`Hazel/src/Hazel/Scene/SceneSerializer.cpp`](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scene/SceneSerializer.cpp) (Scene serialization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Scene editor"]
  node_hazelnut["Hazelnut app<br/>[HazelnutApp.cpp]"]
  node_editor_layer["Editor workflow<br/>[EditorLayer.cpp]"]
  node_hierarchy["Scene hierarchy"]
  node_content_browser["Content browser"]
end

subgraph group_engine["Engine runtime"]
  node_application["Application loop<br/>[Application.cpp]"]
  node_window["Window and events<br/>[WindowsWindow.cpp]"]
  node_input["Input handling<br/>[Input.h]"]
  node_imgui["ImGui layer<br/>[ImGuiLayer.cpp]"]
  node_sandbox["Sandbox client<br/>[SandboxApp.cpp]"]
end

subgraph group_scene["Scene and scripting"]
  node_project["Project settings<br/>[Project.cpp]"]
  node_scene["Scene and entities<br/>[Scene.cpp]"]
  node_components["Scene components<br/>[Components.h]"]
  node_scene_serializer["Scene serialization"]
  node_script_engine["Managed scripting<br/>[ScriptEngine.cpp]"]
  node_script_glue["Script bindings<br/>[ScriptGlue.cpp]"]
  node_script_api["C&#35; entity API<br/>[Entity.cs]"]
  node_physics["2D physics types<br/>[Physics2D.h]"]
end

subgraph group_graphics["Rendering"]
  node_renderer["Renderer<br/>[Renderer.cpp]"]
  node_renderer2d["2D renderer<br/>[Renderer2D.cpp]"]
  node_framebuffer["Editor framebuffer<br/>[Framebuffer.cpp]"]
  node_render_api["Render commands<br/>[RenderCommand.cpp]"]
  node_opengl["OpenGL backend"]
end

node_user(("Editor user"))

node_user -->|"uses"| node_hazelnut
node_hazelnut -->|"starts"| node_application
node_application -->|"creates and updates"| node_window
node_window -->|"dispatches events"| node_application
node_application -->|"runs overlay"| node_imgui
node_application -->|"initializes"| node_renderer
node_application -->|"updates layer"| node_editor_layer
node_editor_layer -->|"opens project"| node_project
node_editor_layer -->|"edits scene"| node_scene
node_editor_layer -->|"draws panel"| node_hierarchy
node_editor_layer -->|"uses browser"| node_content_browser
node_editor_layer -->|"saves and loads"| node_scene_serializer
node_editor_layer -->|"renders viewport"| node_framebuffer
node_editor_layer -->|"draws overlays"| node_renderer2d
node_hierarchy -->|"edits entities"| node_scene
node_scene -->|"stores"| node_components
node_scene -->|"has physics components"| node_physics
node_scene_serializer -->|"reads and writes"| node_scene
node_scene_serializer -->|"reads script fields"| node_script_engine
node_script_engine -->|"registers bindings"| node_script_glue
node_script_api -.->|"exposes managed calls"| node_script_glue
node_editor_layer -->|"reloads scripts"| node_script_engine
node_renderer -->|"issues commands"| node_render_api
node_render_api -->|"dispatches"| node_opengl
node_sandbox -->|"uses runtime"| node_application

click node_hazelnut "https://github.com/thecherno/hazel/blob/master/Hazelnut/src/HazelnutApp.cpp"
click node_editor_layer "https://github.com/thecherno/hazel/blob/master/Hazelnut/src/EditorLayer.cpp"
click node_hierarchy "https://github.com/thecherno/hazel/blob/master/Hazelnut/src/Panels/SceneHierarchyPanel.cpp"
click node_content_browser "https://github.com/thecherno/hazel/blob/master/Hazelnut/src/Panels/ContentBrowserPanel.cpp"
click node_application "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Core/Application.cpp"
click node_window "https://github.com/thecherno/hazel/blob/master/Hazel/src/Platform/Windows/WindowsWindow.cpp"
click node_input "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Core/Input.h"
click node_imgui "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/ImGui/ImGuiLayer.cpp"
click node_project "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Project/Project.cpp"
click node_scene "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scene/Scene.cpp"
click node_components "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scene/Components.h"
click node_scene_serializer "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scene/SceneSerializer.cpp"
click node_script_engine "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scripting/ScriptEngine.cpp"
click node_script_glue "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scripting/ScriptGlue.cpp"
click node_script_api "https://github.com/thecherno/hazel/blob/master/Hazel-ScriptCore/Source/Hazel/Scene/Entity.cs"
click node_renderer "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Renderer/Renderer.cpp"
click node_renderer2d "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Renderer/Renderer2D.cpp"
click node_framebuffer "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Renderer/Framebuffer.cpp"
click node_render_api "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Renderer/RenderCommand.cpp"
click node_opengl "https://github.com/thecherno/hazel/blob/master/Hazel/src/Platform/OpenGL/OpenGLRendererAPI.cpp"
click node_physics "https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Physics/Physics2D.h"
click node_sandbox "https://github.com/thecherno/hazel/blob/master/Sandbox/src/SandboxApp.cpp"

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_hazelnut,node_editor_layer,node_hierarchy,node_content_browser,node_user toneBlue
class node_application,node_window,node_input,node_imgui,node_sandbox toneAmber
class node_project,node_scene,node_components,node_scene_serializer,node_script_engine,node_script_glue,node_script_api,node_physics toneMint
class node_renderer,node_renderer2d,node_framebuffer,node_render_api,node_opengl toneRose
```

## Components

### Scene editor

- [Hazelnut app](https://github.com/thecherno/hazel/blob/master/Hazelnut/src/HazelnutApp.cpp): `Hazelnut/src/HazelnutApp.cpp`
- [Editor workflow](https://github.com/thecherno/hazel/blob/master/Hazelnut/src/EditorLayer.cpp): `Hazelnut/src/EditorLayer.cpp`
- [Scene hierarchy](https://github.com/thecherno/hazel/blob/master/Hazelnut/src/Panels/SceneHierarchyPanel.cpp): `Hazelnut/src/Panels/SceneHierarchyPanel.cpp`
- [Content browser](https://github.com/thecherno/hazel/blob/master/Hazelnut/src/Panels/ContentBrowserPanel.cpp): `Hazelnut/src/Panels/ContentBrowserPanel.cpp`

### Engine runtime

- [Application loop](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Core/Application.cpp): `Hazel/src/Hazel/Core/Application.cpp`
- [Window and events](https://github.com/thecherno/hazel/blob/master/Hazel/src/Platform/Windows/WindowsWindow.cpp): `Hazel/src/Platform/Windows/WindowsWindow.cpp`
- [Input handling](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Core/Input.h): `Hazel/src/Hazel/Core/Input.h`
- [ImGui layer](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/ImGui/ImGuiLayer.cpp): `Hazel/src/Hazel/ImGui/ImGuiLayer.cpp`
- [Sandbox client](https://github.com/thecherno/hazel/blob/master/Sandbox/src/SandboxApp.cpp): `Sandbox/src/SandboxApp.cpp`

### Scene and scripting

- [Project settings](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Project/Project.cpp): `Hazel/src/Hazel/Project/Project.cpp`
- [Scene and entities](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scene/Scene.cpp): `Hazel/src/Hazel/Scene/Scene.cpp`
- [Scene components](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scene/Components.h): `Hazel/src/Hazel/Scene/Components.h`
- [Scene serialization](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scene/SceneSerializer.cpp): `Hazel/src/Hazel/Scene/SceneSerializer.cpp`
- [Managed scripting](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scripting/ScriptEngine.cpp): `Hazel/src/Hazel/Scripting/ScriptEngine.cpp`
- [Script bindings](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Scripting/ScriptGlue.cpp): `Hazel/src/Hazel/Scripting/ScriptGlue.cpp`
- [C# entity API](https://github.com/thecherno/hazel/blob/master/Hazel-ScriptCore/Source/Hazel/Scene/Entity.cs): `Hazel-ScriptCore/Source/Hazel/Scene/Entity.cs`
- [2D physics types](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Physics/Physics2D.h): `Hazel/src/Hazel/Physics/Physics2D.h`

### Rendering

- [Renderer](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Renderer/Renderer.cpp): `Hazel/src/Hazel/Renderer/Renderer.cpp`
- [2D renderer](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Renderer/Renderer2D.cpp): `Hazel/src/Hazel/Renderer/Renderer2D.cpp`
- [Editor framebuffer](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Renderer/Framebuffer.cpp): `Hazel/src/Hazel/Renderer/Framebuffer.cpp`
- [Render commands](https://github.com/thecherno/hazel/blob/master/Hazel/src/Hazel/Renderer/RenderCommand.cpp): `Hazel/src/Hazel/Renderer/RenderCommand.cpp`
- [OpenGL backend](https://github.com/thecherno/hazel/blob/master/Hazel/src/Platform/OpenGL/OpenGLRendererAPI.cpp): `Hazel/src/Platform/OpenGL/OpenGLRendererAPI.cpp`

### Other components

- **Editor user**

## Connections

- Editor user → Hazelnut app: uses
- Hazelnut app → Application loop: starts
- Application loop → Window and events: creates and updates
- Window and events → Application loop: dispatches events
- Application loop → ImGui layer: runs overlay
- Application loop → Renderer: initializes
- Application loop → Editor workflow: updates layer
- Editor workflow → Project settings: opens project
- Editor workflow → Scene and entities: edits scene
- Editor workflow → Scene hierarchy: draws panel
- Editor workflow → Content browser: uses browser
- Editor workflow → Scene serialization: saves and loads
- Editor workflow → Editor framebuffer: renders viewport
- Editor workflow → 2D renderer: draws overlays
- Scene hierarchy → Scene and entities: edits entities
- Scene and entities → Scene components: stores
- Scene and entities → 2D physics types: has physics components
- Scene serialization → Scene and entities: reads and writes
- Scene serialization → Managed scripting: reads script fields
- Managed scripting → Script bindings: registers bindings
- C# entity API → Script bindings: exposes managed calls
- Editor workflow → Managed scripting: reloads scripts
- Renderer → Render commands: issues commands
- Render commands → OpenGL backend: dispatches
- Sandbox client → Application loop: uses runtime
