313 |
ira |
1 |
================================================================================
|
317 |
ira |
2 |
= Documentation for the libggi-based draw library =
|
|
|
3 |
================================================================================
|
313 |
ira |
4 |
|
317 |
ira |
5 |
|
313 |
ira |
6 |
Requirements to use the draw library:
|
|
|
7 |
1. Install libggi
|
|
|
8 |
|
317 |
ira |
9 |
|
313 |
ira |
10 |
Installing ggi from rpm's: (SuSE, CentOS, Red Hat, etc)
|
|
|
11 |
============================================================
|
317 |
ira |
12 |
As root, run something similar to the following:
|
|
|
13 |
|
313 |
ira |
14 |
rpm -ivh libgii-0.9.2-1su100.i586.rpm libgii-devel-0.9.2-1su100.i586.rpm
|
|
|
15 |
rpm -ivh libggi-2.1.2-1su100.i586.rpm libggi-devel-2.1.2-1su100.i586.rpm
|
|
|
16 |
|
317 |
ira |
17 |
|
313 |
ira |
18 |
Installing ggi from ebuild: (Gentoo)
|
|
|
19 |
============================================================
|
317 |
ira |
20 |
USE="fbcon" emerge libggi
|
313 |
ira |
21 |
|
|
|
22 |
|
317 |
ira |
23 |
Installing ggi from deb: (Debian)
|
|
|
24 |
============================================================
|
|
|
25 |
apt-get install libggi2
|
|
|
26 |
apt-get install libggi-target-fbdev
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
313 |
ira |
32 |
================================================================================
|
317 |
ira |
33 |
= How to compile: =
|
|
|
34 |
================================================================================
|
313 |
ira |
35 |
|
317 |
ira |
36 |
|
|
|
37 |
All Code:
|
|
|
38 |
============================================================
|
|
|
39 |
Copy draw.h and draw.c into your source folder.
|
|
|
40 |
#include "draw.h" in your source code.
|
|
|
41 |
When you compile your program, include draw.c in the compile command.
|
|
|
42 |
(See draw_test.c and draw_test.cpp for examples)
|
|
|
43 |
|
|
|
44 |
|
313 |
ira |
45 |
C Code:
|
|
|
46 |
============================================================
|
|
|
47 |
gcc draw.c your_prog.c -lggi -o your_prog
|
|
|
48 |
|
317 |
ira |
49 |
|
313 |
ira |
50 |
C++ Code:
|
|
|
51 |
============================================================
|
|
|
52 |
g++ draw.c your_prog.cpp -lggi -o your_prog
|
|
|
53 |
|
|
|
54 |
|
317 |
ira |
55 |
Test Programs: (included with this distrobution)
|
|
|
56 |
============================================================
|
|
|
57 |
cd /path/to/draw
|
|
|
58 |
make
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
313 |
ira |
64 |
================================================================================
|
317 |
ira |
65 |
= Functions supported by the draw library: =
|
|
|
66 |
================================================================================
|
313 |
ira |
67 |
|
317 |
ira |
68 |
|
313 |
ira |
69 |
Colors:
|
|
|
70 |
============================================================
|
|
|
71 |
BLACK
|
|
|
72 |
AQUA
|
|
|
73 |
BLUE
|
|
|
74 |
FUCHSIA
|
|
|
75 |
GRAY
|
|
|
76 |
GREEN
|
|
|
77 |
LIME
|
|
|
78 |
MAROON
|
|
|
79 |
NAVY
|
|
|
80 |
OLIVE
|
|
|
81 |
PURPLE
|
|
|
82 |
RED
|
|
|
83 |
SILVER
|
|
|
84 |
TEAL
|
|
|
85 |
WHITE
|
|
|
86 |
YELLOW
|
|
|
87 |
|
|
|
88 |
These can be used anywhere where a color is required. They are defined in
|
|
|
89 |
draw.h for you. Note that you can also use integer numbers to represent
|
|
|
90 |
these colors. You can find out the correspondence by looking in draw.h.
|
|
|
91 |
|
317 |
ira |
92 |
|
313 |
ira |
93 |
Functions:
|
|
|
94 |
============================================================
|
|
|
95 |
draw_init ()
|
|
|
96 |
This function must be called at the beginning of the program
|
|
|
97 |
in order to setup the screen for rendering.
|
|
|
98 |
|
|
|
99 |
draw_close ()
|
|
|
100 |
This function must be called at the end of your program in
|
|
|
101 |
order to return control of the screen to the Linux console.
|
|
|
102 |
|
|
|
103 |
draw_clearscreen ()
|
|
|
104 |
This function makes the entire screen black.
|
|
|
105 |
|
|
|
106 |
draw_putpixel (int x, int y, int color)
|
|
|
107 |
This function puts a pixel on the screen at position (x, y)
|
|
|
108 |
in the color given. Use 0-15 for the colors, or use the
|
|
|
109 |
colors that are defined in draw.h.
|
|
|
110 |
|
|
|
111 |
draw_box (int x, int y, int width, int height, int color)
|
|
|
112 |
This function draws a solid box with the upper-left corner
|
|
|
113 |
at position (x, y) and the dimensions width x height. It
|
|
|
114 |
will be drawn in the color given.
|
|
|
115 |
|
|
|
116 |
draw_line (int x1, int y1, int x2, int y2, int color)
|
|
|
117 |
This function draws a line from point (x1, y1) to point
|
|
|
118 |
(x2, y2) in the color given.
|
|
|
119 |
|
|
|
120 |
draw_putc (int x, int y, char c, int color)
|
|
|
121 |
This function draws a single character on screen in a
|
|
|
122 |
single-size monospaced font. The upper-left corner will
|
|
|
123 |
be at position (x, y). The character will be drawn
|
|
|
124 |
in the color given.
|
|
|
125 |
|
|
|
126 |
draw_puts (int x, int y, char *str, color)
|
|
|
127 |
This function draws a string on screen in a single-size
|
|
|
128 |
monospaced font. The upper-left corner of the string will
|
|
|
129 |
be at position (x, y). The character will be drawn in the
|
|
|
130 |
color given.
|
|
|
131 |
|