Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
Documentation for the libggi-based draw library
================================================================================
Requirements to use the draw library:
1. Install libggi
Installing ggi from rpm's: (SuSE, CentOS, Red Hat, etc)
============================================================
rpm -ivh libgii-0.9.2-1su100.i586.rpm libgii-devel-0.9.2-1su100.i586.rpm
rpm -ivh libggi-2.1.2-1su100.i586.rpm libggi-devel-2.1.2-1su100.i586.rpm
Installing ggi from ebuild: (Gentoo)
============================================================
emerge libggi
How to compile:
================================================================================
C Code:
============================================================
gcc draw.c your_prog.c -lggi -o your_prog
C++ Code:
============================================================
g++ draw.c your_prog.cpp -lggi -o your_prog
Functions supported by the draw library:
================================================================================
Colors:
============================================================
BLACK
AQUA
BLUE
FUCHSIA
GRAY
GREEN
LIME
MAROON
NAVY
OLIVE
PURPLE
RED
SILVER
TEAL
WHITE
YELLOW
These can be used anywhere where a color is required. They are defined in
draw.h for you. Note that you can also use integer numbers to represent
these colors. You can find out the correspondence by looking in draw.h.
Functions:
============================================================
draw_init ()
This function must be called at the beginning of the program
in order to setup the screen for rendering.
draw_close ()
This function must be called at the end of your program in
order to return control of the screen to the Linux console.
draw_clearscreen ()
This function makes the entire screen black.
draw_putpixel (int x, int y, int color)
This function puts a pixel on the screen at position (x, y)
in the color given. Use 0-15 for the colors, or use the
colors that are defined in draw.h.
draw_box (int x, int y, int width, int height, int color)
This function draws a solid box with the upper-left corner
at position (x, y) and the dimensions width x height. It
will be drawn in the color given.
draw_line (int x1, int y1, int x2, int y2, int color)
This function draws a line from point (x1, y1) to point
(x2, y2) in the color given.
draw_putc (int x, int y, char c, int color)
This function draws a single character on screen in a
single-size monospaced font. The upper-left corner will
be at position (x, y). The character will be drawn
in the color given.
draw_puts (int x, int y, char *str, color)
This function draws a string on screen in a single-size
monospaced font. The upper-left corner of the string will
be at position (x, y). The character will be drawn in the
color given.