Skip to content

About

A modern platform for graphics.h development. Compile and run Turbo C++ graphics programs online or inside VS Code using the original TCC.EXE compiler running through WebAssembly powered DOSBox. No installers, no configuration, no legacy setup, just write code and run.

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Repository files navigation


graphics.h Compiler



Write, compile, and run Turbo C++ graphics.h programs — in your browser or VS Code

Zero setup  ·  No DOSBox  ·  No installers  ·  Works offline


Get VS Code Extension    Open Online Compiler




📖 What is this?

graphics.h is Borland's DOS-era graphics library, bundled with Turbo C++ since 1992. Three decades on, it remains a required part of the CS curriculum for hundreds of thousands of engineering students — particularly across India.

The problem is getting it to run on a modern machine. The typical path: hunt down an old installer, configure DOSBox, debug why nothing renders. You spend more time fighting the environment than writing code.

This project fixes that. It runs the real TCC.EXE (Turbo C++ 3.0) inside DOSBox compiled to WebAssembly — entirely in the browser, entirely client-side. Write code, hit Run, see graphics. Zero setup.



🌐 Online Compiler

→ graphicsh.online/compiler

Smart editor, instant compilation, live graphics output — all in the browser. No account required.


✍️ Write Code → Click Run → See Output

Editor with C++ code alongside rendered graphics output

CodeMirror 6 editor with C++ syntax highlighting, autocomplete, and inline docs for all 99 graphics.h functions.



☁️ Save Your Work to the Cloud

Cloud file storage interface with folder organisation

Sign in with Google to organise programs into folders, synced across all your devices.


 📋 Full feature list
Feature Details
🔧 Genuine Turbo C++ 3.0 Runs the real TCC.EXE inside DOSBox WASM — pixel-perfect, authentic output
📚 Full API coverage All 99 functions: initgraph, circle, arc, bar3d, floodfill, fonts, and more
✏️ Smart editor Autocomplete, parameter hints, syntax highlighting, and hover docs for every function
☁️ Cloud sync Save programs to the cloud with Google Sign-In — synced across devices
📶 Offline support Cached after first load. Compile and run with no internet connection.
📦 Standalone build Single HTML file (~8 MB) — no server, no internet needed

Tip

Need something portable? The standalone unified build is a single self-contained HTML file — download it once, run it anywhere, forever offline. Read the technical breakdown →



VS Code Extension

Two compilation backends. One keyboard shortcut. Compile and run graphics.h programs without leaving your editor.


⚙️ Mode 1 · Turbo C++ (DOSBox Webview)

VS Code with integrated DOSBox webview showing graphics output

Compiles using real Turbo C++ 3.0 in an integrated webview panel. Pixel-perfect DOS graphics — works on Windows, macOS, and Linux.



⚡ Mode 2 · WinBGI (Native Windows)

VS Code with a native Win32 graphics window

Compiles via MinGW-w64 (GCC 11.5.0) to a native executable with a real Win32 graphics window. Toolchain auto-installs on first use.


⚖️ Choosing a Mode

⚙️ Turbo C++ Mode ⚡ WinBGI Mode
Platform Windows · macOS · Linux Windows only
Output Integrated webview Native Win32 window
Compiler TCC.EXE (Turbo C++ 3.0) GCC 11.5.0 via MinGW
Compatibility 100% TCC faithful Most programs
Setup None Auto-installs toolchain
Best for Cross-platform · exact TCC output Windows · native rendering

 📋 Full feature list
Feature Details
🔀 Dual compilation Switch between Turbo C++ DOSBox and native WinBGI on the fly
🔄 Auto setup MinGW-w64 downloads and configures itself automatically on first use
⌨️ Keyboard shortcut Ctrl + Alt + N to compile and run instantly
🔴 Error diagnostics GCC errors highlighted inline in your editor and in the Problems panel
🖥️ Cross-platform Windows (native + DOSBox), macOS (DOSBox), Linux (via Wine)
📊 Status bar controls Run and stop right from the VS Code status bar

📥 Install

Get it from the VS Code Marketplace →, or:

# via terminal
code --install-extension AlbatrossC.graphics-h-compiler

# or: Ctrl+Shift+X  →  search "graphics.h compiler"  →  Install


💻 Quick Example

Paste this into the online compiler and hit Run:

#include <graphics.h>
#include <conio.h>

int main() {
    int gd = DETECT, gm;
    initgraph(&gd, &gm, "");

    setcolor(YELLOW);
    circle(320, 240, 100);              // Yellow circle

    setcolor(LIGHTCYAN);
    rectangle(200, 120, 440, 360);      // Cyan rectangle

    setcolor(LIGHTGREEN);
    line(100, 50, 540, 430);            // Green diagonal

    setcolor(WHITE);
    outtextxy(250, 420, "It works!");

    getch();
    closegraph();
    return 0;
}

That's TCC.EXE from 1992, compiled to WebAssembly, rendering graphics in your browser.



🖥️ Running Locally

Prerequisites: Git  ·  Node.js v18+  ·  Python 3

# 1. Clone
git clone https://github.com/AlbatrossC/graphics-h-compiler.git
cd graphics-h-compiler

# 2. Install dependencies & build
npm install
npm run build
# Calls build-tools/build.py → bundles everything into dist/

# 3. Serve
cd dist && npx serve .
# → http://localhost:3000/compiler


🧰 Tech Stack

Layer Technology
Compiler engine Turbo C++ 3.0 (TCC.EXE) via js-dos (DOSBox WASM)
Code editor CodeMirror 6 with C++ language support
Bundler esbuild
Build Python build script + npm
VS Code extension TypeScript, Webview API, MinGW-w64 (GCC 11.5.0)
Hosting Cloudflare Workers


🛠️ Developer Docs

Section Link Covers
Online Compiler Docs → JS-DOS WASM integration, CodeMirror config, deployment
VS Code Extension Docs → Extension architecture, Turbo C / WinBGI modes, packaging

Contributions welcome — open an issue or send a PR.




Made with frustration and love by AlbatrossC

If this saved you from a DOSBox config spiral, a ⭐ on GitHub means a lot.


About

A modern platform for graphics.h development. Compile and run Turbo C++ graphics programs online or inside VS Code using the original TCC.EXE compiler running through WebAssembly powered DOSBox. No installers, no configuration, no legacy setup, just write code and run.

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages