PtCollideWidget

PtCollideWidget — checks for collisions between widgets.

Syntax

PtCollideWidget(widget, target_list, flags?)

		

Arguments

widget

The widget to check for a collision.

target_list

A list of widgets that the first argument could possibly collide with.

flags

nil

Returns

A list containing the definitions of the colliding widgets, if any. Otherwise, nil.

Description

This function checks one widget against a list of widgets to see if it occupies the same area as any of them.

Example

Gamma> require_lisp("PhotonWidgets");
"/usr/cogent/lib/PhotonWidgets.lsp"
Gamma> PtInit(nil);
t
Gamma> win = new(PtWindow);
window instance definition
Gamma> ellipse1 = new(PtEllipse);
ellipse instance def
Gamma> ellipse1.SetArea(0,0,100,100);
position instance
Gamma> ellipse2 = new(PtEllipse);
ellipse instance def
Gamma> ellipse2.SetArea(100,100,100,100);
position structure instance
Gamma> PtRealizeWidget(win);
t
Gamma> PtCollideWidget(ellipse1, list(ellipse2));
nil
Gamma> ellipse1.SetPos(50,50);
position structure instance
Gamma> PtCollideWidget(ellipse1, list(ellipse2));
list containing definition for ellipse2