home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 106 / EnigmaAmiga106CD.iso / www / afc / afc-dir / mousepointer_all.lha / Mousepointer_Examples.lha / Examples / Mousepointer_Example.e < prev   
Text File  |  1997-09-09  |  1KB  |  60 lines

  1. /*
  2.  
  3.   $VER: MousePointer Example 1 - (C)Amiga Foundation Classes
  4.  
  5.   Written By: Andrea Galimberti
  6.  
  7.   This code is Public Domain
  8.  
  9. */
  10.  
  11. MODULE 'AFC/mousepointer', 'AFC/explain_exception',
  12.        'intuition/screens'
  13.  
  14.  
  15. PROC main() HANDLE
  16.   DEF scr=NIL:PTR TO screen
  17.   DEF vp
  18.   DEF topo:PTR TO mousepointer
  19.  
  20.   NEW topo.mousepointer(2)  -> try TO get hold OF sprite number 2
  21.  
  22.   topo.image(11,[$0080,$0080,
  23.                  $0080,$0080,
  24.                  $0080,$0080,
  25.                  $0080,$0080,
  26.                  $0080,$0080,
  27.                  $1F7C,$1F7C,
  28.                  $0080,$0080,
  29.                  $0080,$0080,
  30.                  $0080,$0080,
  31.                  $0080,$0080,
  32.                  $0080,$0080]:INT)  -> the LIST must be OF INT type
  33.  
  34.   topo.hotspot(9,6)  -> we SET the hotspot
  35.  
  36.   scr:=OpenScreenTagList(NIL,[SA_TOP,0,
  37.                               SA_LEFT,0,
  38.                               SA_WIDTH,320,
  39.                               SA_HEIGHT,256,
  40.                               SA_DEPTH,5,
  41.                               SA_TITLE,'Mouse Test',
  42.                               NIL,NIL]
  43.                         )
  44.   IF scr=NIL THEN Raise("scr")
  45.   vp:=scr.viewport
  46.  
  47.   topo.changeImage(vp)  -> the NEW image IS bound TO the viewport
  48.   topo.move(vp,10,10)
  49.   REPEAT
  50.     topo.update(vp)  -> read mouse movements from hardware registers
  51.     WaitTOF()
  52.   UNTIL Mouse()
  53.  
  54. EXCEPT DO
  55.   END topo
  56.   IF scr THEN CloseScreen(scr)
  57.   explain_exception()
  58. ENDPROC
  59.  
  60.