DEFINITION MODULE attacksgraphics;


(*   I am using the data hiding capabilities of modula-2 to simplify my   *)
(* life for this project.  Anything that the main or other routines could *)
(* want to do graphically will be through routines declared here.  To     *)
(* sum, this is the heart of the graphics routines, simplified to only    *)
(* the logical necessities.                                               *)
(*                                                                        *)
(*      Scott Biggs                                                       *)


FROM header
  IMPORT   boardtype, playertype, squaretype, boardrange, pointercode,
           movetype, printmsgtype;
FROM SYSTEM
  IMPORT   ADDRESS;
FROM Intuition
  IMPORT   WindowPtr;


(**************************************************************************)
PROCEDURE InitializeScreen() : BOOLEAN;

(*      Starts the graphix running.                                    *)
(* Sets up all the graphics variables AND draws the first graphics     *)
(* that will be presented.  It returns true IF all the actions worked, *)
(* false otherwise.                                                    *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            n/a                                                      *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*            Returns a boolean value that tells IF the operation was  *)
(*            succussful or not.  If successful, the screen (along     *)
(*            with the accompanying graphics) is started.              *)


(**************************************************************************)
PROCEDURE CleanupGraphics;

(*      Stops the graphix AND deallocates all graphix allocated        *)
(* memory.  It assumes that the graphics HAS been succussfully initi-  *)
(* ated.                                                               *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            n/a                                                      *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*            n/a                                                      *)



(**************************************************************************)
PROCEDURE ShowAbout;

(*   Simply displays a message about the programmer and then waits for *)
(* a mouse click to then erase this new display and return to the old  *)
(* one.                                                                *)



(**************************************************************************)
PROCEDURE ChangePointer (code : pointercode);

(*      This changes the mouse pointer.  The code determines what the  *)
(* pointer is changed to.                                              *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            code        This variable is of the enumerated type,     *)
(*                        pointercode.  It consists of RedCircle,      *)
(*                        BlueCircle, and Default.  The Default code   *)
(*                        tells this routine to restore the pointer    *)
(*                        to whatever it was when the program was      *)
(*                        started.                                     *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*            The mouse pointer is immediately changed to the desired  *)
(*            pointer.                                                 *)


(**************************************************************************)
PROCEDURE PrintMsg (msg : printmsgtype);

(*   Prints the message at the top of the screen.  This procedure should  *)
(* not be confused with the procedure PrintTurn, which displays who's     *)
(* turn it is to play.                                                    *)
(*                                                                        *)
(*   INPUT                                                                *)
(*            msg                  This is which message to display.      *)
(*                                                                        *)
(*   OUTPUT                                                               *)
(*            The screen is changed to display the desired message.       *)


(**************************************************************************)
PROCEDURE ShowScore (redscore : CARDINAL; bluescore : CARDINAL);

(*      Displays the scores.                                           *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            redscore    The number of squares occupied by the red    *)
(*                        player.                                      *)
(*                                                                     *)
(*            bluescore   The number of squares occupied by the blue   *)
(*                        player.                                      *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*            The screen is modified to display the scores.            *)


(**************************************************************************)
PROCEDURE PrintTurn (player : playertype);

(*      Displays whose turn it is by the message on the top of the     *)
(* screen                                                              *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            player      The player whose turn it now is.             *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*            The screen is modified to display whose turn it is.      *)

(**************************************************************************)
PROCEDURE DrawBoard (board : boardtype);

(*      Replaces the current display with the given board.             *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            board       A variable OF boardtype that describes the   *)
(*                        contents of every location of a board.       *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*            The screen is modified to display the contents of the    *)
(*            input data.                                              *)


(***********************************************************************)
PROCEDURE DrawSquare (xloc : boardrange; yloc : boardrange;
                      square : squaretype);

(*      This routine modifies only a single square, rather than the    *)
(* whole board like the DrawBoard routine does.  Considering the upper *)
(* left corner as square (1,1), this routine will replace the given    *)
(* square with the specified item (either a block, empty, red, or      *)
(* blue).                                                              *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            xloc, yloc     These two numbers describe the location   *)
(*                           of the square to change.                  *)
(*                                                                     *)
(*            square         This tells the routine what to change     *)
(*                           the square to.                            *)
(*                                                                     *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*                     The display is change so that only the square   *)
(*                     indicated looks like the new type.              *)

(***********************************************************************)
PROCEDURE HighlightSquare (xloc : boardrange; yloc : boardrange;
                      player : playertype);

(*      This routine highlights the given square in the color of the   *)
(* specified player.  It is assumed that checking has already been     *)
(* made so that the highlighting makes sense.                          *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            xloc, yloc     These two numbers describe the location   *)
(*                           of the square to change.                  *)
(*                                                                     *)
(*            player         This tells the routine what colors to     *)
(*                           use.                                      *)
(*                                                                     *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*                     The display is change so that only the square   *)
(*                     indicated looks highlighted.                    *)


(***********************************************************************)
PROCEDURE UnHighlightSquare (xloc : boardrange; yloc : boardrange;
                             player : playertype);

(*      This routine UNhighlights the given square.  It undoes the     *)
(* effects of HighlightSquare.  Similarly, it assumes that checking    *)
(* has already been done so that unhighlighting makes sense.           *)
(*                                                                     *)
(*   INPUT                                                             *)
(*            xloc, yloc     These two numbers describe the location   *)
(*                           of the square to change.                  *)
(*                                                                     *)
(*            player         This is the color of the square to UN-    *)
(*                           highlight.                                *)
(*                                                                     *)
(*   OUTPUT                                                            *)
(*                     The display is change so that only the square   *)
(*                     indicated looks UNhighlighted.                  *)


(***********************************************************************)
(*   !!!!!    WARNING     !!!!!                                        *)
(*                                                                     *)
(*   The stuff after this message should only be imported by the       *)
(* module, ataxxinput.  Only that module needs to know about these     *)
(* things!                                                             *)
(***********************************************************************)

VAR
  mywindowptr : WindowPtr;

END attacksgraphics.
