AG_INITGRAPHICS(3)

NAME
AG_InitGraphics - agar GUI initialization

SYNOPSIS

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

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

AVAILABLE DRIVERS
As of Agar-1.6.0, the drivers included in the distribution are:

cocoa
    Integrated MacOS X Cocoa interface. See AG_DriverCocoa(3).
dummy
    A "no-op" driver which prints all low-level requests and arguments on the console. See AG_DriverDUMMY(3).
glx Integrated X Windows interface. See AG_DriverGLX(3).
sdlfb
    SDL 1.x interface (using Framebuffer). See AG_DriverSDLFB(3).
sdlgl
    SDL 1.x interface (using OpenGL). See AG_DriverSDLGL(3).
wgl Integrated MS Windows interface; see AG_DriverWGL(3).

INITIALIZATION
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. Special selectors are available to include drivers based on capabilities. "<OpenGL>" selects any driver with support for OpenGL 1.1 or later. "<SDL>" any driver based on SDL 1.x and "<FB>" any driver based on a software framebuffer.

The full list of compiled-in drivers may be obtained by calling AG_ListDriverNames(3). Driver-specific parameters may be specified as a colon-separated list enclosed in parentheses. The available options are documented on the driver's respective manual page:

    	sdlfb,sdlgl
    	<SDL>(width=640:height=480:depth=32)
    	<openGL>(stereo=1)

It is recommended that applications provide a way for the user to specify alternate drivers, for example agartest(1) accepts the [-d agar-driver] command-line arguments.

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.

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

HISTORY
An AG_InitVideo() function first appeared in Agar 1.0. It was replaced by AG_InitGraphics() in Agar 1.4.0.