home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 505b.lha / Ham_e_library / hdemo.bas < prev    next >
BASIC Source File  |  1991-05-05  |  2KB  |  81 lines

  1.  
  2. REM all library routines that return values must be declared as functions
  3.  
  4. DECLARE FUNCTION HAMEOpenScreen& LIBRARY
  5. DECLARE FUNCTION HAMEGetClip&   LIBRARY
  6.  
  7. REM other library routines that do not return values should not be declared
  8. REM as functions
  9.  
  10. REM Inform BASIC about the hame library
  11.   LIBRARY "hame.library"
  12.  
  13.  
  14. REM Open a 640 x 200 non-interlace register mode hame screen
  15. sHPort& = HAMEOpenScreen&(0,0,640,200)
  16.  
  17. REM Check to make sure it opened
  18. if sHPort& = 0 then end
  19.  
  20. REM Set up a simple GREY, RED, GREEN and BLUE shaded palette
  21. FOR i& = 1 TO 63
  22.   CALL HAMESetRGB8&(sHPort&, i&,     i& * 4, i& * 4, i& * 4 )
  23.   CALL HAMESetRGB8&(sHPort&, i&+64,  i& * 4, 0, 0 )
  24.   CALL HAMESetRGB8&(sHPort&, i&+128, 0, i& * 4, 0 )
  25.   CALL HAMESetRGB8&(sHPort&, i&+192, 0, 0, i& * 4 )
  26. NEXT
  27.  
  28. REM Draw a bunch of different colored lines
  29.  
  30. for y& = 0 to 199
  31.   CALL HAMESetAPen&(sHPort&, y&+1 )
  32.   CALL HAMELine&(sHPort&, 0, y&, 319, y& )
  33. next
  34.  
  35. REM Grab a clip from the screen
  36. cl& = HAMEGetClip&(sHPort&, 1, 4, 20, 64, 0 )
  37.  
  38. REM Check to make sure it took
  39. if cl& = 0 then Cleanup
  40.  
  41. REM Put it down a few times
  42. for y& = -10 to 200
  43.   CALL HAMEPutClip&(sHPort&, cl&, y&, y& )
  44. next
  45.  
  46. CALL HAMEDisposeClip(cl&)
  47.  
  48. REM Draw a bunch of shaded BALLS
  49.  
  50. for y& = 1 to 63
  51.   CALL HAMESetAPen&(sHPort&, y& )
  52.   CALL HAMEEllipse&(sHPort&, 64,  100, 64-y&, 64-y&, 1 )
  53.   CALL HAMESetAPen&(sHPort&, y&+192 )
  54.   CALL HAMEEllipse&(sHPort&, 254, 100, 64-y&, 64-y&, 1 )
  55.   CALL HAMESetAPen&(sHPort&, y&+64 )
  56.   CALL HAMEEllipse&(sHPort&, 124, 100, 64-y&, 64-y&, 1 )
  57.   CALL HAMESetAPen&(sHPort&, y&+128 )
  58.   CALL HAMEEllipse&(sHPort&, 194, 100, 64-y&, 64-y&, 1 )
  59. next
  60.  
  61. REM Draw a series of concentric filled Boxes
  62.  
  63. for y& = 1 to 63
  64.   CALL HAMESetAPen&(sHPort&, y& )
  65.   CALL HAMEBox&(sHPort&, y&-1,  y&+3, 320-y&, 200-y&, 1 )
  66. next
  67.  
  68. REM unfortunately, the user must find the basic command window and
  69. REM click in it to exit.
  70.  
  71. WaitForClick:
  72. SLEEP
  73. IF MOUSE(0) = 0 THEN WaitForClick
  74.  
  75. Cleanup:
  76.  
  77. REM Closing the screen frees everything
  78.  
  79. HAMECloseScreen(sHPort&)
  80. END
  81.