Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
RG_FEATURE(3)		     Library Functions Manual		   RG_FEATURE(3)

NAME
     RG_Feature -- Agar-RG feature framework

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

DESCRIPTION
     The  RG_Feature  element  performs  some  operation  on  the  surface  of a
     RG_Tile(3).   For	example,  a  `Blur'  filter  may  be  implemented  as  a
     RG_Feature.  The interface is defined by the RG_FeatureOps structure:

     typedef struct rg_feature_ops {
	     const char *type;	     /* Feature name */
	     AG_Size len;	     /* Size of structure */
	     const char *desc;	     /* Feature description */
	     int flags;
     #define RG_FEATURE_AUTOREDRAW 0x01 /* Automatic redraw on edit */

	     void (*init)(void *self, RG_Tileset *set, int flags);
	     int  (*load)(void *self, AG_DataSource *ds);
	     void (*save)(void *self, AG_DataSource *ds);
	     void (*destroy)(void *self);
	     void (*apply)(void *self, RG_Tile *tile, int x, int y);
	     void (*menu)(void *self, AG_MenuItem *menu);
	     AG_Toolbar *(*toolbar)(void *self, RG_Tileview *view);
	     AG_Window	*(*edit)(void *self, RG_Tileview *view);
     }

     The  init(),  load(), save(), destroy() and edit() operations are analogous
     to the AG_Object(3) operations  of  the  same  name.   init()  must  invoke
     RG_FeatureInit().

     The  menu()  and  toolbar() operations, where not NULL, generate and return
     AG_Menu(3) items and an AG_Toolbar(3), respectively, for the GUI.

     The apply() operation performs the actual modification on the tile.  The  x
     and y arguments are specific to the instance of this feature and may be ig-
     nored.

INTERFACE
     void RG_FeatureInit(void *feature, RG_Tileset *ts, int flags, const RG_Fea-
     tureOps *featureOps)

     void RG_FeatureAddPixmap(RG_Feature *feature, RG_Pixmap *pixmap)

     void RG_FeatureAddSketch(RG_Feature *feature, RG_Sketch *sketch)

     void RG_FeatureDelPixmap(RG_Feature *feature, RG_Pixmap *pixmap)

     void RG_FeatureDelSketch(RG_Feature *feature, RG_Sketch *sketch)

     The  RG_FeatureInit()  function  initializes  a  derivate of the RG_Feature
     structure, described by the ops structure (see "DESCRIPTION" section).  The
     following flags are defined:

     RG_FEATURE_AUTOREDRAW   Periodically redraw target tile when feature is un-
			     dergoing edition.

     Features occasionally need to reference  other  resources	in  the  current
     RG_Tileset.   The RG_FeatureAddPixmap() and RG_FeatureAddSketch() functions
     add a reference to a pixmap or sketch, respectively.  RG_FeatureDelPixmap()
     and RG_FeatureDelSketch() remove the given reference.

SEE ALSO
     RG(3), RG_Anim(3), RG_Pixmap(3), RG_Sketch(3),  RG_Texture(3),  RG_Tile(3),
     RG_Tileview(3)

Agar 1.7			December 21, 2022		   RG_FEATURE(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=RG_Feature&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help