Intro
Getting Started
The first thing to do, of course, is download the GDXlib source and install it. You can always get the latest version
from http://mrgibson.com/GDXlib/.
To begin our introduction to GDXlib, we'll start with the simplest program possible. This program will create a window
200 pixels by 200 pixels.
demo.c:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
|
#include <GDXlib/GDXlib.h>
int main(int argc, char *argv[]){
x_open();
gdx_window("demo",200,200);
gdx_main();
x_close();
return 0;
}
|
You can compile the above program with gcc using:
gcc demo.c -o demo -lX11 -lXpm
line 1
All programs will of course include GDXlib/GDXlib.h which declares the variables, functions, structures, etc. that will be
used in your GDXlib application.
line 5
This line establishes a connection witht he X server.
x_open();
line 7
The next line creates a window with the title 'demo' and the deminsions of 200x200 pixels.
gdx_window("demo",200,200);
line 9
The next line enters the GDXlib main processing loop.
gdx_main();
gdx_main() is a function you will see in most GDXlib applications. When control reaches this point, GDXlib
waits for X events (such as button or key presses) to occur.