About graphics.h Compiler

A modern, zero-setup way to run legacy C graphics programs — directly in your browser or VS Code.

The Problem

graphics.h is a legacy BGI (Borland Graphics Interface) library that's still widely taught in Computer Graphics courses across Indian universities — especially under the SPPU (Savitribai Phule Pune University) curriculum. It was originally built for Borland's Turbo C compiler, which ran on MS-DOS in the early 1990s. If you're unfamiliar with it, check out the What is graphics.h? guide.

The problem? Running graphics.h programs in 2026 is genuinely painful. Students are forced through a maze of outdated setup steps:

  • Installing Turbo C (a compiler from the 1990s)
  • Configuring DOSBox to emulate a DOS environment
  • Dealing with resolution scaling, path issues, and crashes
  • Fighting compatibility issues on modern 64-bit Windows, macOS, and Linux
  • Losing work because Turbo C has no autosave or modern editor features

The result? Students spend more time debugging their environment than actually learning graphics programming concepts. Many give up or copy assignments without understanding the code.


The Solution

This project eliminates that entire friction. It provides two modern ways to write and run graphics.h programs instantly — no installation, no configuration, no legacy software.

🌐

Online Compiler

Write and run graphics.h programs directly in your browser. Zero setup — just open the compiler and start coding. Features include a built-in code editor, file manager, demo programs, and cloud save with Google Sign-In.

💻

VS Code Extension

Prefer coding locally? Install the VS Code extension to compile and run graphics.h programs right inside your editor with syntax highlighting.

Both approaches give the same result: your graphics.h programs run instantly, producing the correct DOS-style graphical output — circles, lines, rectangles, text, and everything else the library supports. See the full function reference.


How It Works

The online compiler runs entirely in your browser — there is no server-side compilation. It uses JS-DOS, a WebAssembly port of DOSBox, to emulate a full DOS environment right inside your browser tab. Turbo C++ 3.0 runs natively inside this emulated DOS, with graphics.h and graphics.lib fully intact.

When you click Run, your code is written into the emulated DOS filesystem, compiled by the real TCC.EXE (Turbo C compiler), and the resulting program executes immediately. The graphical output is rendered from DOSBox's emulated VGA video memory onto an HTML <canvas> element — giving you the exact DOS-style graphics output.

This means you get 100% compatibility with the original graphics.h library. Every function behaves exactly as it would in Turbo C — initgraph(), circle(), line(), setcolor(), outtextxy(), and all 40+ documented functions.

Key features of the online compiler include:

  • Built-in code editor powered by CodeMirror with C syntax highlighting
  • Client-side compilation — your code never leaves your browser
  • Cloud file storage — save your files with Google Sign-In and access from any device
  • Demo programs — start from pre-built examples to learn faster
  • Embed APIembed the compiler into your own website or blog

Tech Stack

The project is built with a modern web stack while preserving full legacy Turbo C compatibility:

  • Python (Flask)
  • JavaScript
  • HTML / CSS
  • Turbo C 3.0
  • DOSBox
  • Cloudflare Workers
  • Cloudflare D1
  • Cloudflare R2
  • Vercel
  • Google OAuth 2.0
  • CodeMirror 6

The backend is hosted on Vercel. authentication and file storage are powered by Cloudflare Workers, and the code editor uses CodeMirror 6. The full source code is available on GitHub.


Who Made This

This project was built by AlbatrossC — an SPPU student who experienced the graphics.h setup pain firsthand. Instead of accepting the status quo, I built a solution that works for everyone.

My goal is simple: let students focus on learning graphics programming, not wrestling with 1990s software. Whether you're working on your Computer Graphics lab assignments or exploring C graphics for fun, this tool is designed to make your life easier.


Open Source

The entire project is open source under the MIT license. You can view the source code, contribute features, report bugs, or fork it for your own use.


Frequently Asked Questions

Is this compiler free to use?

Yes, completely free. The online compiler and VS Code extension are both free and open source under the MIT license.

Does it support all graphics.h functions?

Yes. Since I use the actual Turbo C 3.0 compiler under the hood, every graphics.h function is supported — including circle(), line(), rectangle(), bar(), arc(), outtextxy(), and more. See the full function reference.

Do I need to install anything?

No. The online compiler works entirely in your browser. For the VS Code extension, just install it from the VS Code Marketplace.

Can I save my files?

Yes. Sign in with Google in the online compiler to save your files to the cloud and access them from any device.

Is it compatible with SPPU lab assignments?

Yes. The output is identical to what you'd get from Turbo C with DOSBox. Your assignments will produce the exact same graphical results. Check the getting started guide for more details.

Can I embed the compiler on my website?

Yes. I provide a simple JavaScript SDK for embedding. See the Embed API documentation for instructions.