Agar

<-- Back to AG_Intro.3

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:
cocoaMacOS X Cocoa (GL, multi-window). See AG_DriverCocoa(3).
dummyA "no-op" driver which prints all low-level requests and arguments on the console. See AG_DriverDUMMY(3).
glxX Windows (GL, multi-window). See AG_DriverGLX(3).
sdlfbSDL1 (framebuffer, single-window). See AG_DriverSDLFB(3).
sdlglSDL1 (GL, single-window). See AG_DriverSDLGL(3).
sdl2fbSDL2 (framebuffer, single-window). See AG_DriverSDL2FB(3).
sdl2glSDL2 (GL, single-window). See AG_DriverSDL2GL(3).
sdl2mwSDL2 (GL, multi-window). See AG_DriverSDL2MW(3).
wglMicrosoft Windows (GL, multi-window); 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 SDL1, "<SDL2>" any driver based on SDL2 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. Some examples:
	sdlgl,sdlfb
	<SDL>(width=640:height=480:depth=32)
	<SDL2>(width=640:height=480)
	<openGL>(stereo=1)

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.

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.
Csoft.net ElectronTubeStore