home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / 326-350 / apd341 / source_progs / playing_with_windows.amos / playing_with_windows.amosSourceCode
Encoding:
AMOS Source Code  |  1991-08-01  |  1.8 KB  |  74 lines

  1. '********************** Demo ***************************************** 
  2. '
  3. _GROWWINDOW[1,20,20,288,40,2]
  4. Print "Did you like this growing window?"
  5. _GROWWINDOW[2,20,60,230,60,4]
  6. Print "This one is a bit faster"
  7. Wait 90
  8. Wind Close 
  9. Window 1
  10. Wind Close 
  11. Bar 40,40 To 200,140
  12. Wait 50
  13. _WINDON[1,70,70,140,60,1]
  14. Print "This saves the" : Print "background it" : Print "opens on"
  15. Wait 130
  16. _WINDOFF[1]
  17. Home : Centre "Press a key"
  18. Wait Key 
  19. Edit 
  20. '
  21. '******************** SUBROUTINES *************************************
  22. '
  23. ' _GROWWINDOW does a zoomwindow effect when opening a window 
  24. ' WNUM = the window number 
  25. ' X,Y,W,H = X,Y coordinates & Width,Height 
  26. ' Speed = can be any even number from 2 to 16  (16=fastest)
  27. Procedure _GROWWINDOW[WNUM,X,Y,W,H,SPEED]
  28.    X=(X/16)*16 : W=(W/16)*16 : Rem    * Needs to be on a 16 pixel boundary
  29.    TX=X : TY=Y
  30.    Gr Writing 2 : YEND=((Y+H)/SPEED)*SPEED
  31.    XCOUNT=((TX+W)-X)/SPEED : YCOUNT=((TY+H)-Y)/SPEED
  32.    If W<H Then XFLAG=1 : COUNT=XCOUNT
  33.    If W>H Then YFLAG=1 : COUNT=YCOUNT
  34.    For A=0 To COUNT
  35.       Box X,Y To TX,TY
  36.       Box X,Y To TX,TY
  37.       Add TX,SPEED : Add TY,SPEED
  38.    Next A
  39.    If YFLAG=1
  40.       Do 
  41.          Exit If TX=X+W
  42.          Box X,Y To TX,TY
  43.          Box X,Y To TX,TY
  44.          Add TX,SPEED
  45.       Loop 
  46.    End If 
  47.    If XFLAG=1
  48.       Do 
  49.          Exit If TY=YEND
  50.          Box X,Y To TX,TY
  51.          Box X,Y To TX,TY
  52.          Add TY,SPEED
  53.       Loop 
  54.    End If 
  55.    Wind Open WNUM,X,Y,W/8,H/8,1
  56. End Proc
  57. '
  58. '
  59. ' _WINDON & _WINDOFF create a window with a saved background 
  60. ' if FLAGBORDER=1 then a border is created ( 0 = No Border ) 
  61. Procedure _WINDON[WINDNUM,X,Y,W,H,FLAGBORDER]
  62.    X=(X/16)*16 : W=(W/16)*16
  63.    Get Cblock WINDNUM,X,Y,W,H
  64.    Wind Open WINDNUM,X,Y,W/8,H/8
  65.    Curs Off 
  66.    If FLAGBORDER=1
  67.       Box X,Y To X+W-1,Y+H-1
  68.    End If 
  69. End Proc
  70. Procedure _WINDOFF[WINDNUM]
  71.    Window WINDNUM
  72.    Wind Close 
  73.    Put Cblock WINDNUM
  74. End Proc