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

SK_ViewEditor/display widget for Agar dimensioned 2D sketches

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

The SK_View widget displays a SK(3) sketch, and allows edition facilities to be implemented using a tool registration interface.

AG_Object(3) -> AG_Widget(3) -> SK_View.

SK_View *
(AG_Widget *parent, SK *sk, Uint flags);


void
(SK_View *skv, M_Real factor);

The () function allocates, initializes, and attaches a SK_View widget. Acceptable flags options include:

SK_VIEW_HFILL
Expand horizontally in parent container.
SK_VIEW_VFILL
Expand vertically in parent container.
SK_VIEW_EXPAND
Shorthand for SK_VIEW_HFILL | .

The () function sets the display scaling factor (1.0 = 100%).

SK_Tool *
SK_ViewRegTool(SK_View *skv, const SK_ToolOps *ops, void *arg);


void
(SK_View *skv, SK_Tool *tool, void *arg);


SK_Tool *
(SK_View *skv, const char *name);


SK_Tool *
(SK_View *skv, const SK_ToolOps *ops);


void
(SK_View *skv, SK_Tool *tool);

The () function registers a new tool class described by the ops structure, which is defined as:

typedef struct sk_tool_ops {
	const char *name;
	const char *desc;
	struct ag_static_icon *icon;
	AG_Size len;
	Uint flags;
#define SK_MOUSEMOTION_NOSNAP 0x01 /* Ignore snapping in mousemotion */
#define SK_BUTTONUP_NOSNAP    0x02 /* Ignore snapping in buttonup */
#define SK_BUTTONDOWN_NOSNAP  0x04 /* Ignore snapping in buttondown */
#define SK_BUTTON_NOSNAP      (SK_BUTTONUP_NOSNAP|SK_BUTTONDOWN_NOSNAP)
#define SK_NOSNAP             (SK_BUTTON_NOSNAP|SK_MOUSEMOTION_NOSNAP)

	void (*init)(void *tool);
	void (*destroy)(void *tool);
	void (*edit)(void *tool, void *editBox);

	int (*mousemotion)(void *tool, M_Vector3 pos, M_Vector3 vel,
	                   int btn);
	int (*mousebuttondown)(void *tool, M_Vector3 pos, int btn);
	int (*mousebuttonup)(void *tool, M_Vector3 pos, int btn);
	int (*keydown)(void *tool, int ksym, int kmod);
	int (*keyup)(void *tool, int ksym, int kmod);
} SK_ToolOps;

The name field is a unique name identifier for the tool. desc is a short description string. icon is an optional icon or NULL. len is the size of the structure describing an instance of this tool class.

The () operation initializes a new instance of a tool. () should release all resources allocated by a tool instance. The optional () operation is expected to attach arbitrary widgets to editBox, for purposes of editing tool parameters.

The low-level input device events processed by the SK_View widget are forwarded to the handler functions (), (), (), () and (). They should return 1 if some action has resulted from the event, or 0 otherwise. The coordinates passed to the () handlers are translated to actual SK(3) coordinates.

The () function selects tool as the active tool instance. The arg argument is an optional user pointer passed to the tool instance.

The () function looks up a tool instance by name. SK_ViewFindToolByOps() looks up a tool instance by class. Both functions return NULL if no match was found.

() configures a tool to be active by default when the SK_View is initially created. This is often a "select" type tool.

SK_Point *
SK_ViewOverPoint(SK_View *skv, M_Vector3 *pos, M_Vector3 *vC, void *ignoreNode);


void
(SK_View *skv, SK_Node *node, void *pData);


void *
(SK_View *skv, SK_Node *node);

The () function performs a proximity query for the given position pos, with respect to all point entities in the sketch. This function is a convenient wrapper around SK_ProximitySearch(3). The closest point is returned into the vC argument. The optional ignore argument specifies a pointer to a node that should be ignored in the search.

The () function registers a pointer to an arbitrary data structure (previously allocated with malloc(3) or AG_Malloc(3)) to be associated with a given node, using a table in the SK_View structure. This is useful for nodes that need to cache resources such as texture handles, that are specific to an SK_View instance.

() returns a pointer to the arbitrary data structure previously associated with node, or NULL if no match was found.

See the skedit(1) application (the tools directory in the Agar source distribution).

M_Matrix(3), M_Real(3), M_Vector(3), SG_Intro(3), SK(3)

The SK_View widget first appeared in Agar 1.6.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.