Agar

<-- Back to AG_Intro.3

SYNOPSIS

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

DESCRIPTION

The Agar-RG library implements a feature-based pixel graphic format. The central class of the library is RG_Tileset, which acts as a container for graphics resources:
TilesTransparent graphic surfaces, generated from a set of instructions (or features). See RG_Tile(3).
AnimationsSimple 2D animations also generated from a set of instructions. See RG_Anim(3).
TexturesReferences to tiles with additional information related to texturing. See RG_Texture(3).
PixmapsTransparent graphic surfaces used internally. Pixmaps can be shared by multiple tiles. See RG_Pixmap(3).
SketchesVector drawings used internally. See RG_Sketch(3).

The RG structure also provides tiles, animations and textures with unique integer IDs, such that items can be added or removed on the fly without invalidating existing external references. To take advantage of this feature, code should reference tiles and animations using the tiletbl and animtbl members of the RG structure.

INHERITANCE HIERARCHY

AG_Object(3)-> RG_Tileset

INITIALIZATION


RG_Tileset * RG_TilesetNew (void *parent, const char *name, Uint flags)


The RG_TilesetNew() function allocates and initializes a new RG object and attaches it to parent if not NULL. There are currently no flags defined.

ACCESSING RESOURCES


RG_Tile* RGTILE (RG_Tileset *tileset, Uint32 tileID)

RG_Anim* RGANIM (RG_Tileset *tileset, Uint32 animID)

int RG_LookupTile (RG_Tileset *tileset, Uint32 tileID, RG_Tile **rTile)

int RG_LookupAnim (RG_Tileset *tileset, Uint32 animID, RG_Anim **rAnim)

RG_Tile * RG_TilesetFindTile (RG_Tileset *tileset, const char *name)

RG_Sketch * RG_TilesetFindSketch (RG_Tileset *tileset, const char *name)

RG_Pixmap * RG_TilesetFindPixmap (RG_Tileset *tileset, const char *name)

RG_Tile * RG_TilesetResvTile (RG_Tileset *tileset, const char *tileset_name, const char *name)

RG_Pixmap * RG_TilesetResvPixmap (RG_Tileset *tileset, const char *tileset_name, const char *name)


The RGTILE() and RGANIM() macros return the tile or animation of the given name. If debugging is enabled, a non-existing resource will trigger a fatal error.

RG_LookupTile() and RG_LookupAnim() search for a tile or animation with the given name. If one is found, it is returned into rTile or rAnim. The function returns 0 on success and -1 if no such tile exists.

RG_TilesetFindTile(), RG_TilesetFindSketch() and RG_TilesetFindPixmap() search for the given resource using the user-provided name string, returning a pointer to the element on success and NULL on failure. The RG_TilesetResv*() variants use the VFS path name for the RG object itself.

SEE ALSO

RG_Anim(3), RG_Feature(3), RG_Pixmap(3), RG_Sketch(3), RG_Texture(3), RG_Tile(3), RG_Tileview(3)

HISTORY

The RG library first appeared in Agar 1.3.
Csoft.net ElectronTubeStore.com