GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MAP(3) FreeBSD Library Functions Manual MAP(3)

MAPagar feature-based tile map

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

The Agar MAP library implements a map of fixed-size tiles which allow different elements to be stacked. Built-in element types include:

MAP_ITEM_TILE
Graphical surface (rendered RG_Tile(3) element).
MAP_ITEM_IMG
Graphical surface (image file reference).
MAP_ITEM_LINK
Reference to some other node, possibly on another map.

In addition to the built-in (static) elements, dynamic map objects (instances of MAP_Object(3) or subclasses thereof) may be attached to the MAP and in the case of graphical elements, rendered either in 2D or 3D.

For 3D purposes, graphical tiles define a height h and a z coordinate (where z = 0 is referred to as the of the map).

Graphical tiles also define two 2D displacements (in pixels) of the image from the tile's origin, a typically set by the developer as part of the design (although usable programmatically to produce effects), and the for real-time animation purposes. If the map is drawn to a different scale than 1:1, the centering offset will be scaled to the new tile size, but the motion offset will not.

A chain of graphical transformations can be applied per tile. The rendering engine (i.e., the MAP_View(3) widget) will maintain a cache of transformed tiles in graphics memory for best efficiency.

AG_Object(3) -> MAP.

MAP *
(void *parent, const char *name);


int
(MAP *map, Uint w, Uint h);


void
(MAP *map);


void
(MAP *map, int camera, Uint factor);

() allocates, initializes and attaches a new map.

() allocates w x h nodes, assuming that no node is currently allocated. MAP_AllocNodes() returns 0 on success or -1 on failure. The maximum allowable geometry is defined by MAP_WIDTH_MAX and MAP_HEIGHT_MAX.

The () routine releases the nodes allocated by map. The map must be locked.

() reallocates the nodes arrays, initializing the new nodes and freeing the excess ones. MAP_Resize() returns 0 on sucess or -1 on failure.

() sets the zoom factor for a given map view. Actors are displayed to this scale.

void
MAP_NodeInit(MAP_Node *node);


void
(MAP *map, MAP_Node *node);


int
(MAP *map, AG_DataSource *ds, MAP_Node *node);


void
(const MAP *map, AG_DataSource *ds, const MAP_Node *node);

() initializes the node structure. MAP_NodeDestroy() frees all resources allocated by node.

() loads the contents of node (presumed initialized and empty), from data source ds. MAP_NodeSave() saves the contents of node to ds. Both functions are called implicitely by the () and () operations of MAP.

void
MAP_ItemInit(MAP_Item *mi);


void
(MAP *map, MAP_Item *mi);

() initializes the mi structure. MAP_ItemDestroy() frees all resources allocated for mi.

void
MAP_MoveItem(MAP *mapSrc, MAP_Node *nodeSrc, MAP_Item *miSrc, MAP *mapDst, MAP_Node *nodeDst, int layerDst);


MAP_Item *
(const MAP_Item *miSrc, MAP *mapDst, MAP_Node *nodeDst, int layerDst);


void
(MAP *map, MAP_Node *node, MAP_Item *mi);


MAP_Item *
(MAP *map, MAP_Node *node, RG_Tileset *ts, Uint tileID);


MAP_Link *
(MAP *map, MAP_Node *nodeDst, const char *targetMap, int x, int y, Uint8 dir);

() moves item miSrc from nodeSrc (of mapSrc) over to nodeDst (of mapDst).

() inserts a copy of miSrc on top of nodeDst. The copy is associated with layerDst (or -1 = the source layer).

() deletes item mi from node.

() creates a reference to the RG_Tile(3) element identified by tileID in the given RG_Tileset(3).

() Creates a link to the node x, y of targetMap. This is the pathname of the destination map (as returned by ()).

AG_Object(3), MAP_Object(3), MAP_View(3), SG_Intro(3)

The MAP class first appeared in Agar 1.0.

December 21, 2022 Agar 1.7

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.