Jump to content

SVGALib

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Arto B (talk | contribs) at 10:04, 30 January 2018 (The past tense is more appropriate here.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

SVGALib
Original author(s)Harm Hanemaayer
Stable release
1.4.3 / June 2, 2001; 23 years ago (2001-06-02)
Preview release
1.9.25
Written inC
Operating systemLinux, FreeBSD
Platformx86, x86-64
TypeLibrary
Websitewww.svgalib.org

SVGAlib was an open-source low-level graphics library which runs on Linux and FreeBSD and allows programs to change video mode and display full-screen graphics. Some popular games like Quake and Doom have been ported to use SVGAlib.

History

The library was popular in mid-1990s.[citation needed] Toward 2000, many applications that used it migrated to X11 and SDL[citation needed], which itself can make use of SVGAlib as a video driver.

Sample

A sample of SVGAlib code is shown below.

#include <stdlib.h>
#include <unistd.h>
#include <vga.h>

int main(void)
{
   int color = 4;
   int x = 10;
   int y = 10;
   unsigned int seconds = 5;

   /* detect the chipset and give up supervisor rights */
   if (vga_init() < 0)
        return EXIT_FAILURE;

   vga_setmode(G320x200x256);
   vga_setcolor(color);
   vga_drawpixel(x, y);

   sleep(seconds);

   /* restore textmode and fall back to ordinary text console handling */
   vga_setmode(TEXT);

   return EXIT_SUCCESS;
}

See also