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

Your graphics.h programs. Ready to run.

Write C++ and see the graphics, in your browser or inside VS Code.
Original Turbo C++ behavior, without the manual DOSBox setup.

Open the online compiler  Get the VS Code extension

No account needed to run code  ·  Optional Google cloud sync  ·  Offline build available

Browser  /  VS Code  /  Example  /  Local setup  /  Developer docs


A familiar library, a simpler start

graphics.h is Borland's classic graphics library, familiar to many students through Turbo C++. This project runs the original TCC.EXE inside DOSBox compiled to WebAssembly, so compilation and execution happen locally in your browser.

Start in the browser Stay in your editor
Open the compiler and run your first program. Install the extension and use Ctrl + Alt + N.
No installation or account required. Choose Turbo C++ or native WinBGI output.
Open online compiler Install from Marketplace

Online compiler

A code editor and graphics output, together in one workspace. Write a program, click Run, and see the result.

Online compiler with C++ source on the left and graphics output on the right
CodeMirror 6 with syntax highlighting, autocomplete, parameter hints, and function documentation.

Pick up where you left off

Sign in with Google to save files into folders and access them from another device. Signing in is optional for compiling and running code.

Online compiler showing cloud files and folders
Your programs, organised in a cloud workspace.

Explore browser features
FeatureWhat you get
Original compilerTurbo C++ 3.0 running inside DOSBox WASM
Graphics referenceEditor documentation for all 99 supported graphics.h functions
Cloud workspaceGoogle sign-in, folders, and file sync across devices
Offline supportCompile and run after the required assets have been cached
Portable buildA self-contained HTML compiler for offline use

Tip

Taking it offline? Download the standalone HTML compiler. Keep one file and run it without a server. How the standalone build works.

VS Code extension

Compile and run without leaving your editor. Install from the VS Code Marketplace, or use:

code --install-extension AlbatrossC.graphics-h-compiler

Open your C++ file and press Ctrl + Alt + N. Run and stop controls are also available in the status bar.

Turbo C++ / integrated output

Run the original compiler and view DOS graphics inside a VS Code webview. Available on Windows, macOS, and Linux.

VS Code with Turbo C++ graphics in an integrated DOSBox webview
Classic Turbo C++ behavior, alongside your source code.

WinBGI / native output

Compile with MinGW-w64 (GCC 11.5.0) and open a native graphics window. The extension installs the toolchain on first use; Linux also requires Wine.

VS Code alongside a native WinBGI graphics window
Native Windows graphics, with GCC diagnostics in the editor and Problems panel.

Turbo C++ WinBGI
Best for Original Turbo C++ programs WinBGI-compatible programs
Compiler Turbo C++ 3.0 GCC 11.5.0 / MinGW-w64
Output Integrated DOSBox webview Native Win32 window
Platforms Windows, macOS, Linux Windows; Linux via Wine
Setup No separate DOSBox installation Automatic toolchain installation; Wine on Linux

Try it

Paste this into the online compiler, or save it as a C++ file in VS Code.

#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;
}

Run locally

You will need Git, Node.js 18+, and Python 3.

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

# Install JavaScript and Python dependencies
npm install
python -m pip install -r requirements.txt

# Build the static site into dist/
npm run build

# Serve the result
npx serve dist

Open http://localhost:3000/compiler. Cloud authentication and file sync require the API services; see the developer docs for configuration.

Under the hood
LayerTechnology
Compiler engineTurbo C++ 3.0 via js-dos / DOSBox WASM
Code editorCodeMirror 6 with C++ language support
Assets and buildesbuild, Python, and Jinja2
VS Code extensionTypeScript, Webview API, MinGW-w64
HostingCloudflare Pages for the site; Workers for APIs

Developer docs

Guide Contents
Online compiler WASM integration, editor configuration, and deployment
VS Code extension Architecture, compiler modes, and packaging
Standalone build How the self-contained HTML compiler works

Found a bug or have an idea? Open an issue or send a pull request.


Built by AlbatrossC for everyone who just wants their graphics.h code to run.
If it helped, consider giving the project a star on GitHub.

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