<-- 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.


As of Agar-1.6.0, the drivers included in the distribution are:
cocoaIntegrated MacOS X Cocoa interface. See AG_DriverCocoa(3).
dummyA "no-op" driver which prints all low-level requests and arguments on the console. See AG_DriverDUMMY(3).
glxIntegrated X Windows interface. See AG_DriverGLX(3).
sdlfbSDL 1.x interface (using Framebuffer). See AG_DriverSDLFB(3).
sdlglSDL 1.x interface (using OpenGL). See AG_DriverSDLGL(3).
wglIntegrated MS Windows interface; see AG_DriverWGL(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. 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:

It is recommended that applications provide a way for the user to specify alternate drivers, for example agartest(1) accepts the Op Fl d Ar agar-drivercommand-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.


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


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