\label{sec:r2-renderer}

\begin{figure}[htbp]
  \centering
  \includegraphics[scale=0.55]{mdduir2}
  \caption{$\R^2$ renderer module dependency diagram}
  \label{fig:r2-mdd}
\end{figure}

The $\R^2$ renderer\footnote{We considered calling this the
  $\mathbb{N}^2$ renderer, because the Java Virtual Machine is
  technically an integer machine, incapable of representing true
  reals, but decided it was best to remain outside of the
  \texttt{double} abstraction provided by Java.} is Gizmoball's basic
game board renderer that displays 2 dimensional representations of the
game board.  It provides the default implementation of the
\texttt{AbstractGameBoardComponent} and
\texttt{AbstractInteractionMode} abstractions.

The display mechanism works through a system of ``drawers''.  One
drawer exists for each type of gizmo and contains the methods
necessary to render the respective type of gizmo to the $\R^2$ AWT
graphics context.  Because all of the drawers implement a common
interface, the process of actually rendering the board is simple a
matter of traversing the set of drawers.  Furthermore, a factory
abstraction around the production of drawers also unifies the process
of creating drawers from the game board components.  The
\texttt{R2DrawerFactory} is responsible for taking a gizmo from a live
game board and producing an instance of the appropriate
\texttt{R2GizmoDrawer} subclass.  These drawers paint the gizmos
onto the graphics context displayed by the gameboard component.
Repainting of the gameboard is also controlled by the component and
occurs at a rate of once per 50 milliseconds.

$\R^2$ also provides the necessary interaction modes for game playing
and editing.  Both interaction modes,
\texttt{R2EditingInteractionMode} and
\texttt{R2PlayingInteractionMode} sit atop the interaction mode
abstraction provided by the general user interface.  They mold the
behavior of the \texttt{R2GameBoardComponent} to the playing and
editing interfaces expected by the user, as described in
Section~\ref{sec:ui}.

