home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 3: The Continuation / 17-Bit_The_Continuation_Disc.iso / amigan / amigan 9 / automata / source / amgraphics.mod < prev    next >
Encoding:
Modula Implementation  |  1994-01-27  |  1.5 KB  |  61 lines

  1. IMPLEMENTATION MODULE AMGraphics;
  2.  
  3. (*  AMGraphics does all the interactive graphics work required during
  4.     program execution, including poltting an automata, printing message
  5.     outputs, and accepting input.
  6.  
  7.     Version 2.0A    by Mike Dryja   February 21, 1987 *)
  8.  
  9. FROM SYSTEM    IMPORT ADR;
  10. FROM AMCalc    IMPORT MaxAutomata, Range, SeeCell, CellType, Automata,
  11.               GetLength;
  12. FROM AMSetUp   IMPORT AMWindow;
  13. FROM Devices   IMPORT CloseDevice, OpenDevice;
  14. FROM IO        IMPORT DoIO, CmdRead, CmdWrite, IOStdReq, IORequest;
  15. FROM Strings   IMPORT Length;
  16. FROM Pens      IMPORT RectFill, SetAPen, SetBPen, SetDrMd, WritePixel;
  17. FROM Rasters   IMPORT ScrollRaster;
  18. FROM Intuition IMPORT WindowPtr, Window;
  19. FROM GraphicsLibrary
  20.            IMPORT Jam1;
  21. VAR
  22.   Y,
  23.   YMax : CARDINAL;
  24.  
  25. PROCEDURE PreparePlot ();
  26.   BEGIN
  27.     SetAPen(AMWindow^.RPort^, 0);
  28.     SetBPen(AMWindow^.RPort^, 0);
  29.     SetDrMd(AMWindow^.RPort^, Jam1);
  30.     RectFill(AMWindow^.RPort^, 2, 12, 318, 198);
  31.     Y := 12;
  32.   END PreparePlot;
  33.  
  34. PROCEDURE SetScroll (Scroll : ScrollType);
  35.   BEGIN
  36.     IF Scroll = Smooth THEN
  37.       YMax := 198;
  38.     ELSE
  39.       YMax := 180;
  40.     END;
  41.   END SetScroll;
  42.  
  43. PROCEDURE PlotAutomata (State : Automata);
  44.   VAR
  45.     X : CARDINAL;
  46.   BEGIN
  47.     IF Y = 200 THEN
  48.       ScrollRaster(AMWindow^.RPort^, 0, (200 - YMax), 2, 12, 318, 198);
  49.       Y := YMax;
  50.     END;
  51.     FOR X := 1 TO GetLength () DO
  52.       SetAPen(AMWindow^.RPort^, SeeCell(State, X));      
  53.       WritePixel(AMWindow^.RPort^, (X * 2), Y);
  54.     END;
  55.     INC (Y, 2);
  56.   END PlotAutomata;
  57.  
  58. BEGIN
  59.   Error := FALSE;
  60. END AMGraphics.
  61.