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
RG_FEATURE(3) FreeBSD Library Functions Manual RG_FEATURE(3)

RG_FeatureAgar-RG feature framework

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

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 (), (), (), () and () operations are analogous to the AG_Object(3) operations of the same name. init() must invoke RG_FeatureInit().

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

void
RG_FeatureInit(void *feature, RG_Tileset *ts, int flags, const RG_FeatureOps *featureOps);


void
(RG_Feature *feature, RG_Pixmap *pixmap);


void
(RG_Feature *feature, RG_Sketch *sketch);


void
(RG_Feature *feature, RG_Pixmap *pixmap);


void
(RG_Feature *feature, RG_Sketch *sketch);

The () 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 undergoing edition.

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

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

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.