SDL_gui conversion guide
Version 0.9.x of SDL_gui was implemented in C.
Version 0.10.x is implemented in C++, but still includes the original C api. In order to create new widgets, you will need to use C++, however.
In order to get a 0.9.9 app to run using 0.10.0, you need to make a few changes, which are not related to the C to C++ conversion.
0.10.0 requires that SDL be initialized before calling GUI_Init. This was done to allow the application more control over how SDL is used. If SDL_ttf is used, then it also needs to be initialized before calling GUI_Init. An example follows:
/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return 1;
atexit(SDL_Quit);
/* Initialize the TTF library */
if (TTF_Init() < 0)
return 1;
atexit(TTF_Quit);
if (GUI_Init() < 0)
return 1;
Another difference which this points out is that the screen object is no longer created by the call to GUI_Init. You can use the following code to create a screen: (This must be done after the call to GUI_Init.)
GUI_Screen *screen = GUI_ScreenCreate(w, h, d, v); if (screen == NULL) return 1; GUI_SetScreen(screen);
These are the only required changes to get a 0.9.9 app to run using 0.10.0. There are other changes that can be made, which allow more control over how SDL is used, but they are not required.