Write, compile, and run Turbo C++ graphics.h programs — in your browser or VS Code
Zero setup · No DOSBox · No installers · Works offline
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.
Smart editor, instant compilation, live graphics output — all in the browser. No account required.
✍️ Write Code → Click Run → See Output
CodeMirror 6 editor with C++ syntax highlighting, autocomplete, and inline docs for all 99 graphics.h functions.
☁️ Save Your Work to the Cloud
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 →
Two compilation backends. One keyboard shortcut. Compile and run
graphics.hprograms without leaving your editor.
⚙️ Mode 1 · Turbo C++ (DOSBox Webview)
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)
Compiles via MinGW-w64 (GCC 11.5.0) to a native executable with a real Win32 graphics window. Toolchain auto-installs on first use.
| ⚙️ 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 |
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" → InstallPaste 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.EXEfrom 1992, compiled to WebAssembly, rendering graphics in your browser.
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| 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 |
| 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.