SDL_bgi 3.0.2

SDL_bgi is a graphics library (`GRAPHICS.H`) for C, C++, WebAssembly, and Python. SDL_bgi is fully compatible with BGI, the Borland Graphics Interface that was the de-facto standard in PC graphics back in DOS days. It's very easy to use, pretty fast, and it also provides extensions for ARGB colours, mouse support, vector fonts, and turtle graphics. It should run on any platform supported by SDL2.

Tags c library graphics x11 sdl2 bgi python3
License Zlib
State stable

Recent Releases

3.0.201 May 2024 07:53 minor bugfix: Variable PALETTE_SIZE accessible again; added clearmouseclick(); initwindow() extended; added 'bgicc' script; updated documentation and demo programs; MSYS2: UCRT64 is the new default environment; improved portability in Makefile
3.0.014 Dec 2022 16:37 major feature: New major release: added Python support (sdl_bgi.py); added doc/howto_Python.md, demo/*.py; fixed compatibility bugs in detectgraph(), gettextsettings(), getfillsettings(), drawpoly(), fillpoly(), setcolor(), lastkey(); changed definition of 'struct palettetype' (compatibility); added colorname(), kdelay(); _putpixel() renamed as fputpixel() (Python compatibility); extended initwindow() (WinBGIm compatibility); modified Windows Makefiles.
2.6.001 Jun 2022 08:02 major feature: New major release. New web page; Emscripten support: unmodified SDL_bgi programs can be compiled to WebAssembly embedded in html pages; added test/Makefile.emscripten, test/emcc.sh, doc/emscripten.md, doc/emscripten.pdf; added support for "environment files" (Emscripten replacement for environment variables); added getclick(), doubleclick(); extended mouseclick(); updated Windows Makefiles to SDL2-2.0.22
2.5.101 Mar 2022 07:14 major feature: Fixed bug in getch(); added copysurface(), lastkey(); added test/loadimage.c (demo for SDL2_image and copysurface()); added test/pdj.c (demo for lastkey()); modified build.sh to to run on GNU/Linux only; renamed as mkpkg.sh to avoid confusion; added support for the tcc compiler (GNU/Linux only); added test/tccrun; modified CMakeList.txt; documentation: added doc/howto_AppImage.md, doc/howto_AppImage.pdf, doc/README.md; minor updates; added doc/icon.png
2.5.020 Sep 2021 08:09 major feature: Fixed kbhit() bug on MSYS2 (at last!); fixed minor bug in setallpalette(); fixed test/fern.c for TC compatibility; modified functions putpixel(), setbkcolor(), setcolor(), setfillpattern(), setfillstyle(), setpalette(), and setalpha() to handle colours given as out of range numbers; modified setallpalette() and setfillstyle() to implement error checks as in TC; simplified floodfill() function (implemented recursive version); improved setpalette() to change currently drawn pixels; modified delay() to take events into account; modified resizepalette(); added getrgbpalette(), setallrgbpalette(), and RGBPALETTE(); added test program test/rgbpalette.c; implemented getwindowwidth() and getwindowheight() as macros for WinBGIm compatibility; removed test program test/setpalette.c; updated Windows Makefiles to SDL2-2.0.16; documentation updates
2.4.404 May 2021 06:54 minor bugfix: Fixed bug that affected floodfill() with fill patterns in rare cases.
2.4.325 Feb 2021 07:10 major feature: Modified getscreensize() behaviour; added setwintitle(); added man page (graphics.3); documentation fixes and updates; updated Windows Makefiles to SDL2-2.0.14 and latest releases of Code::Blocks and DevCpp.
2.4.211 Nov 2020 10:27 major feature: Implemented native vector fonts, compatible with Borland .CHR fonts; implemented long-forgotten graphics error checks; added resetwinoptions(), getscreensize(), edelay(), getmaxheight(), getmaxwidth(), resizepalette(); added undocumented clearviewport() in setbkcolor(); changed setwinoptions() to reset options for newly created windows; fixed .CHR font loading on Windows; fixed graphresult() to provide actual error codes; fixed subtle bug in outtextxy() (CP must not be moved); fixed compatibility in getpalette(), getpalettesize(), setallpalette(), setusercharsize(); fixed setrgbpalette() to avoid out of range errors; improved fill patterns; documentation updates.
2.4.108 Aug 2020 06:33 major feature: Much simplified macOS installation; update to latest MSYS2, Code::Blocks, and Dev-C++; extended setpalette(); added initpalette(); added more Hershey fonts; preliminary .CHR font support; minor bug fixes; documentation updates.
2.4.020 Feb 2020 07:51 major feature: This release has Hershey font support as a replacement for the original Borland.chr fonts; added getlinebuffer() and putlinebuffer(); several bugfixes and minor improvements.
2.3.120 Jan 2020 08:29 major bugfix: Added getbuffer(), putbuffer(), COLOR32(), and colorRGB (macro) for faster pixel manipulation; added showinfobox(), getleftclick(), getmiddleclick(), and getrightclick(); documentation updates and improvements; added test/bgidemo.c; code cleanup.
2.3.001 Aug 2019 06:23 major bugfix: Added 'auto mode' to perform automatic screen refresh when using initgraph(); this provides a huge performance boost. Fixed minor bugs and added compatibility with C++.
2.2.416 Nov 2018 07:55 major bugfix: Added some graphics modes for better compatibility with old programs; fixed bug in setvisualpage(); minor fix in getch(); fix in putimage() bitwise operations; modified readimagefile() again (reported by Carlos Gustavo Ramirez Rodriguez); added test/kaleido.c; added savestate() and restorestate() in turtle.c; documentation updates and improvements.
2.2.318 Sep 2018 11:46 major feature: This release fixes a bug in setalpha() and provides a new implementation of readimagefile().
2.2.211 Sep 2018 08:29 major feature: In this release: documentation updates (clarification on colours); constants TMP_FG_COL, TMP_BG_COL, and TMP_FILL_COL added.
2.2.113 Aug 2018 08:41 major feature: In this release: renamed getch() to bgi_getch() and added the macro getch() to avoid Mingw bug; delay() rewritten to take care of key presses; fixed bug in BLUE_VALUE(), GREEN_VALUE(), RED_VALUE(), setalpha(); added ALPHA_VALUE(); added test/psychedelia.c; code revision and cleanup.
2.2.018 Jul 2018 12:14 major feature: In this release: support for multiple windows (extended initwindow(), added getcurrentwindow(), setcurrentwindow(), and closewindow()); added setwinoptions() for window title, position, and SDL flags; SDL_QUIT support in getch(), getevent(), kbhit(), xkbhit().
2.1.205 Jun 2018 10:20 minor feature: In this release: Dev-C++ support on Windows; documentation updates; code improvement in test programs.
2.1.128 May 2018 14:00 minor feature: This release adds Code::Blocks support on Windows.
2.1.002 Jan 2018 13:29 minor feature: This release adds CMake support for GNU/Linux and Makefile support for Windows (MSYS2 + mingw-w64) and Mac OS X.
2.0.815 Nov 2016 14:25 minor bugfix: This release fixes a minor bug in palette handling.
2.0.709 Nov 2016 12:52 minor bugfix: This release fixes a minor bug in event() and implements eventtype().
2.0.601 Mar 2016 07:06 minor bugfix: This release fixes a bug in writeimagefile(), implements clipping in readimagefile(), extends turtle graphics, and improves the documentation.
2.0.523 Dec 2015 09:03 minor bugfix: This release implements fill patterns in fillpoly() and fixes a minor bug in getch(). SDL_bgi is now functionally complete.
2.0.402 Dec 2015 10:56 minor bugfix: This release improves the functions ellipse() and kbhit(), and adds xkbhit(). Graphics is now implemented using an array of SDL_Surfaces instead of system RAM.
2.0.328 Sep 2015 07:32 major feature: This release provides minimal dos.h and conio.h, fixes minor issues with kbhit(), and implement screen refreshes in kbhit() and getch() for improved compatibility with old programs.
2.0.203 Jun 2015 12:38 major feature: This release implements fill patterns, setfillpattern(), getfillpattern(), and writeimagefile(). The documentation was updated.
2.0.112 May 2015 07:01 major feature: This release implements line patterns and floodfill () improvements. The documentation was updated.
2.0.007 May 2015 10:13 major feature: This release has been rewritten to use SDL2 only (no more SDL_gfx dependency). Some minor enhancements were also implemented.
1.0.111 Dec 2014 08:25 major bugfix: This release fixes some bugs in putpixel(), getimage(), putimage(), and kbhit().
1.0.007 Nov 2014 10:29 major feature: This is the initial release of SDL_bgi.