home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / OB3.2D2.DMS / in.adf / Module / XYplane.mod < prev   
Encoding:
Text File  |  1994-08-05  |  1.9 KB  |  90 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                                                                         *)
  3. (*  Amiga Oberon Library MODULE: XYPlane              Date: 02-Nov-92      *)
  4. (*                                                                         *)
  5. (*   © 1992 BY Fridtjof Siebert                                            *)
  6. (*                                                                         *)
  7. (*-------------------------------------------------------------------------*)
  8.  
  9. MODULE XYplane;
  10.  
  11. IMPORT      Display,
  12.        I := Intuition,
  13.        u := Utility,
  14.        e := Exec;
  15.  
  16. CONST
  17.   erase * = 0;
  18.   draw  * = 1;
  19.  
  20. VAR
  21.   window: Display.WindowPtr;
  22.   X*, Y*, W*, H*: INTEGER;
  23.   tags: POINTER TO ARRAY 3 OF LONGINT;
  24.  
  25.  
  26. PROCEDURE Clear*;
  27.  
  28. BEGIN
  29.   Display.Clear(window);
  30. END Clear;
  31.  
  32.  
  33. PROCEDURE Open *;
  34. BEGIN
  35.   NEW(window);
  36.   IF ~ Display.OpenWindowTags(window,NIL,TRUE,"XY Plane",0,0,640,200,NIL,TRUE,tags) THEN HALT(20) END;
  37.   Display.Jam1(window);
  38.   IF ~ I.ModifyIDCMP(window.window,LONGSET{I.vanillaKey,I.closeWindow}) & (I.int.libNode.version>=36) THEN
  39.     HALT(20)
  40.   END;
  41.   X := 0;
  42.   Y := 0;
  43.   W := window.width;
  44.   H := window.height;
  45. END Open;
  46.  
  47.  
  48. PROCEDURE Dot * (x,y,mode: INTEGER);
  49. BEGIN
  50.   Display.FrontPen(window,SHORT(mode));
  51.   Display.Dot(window,x,window.height-y);
  52. END Dot;
  53.  
  54.  
  55. PROCEDURE IsDot * (x,y: INTEGER): BOOLEAN;
  56. BEGIN
  57.   RETURN Display.DotColor(window,x,window.height-y)#erase;
  58. END IsDot;
  59.  
  60.  
  61. PROCEDURE Key * (): CHAR;
  62. VAR
  63.   msg: I.IntuiMessagePtr;
  64.   ch : CHAR;
  65. BEGIN
  66.   ch := 0X;
  67.   msg := e.GetMsg(window.window.userPort);
  68.   WHILE msg#NIL DO
  69.     IF I.vanillaKey IN msg.class THEN
  70.       ch := CHR(msg.code);
  71.     ELSIF I.closeWindow IN msg.class THEN
  72.       ch := "Q"
  73.     END;
  74.     e.ReplyMsg(msg);
  75.     msg := e.GetMsg(window.window.userPort);
  76.   END;
  77.   RETURN ch;
  78. END Key;
  79.  
  80.  
  81. BEGIN
  82.   NEW(tags);
  83.   tags[0] := I.waSizeGadget;
  84.   tags[1] := I.LFALSE;
  85.   tags[2] := u.done;
  86.   Open;
  87. END XYplane.
  88.  
  89.  
  90.