1
2 /* Program to pop up a quick "OK" message box */
3
4 #include "SDL.h"
5 #include "GUI_output.h"
6
7
main(int argc,char * argv[])8 int main(int argc, char *argv[])
9 {
10 SDL_Surface *screen;
11
12 if ( argv[1] == NULL ) {
13 fprintf(stderr, "Usage: %s <message>\n", argv[0]);
14 exit(1);
15 }
16
17 /* Initialize SDL */
18 if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
19 fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
20 exit(1);
21 }
22 atexit(SDL_Quit);
23
24 /* Get a video mode for display */
25 screen = SDL_SetVideoMode(320, 200, 0, SDL_SWSURFACE);
26 if ( screen == NULL ) {
27 fprintf(stderr, "Couldn't set video mode: %s\n",SDL_GetError());
28 exit(1);
29 }
30 SDL_WM_SetCaption("Hi there!", "hiya");
31
32 /* Pop up the message and quit */
33 GUI_MessageBox(screen, "Message", argv[1], GUI_MBOK);
34 exit(0);
35 }
36