313 |
ira |
1 |
Documentation for the libggi-based draw library
|
|
|
2 |
================================================================================
|
|
|
3 |
|
|
|
4 |
Requirements to use the draw library:
|
|
|
5 |
1. Install libggi
|
|
|
6 |
|
|
|
7 |
Installing ggi from rpm's: (SuSE, CentOS, Red Hat, etc)
|
|
|
8 |
============================================================
|
|
|
9 |
rpm -ivh libgii-0.9.2-1su100.i586.rpm libgii-devel-0.9.2-1su100.i586.rpm
|
|
|
10 |
rpm -ivh libggi-2.1.2-1su100.i586.rpm libggi-devel-2.1.2-1su100.i586.rpm
|
|
|
11 |
|
|
|
12 |
Installing ggi from ebuild: (Gentoo)
|
|
|
13 |
============================================================
|
|
|
14 |
emerge libggi
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
How to compile:
|
|
|
18 |
================================================================================
|
|
|
19 |
|
|
|
20 |
C Code:
|
|
|
21 |
============================================================
|
|
|
22 |
gcc draw.c your_prog.c -lggi -o your_prog
|
|
|
23 |
|
|
|
24 |
C++ Code:
|
|
|
25 |
============================================================
|
|
|
26 |
g++ draw.c your_prog.cpp -lggi -o your_prog
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
Functions supported by the draw library:
|
|
|
30 |
================================================================================
|
|
|
31 |
|
|
|
32 |
Colors:
|
|
|
33 |
============================================================
|
|
|
34 |
BLACK
|
|
|
35 |
AQUA
|
|
|
36 |
BLUE
|
|
|
37 |
FUCHSIA
|
|
|
38 |
GRAY
|
|
|
39 |
GREEN
|
|
|
40 |
LIME
|
|
|
41 |
MAROON
|
|
|
42 |
NAVY
|
|
|
43 |
OLIVE
|
|
|
44 |
PURPLE
|
|
|
45 |
RED
|
|
|
46 |
SILVER
|
|
|
47 |
TEAL
|
|
|
48 |
WHITE
|
|
|
49 |
YELLOW
|
|
|
50 |
|
|
|
51 |
These can be used anywhere where a color is required. They are defined in
|
|
|
52 |
draw.h for you. Note that you can also use integer numbers to represent
|
|
|
53 |
these colors. You can find out the correspondence by looking in draw.h.
|
|
|
54 |
|
|
|
55 |
Functions:
|
|
|
56 |
============================================================
|
|
|
57 |
draw_init ()
|
|
|
58 |
This function must be called at the beginning of the program
|
|
|
59 |
in order to setup the screen for rendering.
|
|
|
60 |
|
|
|
61 |
draw_close ()
|
|
|
62 |
This function must be called at the end of your program in
|
|
|
63 |
order to return control of the screen to the Linux console.
|
|
|
64 |
|
|
|
65 |
draw_clearscreen ()
|
|
|
66 |
This function makes the entire screen black.
|
|
|
67 |
|
|
|
68 |
draw_putpixel (int x, int y, int color)
|
|
|
69 |
This function puts a pixel on the screen at position (x, y)
|
|
|
70 |
in the color given. Use 0-15 for the colors, or use the
|
|
|
71 |
colors that are defined in draw.h.
|
|
|
72 |
|
|
|
73 |
draw_box (int x, int y, int width, int height, int color)
|
|
|
74 |
This function draws a solid box with the upper-left corner
|
|
|
75 |
at position (x, y) and the dimensions width x height. It
|
|
|
76 |
will be drawn in the color given.
|
|
|
77 |
|
|
|
78 |
draw_line (int x1, int y1, int x2, int y2, int color)
|
|
|
79 |
This function draws a line from point (x1, y1) to point
|
|
|
80 |
(x2, y2) in the color given.
|
|
|
81 |
|
|
|
82 |
draw_putc (int x, int y, char c, int color)
|
|
|
83 |
This function draws a single character on screen in a
|
|
|
84 |
single-size monospaced font. The upper-left corner will
|
|
|
85 |
be at position (x, y). The character will be drawn
|
|
|
86 |
in the color given.
|
|
|
87 |
|
|
|
88 |
draw_puts (int x, int y, char *str, color)
|
|
|
89 |
This function draws a string on screen in a single-size
|
|
|
90 |
monospaced font. The upper-left corner of the string will
|
|
|
91 |
be at position (x, y). The character will be drawn in the
|
|
|
92 |
color given.
|
|
|
93 |
|