# ximiyad123/fbdoom architecture

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

- Interactive diagram: https://gitdiagram.com/ximiyad123/fbdoom
- Repository: https://github.com/ximiyad123/fbdoom

## Overview

FBDOOM launches Chocolate Doom with a physical display address and dimensions, then adapts its software-rendered game frames for direct display-memory output. Its platform backend also polls Linux input devices and posts Doom key events. The README documents the framebuffer-to-fbprinter-to-/dev/mem display path; the fbprinter implementation and Chocolate Doom submodule internals were not sampled, so those components are represented at directory level and their internal behavior is not expanded.

Main entry points: [`src/fbdoom/i_video_fbdoom.c`](https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_video_fbdoom.c) (Video Interface Adapter), [`src/fbdoom/i_input_fbdoom.c`](https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_input_fbdoom.c) (Input Device Backend), [`src/chocolate-doom`](https://github.com/ximiyad123/fbdoom/tree/main/src/chocolate-doom) (Chocolate Doom Engine), [`src/main.c`](https://github.com/ximiyad123/fbdoom/blob/main/src/main.c) (Argument and Config Launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch and Configuration"]
  node_launcher["Argument and Config Launcher<br/>[main.c]"]
end

subgraph group_engine["Doom Engine"]
  node_doom["Chocolate Doom Engine"]
  node_render["Doom Software Renderer"]
end

subgraph group_platform["FBDOOM Platform"]
  node_video["Video Interface Adapter<br/>[i_video_fbdoom.c]"]
  node_frame["Frame Conversion and Scaling<br/>[i_video_fbdoom.c]"]
  node_input["Input Device Backend<br/>[i_input_fbdoom.c]"]
  node_platform_misc["Platform Stubs"]
end

subgraph group_display["Direct Display"]
  node_fbprinter_api["Framebuffer Output API<br/>[fbprinter.h]"]
  node_fbprinter["fbprinter Library"]
  node_memory[("Display Memory")]
  node_display_device["Physical Display"]
end

node_player(("Player"))
node_linux_input["Linux Input Devices"]

node_player -->|"runs with options"| node_launcher
node_launcher -->|"starts engine"| node_doom
node_doom -.->|"uses video backend"| node_video
node_render -->|"presents frames"| node_video
node_video -->|"converts and scales"| node_frame
node_video -->|"polls input"| node_input
node_input -->|"reads events"| node_linux_input
node_input -->|"posts key events"| node_doom
node_frame -->|"draws buffer"| node_fbprinter_api
node_fbprinter_api -.->|"implemented by"| node_fbprinter
node_fbprinter -->|"writes via /dev/mem"| node_memory
node_memory -->|"drives display"| node_display_device

click node_launcher "https://github.com/ximiyad123/fbdoom/blob/main/src/main.c"
click node_doom "https://github.com/ximiyad123/fbdoom/tree/main/src/chocolate-doom"
click node_render "https://github.com/ximiyad123/fbdoom/tree/main/src/chocolate-doom"
click node_video "https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_video_fbdoom.c"
click node_frame "https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_video_fbdoom.c"
click node_input "https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_input_fbdoom.c"
click node_platform_misc "https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_platform_fbdoom.c"
click node_fbprinter_api "https://github.com/ximiyad123/fbdoom/blob/main/include/fbprinter.h"
click node_fbprinter "https://github.com/ximiyad123/fbdoom/tree/main/src/fbprinter"

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_launcher toneBlue
class node_doom,node_render toneAmber
class node_video,node_frame,node_input,node_platform_misc toneMint
class node_fbprinter_api,node_fbprinter,node_memory,node_display_device toneRose
class node_player,node_linux_input toneIndigo
```

## Components

### Launch and Configuration

- [Argument and Config Launcher](https://github.com/ximiyad123/fbdoom/blob/main/src/main.c): `src/main.c`

### Doom Engine

- [Chocolate Doom Engine](https://github.com/ximiyad123/fbdoom/tree/main/src/chocolate-doom): `src/chocolate-doom`
- [Doom Software Renderer](https://github.com/ximiyad123/fbdoom/tree/main/src/chocolate-doom): `src/chocolate-doom`

### FBDOOM Platform

- [Video Interface Adapter](https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_video_fbdoom.c): `src/fbdoom/i_video_fbdoom.c`
- [Frame Conversion and Scaling](https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_video_fbdoom.c): `src/fbdoom/i_video_fbdoom.c`
- [Input Device Backend](https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_input_fbdoom.c): `src/fbdoom/i_input_fbdoom.c`
- [Platform Stubs](https://github.com/ximiyad123/fbdoom/blob/main/src/fbdoom/i_platform_fbdoom.c): `src/fbdoom/i_platform_fbdoom.c`

### Direct Display

- [Framebuffer Output API](https://github.com/ximiyad123/fbdoom/blob/main/include/fbprinter.h): `include/fbprinter.h`
- [fbprinter Library](https://github.com/ximiyad123/fbdoom/tree/main/src/fbprinter): `src/fbprinter`
- **Display Memory**
- **Physical Display**

### Other components

- **Player**
- **Linux Input Devices**

## Connections

- Player → Argument and Config Launcher: runs with options (evidence: `README.md`)
- Argument and Config Launcher → Chocolate Doom Engine: starts engine (evidence: `src/main.c`)
- Chocolate Doom Engine → Video Interface Adapter: uses video backend
- Doom Software Renderer → Video Interface Adapter: presents frames (evidence: `README.md`)
- Video Interface Adapter → Frame Conversion and Scaling: converts and scales (evidence: `src/fbdoom/i_video_fbdoom.c`)
- Video Interface Adapter → Input Device Backend: polls input (evidence: `src/fbdoom/i_video_fbdoom.c`)
- Input Device Backend → Linux Input Devices: reads events (evidence: `src/fbdoom/i_input_fbdoom.c`)
- Input Device Backend → Chocolate Doom Engine: posts key events (evidence: `src/fbdoom/i_input_fbdoom.c`)
- Frame Conversion and Scaling → Framebuffer Output API: draws buffer (evidence: `src/fbdoom/i_video_fbdoom.c`)
- Framebuffer Output API → fbprinter Library: implemented by
- fbprinter Library → Display Memory: writes via /dev/mem (evidence: `README.md`)
- Display Memory → Physical Display: drives display (evidence: `README.md`)
