首页 | 主题 | 图库 | 问答 | 文摘 | 原创 | 百科

历史 | 地理 | 人物 | 艺术 | 体育 | 科学 | 音乐 | 电影 | 信息技术 | 世界遗产

 开放、中立,源自维基百科

Personal tools

SVGALib

From Wikipedia, the free encyclopedia

Jump to: navigation, search

svgalib is 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 used it in their original releases.

The library was popular in mid-1990s, but toward 2000s, most applications that used it have migrated to X11 and SDL.

The library is simple to use, as can be seen from the following code sample:

<source lang="c">

  1. include <stdlib.h>
  2. include <unistd.h>
  3. 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;

} </source>

See also

External links

Languages
AD Links