_gl-board.ss_

The gl-board.ss library uses OpenGL, via the sgl library, to provide generic
functionality for 3-dimensional views of board games.  It provides support for
viewing and positioning the board as well as for moving pieces on the board.
It does not handle rendering of the board and pieces themselves.  The arrow
keys rotate the board, the = and - keys move the board closer and further, and
the _ and + keys control the field of vision.  Games are played by left
clicking the mouse on a piece and dragging it to a space.

The checkers and goblet games both use the gl-board.ss library.

The gl-board.ss module provides _gl-board%_, a subclass of canvas%, with the
following public methods:

> (add-space draw info): (->) X ->
  Adds a space to the board.  The draw argument function should draw the space
  using GL drawing commands.  The info argument is associated with the space.
  Spaces should be drawn on the z = 0 plane.

> (add-piece x y z draw info): real real real (->) X ->
  Adds a piece to the board.  The draw argument function should draw the piece
  using GL drawing commands.  The info argument is associated with the piece.
  The x, y, and z arguments are the position at which the piece resides.

> (get-spaces): -> (listof X)
  Returns a list of the infos associated with the current spaces.

> (get-pieces): -> (listof X)
  Returns a list of the infos associated with the current pieces.

> (set-space-draw info draw): X (->) ->
  Sets to draw the drawing method of all spaces whose info is equal? to the
  given info.

> (set-piece-draw info draw): X (boolean ->) ->
  Sets to draw the drawing method of all pieces whose info is equal? to the
  given info.  The drawing method takes a boolean.  If the value it true, 
  then the piece should be drawn for creating its shadow.  Otherwise is should
  be drawn normally.

> (enable-piece info on?): X boolean ->
  Enables or disables a piece whose info is equal? to the given info.
  Disabled pieces are not selectable.

> (enabled? info): X -> boolean
  If a piece whose info is equal? to the given info is enabled or not.

> (remove-piece info): X ->
  Removes all pieces whose info is equal? to the given info.


A gl-board object is constructed as follows:
(new gl-board% (min-x real) (max-x real)
               (min-y real) (max-y real)
               (lift real)
               (move (X gl-double-vector ->))
	       ;; Optional:
	       (theta real) (phi real))

The min-x, max-x, min-y, and max-y parameters all specify the dimensions of
the board.  They are used to setup viewing parameters.  The board is viewed
centered around the center of the coordinates, and the view attempts to fill
the window to them. The optional theta and phi arguments determine the initial
rotation of the board, with respective defaults 45 and 0; theta corresponds to
the up and down keys, and phi corresponds to the left and right keys.

The lift parameter specifies how high off the board mouse-dragged pieces are.

The gl-board% class invokes the move callback when a piece is selected
(left-click) and then unselected.  It is given the info associated with the
selected piece, and the coordinates the user has dragged it to.  If the piece
should be moved permanently, the move function must update the board state
with remove-piece and add-piece.

