<-- Back to AG_Intro.3


#include <agar/core.h>
#include <agar/gui.h>


After having initialized the Agar-Core library with AG_InitCore(3), Agar-GUI applications must initialize the GUI system and select a driver.


As of Agar-1.5.0, the driver modules included in the distribution are:
glxNative X11 interface (GL); see AG_DriverGLX(3).
wglNative Microsoft Windows interface (GL); see AG_DriverWGL(3).
cocoaNative MacOS X Cocoa interface (GL); see AG_DriverCocoa(3).
sdlfbSDL 1.x interface (framebuffer); see AG_DriverSDLFB(3).
sdlglSDL 1.x interface (GL); see AG_DriverSDLGL(3).


int AG_InitGraphics (const char *drivers)

void AG_DestroyGraphics (void)

int AG_InitGUI (Uint flags)

void AG_DestroyGUI (void)

The AG_InitGraphics() function initializes the Agar GUI system. If the drivers argument is NULL (the usual case), Agar selects the "best" driver available on the current platform. If drivers is non-NULL, it should be a comma-separated list of drivers, in order of preference (the special strings "<OpenGL>" and "<SDL>" may be used to select any driver with GL or SDL capability). The list of compiled-in drivers may be obtained by calling AG_ListDriverNames(3). Driver-specific parameters (which are documented on the driver's respective manual page) may be specified as a colon-separated list between parentheses:

The AG_DestroyGraphics() routine shuts down and releases all resources allocated by the Agar-GUI library.

Alternatively, the AG_InitGUI() function initializes the Agar GUI system, but does not create a driver instance upon initialization. The caller may invoke AG_DriverOpen(3) to create one or more driver instances. For example, an X11 application that can talk to multiple X11 servers might call AG_DriverOpen() for each X11 connection.


AG_Core(3), AG_CustomEventLoop(3), AG_Driver(3), AG_EventLoop(3), AG_InitVideoSDL(3), AG_Intro(3)


The AG_InitVideo() function first appeared in Agar 1.0, and was replaced by AG_InitGraphics() in Agar 1.4.