1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <stdio.h>
#include <stdlib.h>
#include "libsx.h"
void quit(Widget w, void *data)
{
exit(0);
}
void draw_stuff(Widget w, int width, int height, void *data)
{
ClearDrawArea();
DrawLine(50,50, width-50, height-50); /* just draw a diagonal line */
}
int main(int argc, char **argv)
{
Widget w[2];
argc = OpenDisplay(argc, argv);
if (argc == 0) /* woops, couldn't get started */
exit(5);
/* could process our own command line options here. */
w[0] = MakeButton("Quit", quit, NULL);
w[1] = MakeDrawArea(500,500, draw_stuff, NULL);
SetWidgetPos(w[1], PLACE_UNDER, w[0], NO_CARE, NULL);
ShowDisplay();
GetStandardColors();
MainLoop(); /* off we go! */
}
|