Hello.
You have to install `libsdl1.2-dev' package to obtain /usr/include/SDL/SDL.h file.
Type `make sdltest' (as I can see) and run `./sdltest' .
Here is an example with libplot (plotutils):
Code:
// C-curve.c
#include <stdio.h>
#include <plot.h>
#define MAXORDER 13
void draw_c_curve (plPlotter *plotter, double dx, double dy, int order)
{
if (order >= MAXORDER)
/* continue path along (dx, dy) */
pl_fcontrel_r (plotter, dx, dy);
else
{
draw_c_curve (plotter,
0.5 * (dx - dy), 0.5 * (dx + dy), order + 1);
draw_c_curve (plotter,
0.5 * (dx + dy), 0.5 * (dy - dx), order + 1);
}
}
int main ()
{
plPlotter *plotter;
plPlotterParams *plotter_params;
/* set a Plotter parameter */
plotter_params = pl_newplparams ();
pl_setplparam (plotter_params, "PAGESIZE", "letter");
/* `X' -- X-window, change to `ps' -- write Postscript
file to stdout
*/
if ((plotter = pl_newpl_r ("X", stdin, stdout, stderr,
plotter_params)) == NULL)
{
fprintf (stderr, "Couldn't create Plotter\n");
return 1;
}
if (pl_openpl_r (plotter) < 0) /* open Plotter */
{
fprintf (stderr, "Couldn't open Plotter\n");
return 1;
}
pl_fspace_r (plotter, 0.0, 0.0, 1000.0, 1000.0); /* set coor system */
pl_flinewidth_r (plotter, 0.25); /* set line thickness */
pl_pencolorname_r (plotter, "red"); /* use red pen */
pl_erase_r (plotter); /* erase graphics display */
pl_fmove_r (plotter, 600.0, 300.0); /* position the graphics cursor */
pl_fontname_r(plotter, "hersheysans");
pl_alabel_r (plotter,'l', 'x', "this is\\spa\\ep label!!!");
draw_c_curve (plotter, 0.0, 400.0, 0);
if (pl_closepl_r (plotter) < 0) /* close Plotter */
{
fprintf (stderr, "Couldn't close Plotter\n");
return 1;
}
if (pl_deletepl_r (plotter) < 0) /* delete Plotter */
{
fprintf (stderr, "Couldn't delete Plotter\n");
return 1;
}
return 0;
}
And Makefile:
Code:
# Makefile
LIB=/usr/X11R6/lib/
curve: C-curve.o
gcc -o curve C-curve.o -L$(LIB) -lplot -lXaw -lXmu -lXt -lXext -lX11 -lpng -lz -lm
C-curve.o: C-curve.c
gcc -c C-curve.c
clean:
rm -f *.o curve
Just type `make' (plotutils have to be installed). The ability to plot in almost any graphics format (not just X-window) is often useful.
Bye.