Agar
Agar 1.7 Manual

AG_InitGraphics(3)

SYNOPSIS

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

DESCRIPTION

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

AVAILABLE DRIVERS

As of Agar 1.7.0, the standard drivers included in the distribution are:
AG_DriverCocoa(3) (-d "cocoa") MacOS X with OpenGL. Multi-window.
AG_DriverDUMMY(3) (-d "dummy") No-op (prints to the debug console).
AG_DriverGLX(3) (-d "glx") X Windows with OpenGL. Multi-window.
AG_DriverSDLFB(3) (-d "sdlfb") SDL1 with framebuffer. Single-window.
AG_DriverSDLGL(3) (-d "sdlgl") SDL1 with OpenGL. Single-window.
AG_DriverSDL2FB(3) (-d "sdl2fb") SDL2 with framebuffer. Single-window. Game controllers and joysticks are supported.
AG_DriverSDL2GL(3) (-d "sdl2gl") SDL2 with OpenGL. Single-window. Game controllers and joysticks are supported.
AG_DriverSDL2MW(3) (-d "sdl2mw") SDL2 with OpenGL. Multi-window. Game controllers and joysticks are supported.
AG_DriverWGL(3) (-d "wgl") MS Windows with OpenGL. Multi-window.

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.


ElectronTubeStore Csoft.net www.libAgar.org is © 2024 Julien Nadeau Carriere <vedge@csoft.net>.
Support LibAgar: www.patreon.com/libAgar.