Documentation Set for Swarm 2.2
Prev | Reference X. Space Library | Next

# Object2dDisplay

## Name

Object2dDisplay -- Object2dDisplay displays 2d arrays of objects.

## Description

Object2dDisplay helps display 2d arrays of objects. Create a Object2dDisplay, give it a Raster widget to draw on, a Discrete2d, a message to call on each object, and (optionally) a collection of objects and it will dispatch the message to all objects with the Raster widget as an argument. In addition, Object2dDisplay can help you make probees.

## Protocols adopted by Object2dDisplay

SwarmObject CREATABLE

## Methods

### Phase: Creating

- - setDisplayMessage: (SEL)s
  Set the message to be sent to each object in the grid to make it draw itself.

- - setDiscrete2dToDisplay: (id <GridData>)c
  Set the 2d array to draw.

- - setDisplayWidget: (id <Raster>)r
  Set the display widget to use for drawing.

- + create: (id <Zone>)aZone setDisplayWidget: (id <Raster>)r setDiscrete2dToDisplay: (id <GridData>)c setDisplayMessage: (SEL)s
  Convenience constructor for Object2dDisplay

### Phase: Using

- - makeProbeAtX: (unsigned)x Y: (unsigned)y
  Make a probe for an object at a specific point.

- - display
  Draw all objects in the array (or optionally, the collection) on the raster widget. All that happens here is the display message is sent to each object - it is the object's responsibility to render itself.

- - setObjectCollection: objects
  Set a collection of objects to be displayed. If this is not given, then Object2dDisplay loops through the 2d grid sending draw messages to all objects it finds there. Giving an explicit collection of objects to draw is more efficient if your grid is sparsely populated.

Prev | Home | Next
Int2dFiler | Up | Value2dDisplay