|
wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
|
This folder contains a port of Borland's old BGIDemo Pascal sample to the wx_BGI shared library.
bgidemo.pas: the original demo logic, adapted to use the local compatibility layerGraph.pas: a FreePascal compatibility shim that maps classic Borland Graph unit calls onto wx_bgi_openglBuild the C++ library first, then build the Pascal example target.
Outputs:
build/bgidemo_pascal/bgidemo.exebuild/bgidemo_pascal/wx_bgi_opengl.dllOutputs:
build/bgidemo_pascal/bgidemobuild/bgidemo_pascal/libwx_bgi_opengl.soOutputs:
build/bgidemo_pascal/bgidemobuild/bgidemo_pascal/libwx_bgi_opengl.dylibRun the executable from the bgidemo_pascal output directory so the shared library is next to it.
Graph.pas is intended as a drop-in compatibility layer for old Pascal code that used Borland's Graph unit.
Basic reuse flow:
Graph.pas into your legacy Pascal project, or add examples/bgidemo-pascal to your FreePascal unit search path with -Fu.uses Graph; in the old source, or replace the Borland Graph unit reference with this local one.Example compile commands:
What this shim helps with:
Graph constants, types, and procedures used by many Borland graphics demosInitGraph, CloseGraph, GraphResult, and similar Borland-era callsWhat it does not automatically solve:
Dos unit logic unrelated to graphics.BGI driver files to exist on diskIf your old program uses only the Graph unit heavily, the port is usually small. If it also relies on Dos, BIOS behavior, or direct text-mode tricks, expect additional cleanup.
The demo now uses portable keyboard input provided by wx_BGI itself.
Graph.pas uses that queue for KeyPressed and ReadKey, so the waits no longer depend on FreePascal Crt input behavior.#0 first and the extended scan code on the next ReadKey call.This is substantially more portable for GUI-style waits on Windows, Linux, and macOS because the input comes from the graphics window rather than the launching terminal.