home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / e / mailinglists / binaries / hamdemo.lha / ham6demo.e next >
Text File  |  1992-03-06  |  2KB  |  77 lines

  1. OPT OSVERSION=37
  2.  
  3. MODULE 'gadtools','libraries/gadtools','intuition/intuition','exec/nodes',
  4.        'intuition/screens','intuition/gadgetclass','graphics/text'
  5.  
  6. ENUM ER_NONE,ER_NOSCRN,ER_NOWINDOW
  7.  
  8. DEF wnd=NIL:PTR TO window,
  9.     scr=NIL:PTR TO screen
  10.  
  11. PROC shutdown()
  12.   IF wnd THEN CloseWindow(wnd)
  13.   IF scr THEN CloseScreen(scr)
  14. ENDPROC
  15.  
  16. PROC setup()
  17.   IF (scr:=OpenScreenTagList(NIL,
  18.     [SA_WIDTH,80,SA_HEIGHT,64,SA_DEPTH,6,SA_DISPLAYID,$800,
  19.      NIL,NIL]))=NIL THEN Raise(ER_NOSCRN)
  20.   IF (wnd:=OpenWindowTagList(NIL,
  21.     [WA_LEFT,0,
  22.      WA_TOP,0,
  23.      WA_WIDTH,80,
  24.      WA_HEIGHT,64,
  25.      WA_IDCMP,IDCMP_MOUSEBUTTONS,
  26.      WA_FLAGS,WFLG_SIMPLE_REFRESH OR WFLG_NOCAREREFRESH OR
  27.               WFLG_ACTIVATE OR WFLG_BORDERLESS,
  28.      WA_CUSTOMSCREEN,scr,
  29.      NIL]))=NIL THEN Raise(ER_NOWINDOW)
  30. ENDPROC
  31.  
  32. PROC draw()
  33.   DEF r,loop1,loop2,loop3
  34.   r:=wnd.rport
  35.   FOR loop1:=0 TO 3
  36.     FOR loop2:=0 TO 3
  37.       SetAPen(r,loop1*4+loop2+16)
  38.       Move(r,loop2*18,loop1*16)
  39.       Draw(r,loop2*18,loop1*16+15)
  40.       FOR loop3:=0 TO 15
  41.         SetAPen(r,loop3+32)
  42.         Move(r,loop2*18+1,loop1*16+loop3)
  43.         Draw(r,loop2*18+1,loop1*16+loop3)
  44.         SetAPen(r,loop3+48)
  45.         Move(r,loop2*18+2+loop3,loop1*16)
  46.         Draw(r,loop2*18+2+loop3,loop1*16+15)
  47.       ENDFOR
  48.     ENDFOR
  49.   ENDFOR
  50. ENDPROC
  51.  
  52. PROC waitmouse()
  53.   DEF mes:PTR TO intuimessage,quit=FALSE
  54.   REPEAT
  55.     IF mes:=GetMsg(wnd.userport)
  56.       IF mes.class=IDCMP_MOUSEBUTTONS THEN quit:=TRUE
  57.       ReplyMsg(mes)
  58.     ELSE
  59.       WaitPort(wnd.userport)
  60.     ENDIF
  61.   UNTIL quit
  62. ENDPROC
  63.  
  64. PROC main() HANDLE
  65.   DEF erlist:PTR TO LONG
  66.   setup()
  67.   draw()
  68.   waitmouse()
  69.   Raise(ER_NONE)
  70. EXCEPT
  71.   shutdown()
  72.   IF exception>0
  73.     erlist:=['open screen','open window']
  74.     EasyRequestArgs(0,[20,0,0,'Could not \s.','OK'],0,[erlist[exception-1]])
  75.   ENDIF
  76. ENDPROC
  77.