Agar


Note: The Agar manual pages follow certain conventions, notably concerning function return values. Please read AG_Intro(3) first.


SYNOPSIS

#include <agar/core.h>

DESCRIPTION

The Agar AG_Config interface provides an AG_Variable(3) interface to various Agar parameters which should remain persistent. Typically, parameters are registered as AG_Variable(3) bindings to specific global variables.

INTERFACE


int AG_ConfigFile (const char *path_key, const char *name, const char *extension, char *dst_path, size_t dst_len)

int AG_ConfigLoad (void)

int AG_ConfigSave (void)


The AG_ConfigFile() utility function searches a colon-separated pathname setting (ie. load-path) for a file with the given name and extension. If the file is found, its full pathname is copied into a target fixed-size buffer dst_path (limited to dst_len bytes). AG_ConfigFile() returns 0 on success and -1 on failure.

AG_ConfigLoad() loads the configuration data. It is equivalent to:
	AG_ObjectLoad(agConfig);

AG_ConfigSave() saves the configuration data, creating the parent directories if needed. It is equivalent to:
	AG_CreateDataDir();
	AG_ObjectSave(agConfig);

CONFIGURATION PARAMETERS

The following parameters are registered by Agar-Core:
BOOL initial-run Application is being ran for the first time (read-only).
STRING load-path Directory containing data files for the AG_Object(3) virtual filesystem, as well as the AG_Config data itself. Default is platform-dependent (ie. for systems with getpwuid(3) and getuid(3), it is $HOME/.(application-name).
STRING save-path Target directory for writing the AG_Object(3) virtual filesystem (usually the same as load-path).
STRING tmp-path Directory for temporary files.

The following parameters are registered by the Agar-GUI library:
STRING font-path Directory containing font files used by the AG_Text(3) interface, including both FreeType and bitmap fonts. Default is platform-specific.
BOOL font.freetype If Agar-GUI was compiled with FreeType support, this enables use of FreeType fonts as opposed to bitmap fonts. Default is 1 if FreeType support available, otherwise 0.
STRING font.face Default font file to use where no specific face is requested in AG_TextRender(3).
INT font.size Default font size in points.
UINT font.flags Default font flags (style, weight).


EXAMPLES

The following example sets some platform-specific font paths.
#ifdef __APPLE__
AG_PrtString(agConfig, "font-path", "%s/Library/Fonts:/Library/Fonts:"
                                    "/System/Library/Fonts",
			            getenv("HOME"));
#elif _WIN32
AG_SetString(agConfig, "font-path", "c:\\windows\\fonts");
#else
AG_PrtString(agConfig, "font-path", "%s/.fonts:"
                                    "/usr/X11R6/lib/X11/fonts/TTF",
                                    getenv("HOME"));
#endif

OBSOLETE PARAMETERS

The following parameters were used before Agar-1.4 and are now obsolete:
BOOL view.full-screen
BOOL view.opengl
UINT16 view.w
UINT16 view.h
UINT16 view.min-w
UINT16 view.min-h
UINT8 view.depth
UINT view.nominal-fps

SEE ALSO

AG_Intro(3), AG_Object(3), AG_Text(3)

HISTORY

The AG_Config interface first appeared in Agar 1.0

BUGS

The Agar-GUI parameters should be documented in a separate manual page.