home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-06-16 | 2.3 KB | 119 lines |
- ' ---------------------------------
- '
- ' AMOSPro Compiler Example
- '
- ' Real time Top-Zooming area
- '
- ' By Jean-Baptiste BOLCATO
- '
- ' (c) 1993 Europress Software Ltd.
- '
- ' ---------------------------------
- '
- ' -------------------------------------------------
- ' Remark: An AMOS coded flexible zoom routine
- '
- ' Average Acceleration: 300 %
- '
- ' Test configuration: A1200, 6Mb
- '
- ' Original AMOS Compiler: 240 %
- ' -------------------------------------------------
-
- ' ---- Variables Init ----
-
- Set Buffer 24
-
- ' Time to loop
- TL=500
- Dim PW(5)
- PW(1)=2 : PW(2)=4 : PW(3)=8
- PW(4)=16 : PW(5)=32
-
- ' ---- Parameter screen ----
-
- Screen Open 0,320,200,2,Lowres
- Palette 0,$FFF : Curs Off : Cls 0
- Paper 0 : Pen 1 : Ink 1 : Hide
- Limit Mouse 0,0 To 80,80
- X Mouse=50 : P=1
- Home : Print "Use Mouse to choose a zoom power factor:";
- Repeat
- Ink 0 : Box 160-32/P,100-128/P To 160+32/P,100+128/P
- P=1+(X Mouse/16) : If P<1 : P=1 : End If : If P>5 : P=5 : End If
- P=PW(P)
- Ink 1 : Box 160-32/P,100-128/P To 160+32/P,100+128/P
- Wait Vbl
- Until Mouse Click
-
- ' size of zoom: 16 multiple
- W=64/P : H=256/P
-
- ' ---- Screen init ----
-
- Load Iff "AMOSPro_Extras:Compiler_Examples/Graphics/demo_pic.iff",0
- Screen Display 0,128,45,,
- Cls 0,320-68,0 To 320,256
-
- ' ---- Main loop ----
-
- Limit Mouse 129,46 To 320+128-68,45+200-H-1
- XZ=320-W*P
-
- ' Xor writing
- Gr Writing 2 : Ink 0
- XM=260 : YM=1
- Draw XM,YM To XM+W,YM
- Draw To XM+W,YM+H
- Draw To XM,YM+H
- Draw To XM,YM+1
-
- NL=0 : Timer=0
-
- Repeat
-
- XM_OLD=XM
- YM_OLD=YM
- XM=X Mouse-128
- YM=Y Mouse-45
-
- ' Xor writing
- Gr Writing 2 : Ink 0
- Draw XM_OLD-1,YM_OLD-1 To XM_OLD+W,YM_OLD-1
- Draw To XM_OLD+W,YM_OLD+H
- Draw To XM_OLD-1,YM_OLD+H
- Draw To XM_OLD-1,YM_OLD
-
- Draw XM-1,YM-1 To XM+W,YM-1
- Draw To XM+W,YM+H
- Draw To XM-1,YM+H
- Draw To XM-1,YM-1
-
- ' Normal writing
- Gr Writing 0
-
- ' Display zoom from pixel buffer
- For I=0 To W-1
- For J=0 To H-1
- Cls Point(XM+I,YM+J),XZ+I*P,J*P To XZ+(I+1)*P,(J+1)*P
- Next J
- Next I
-
- Wait Vbl
-
- Inc NL
-
- Until Timer>=TL
- T#=Timer
-
- ' --- Final Report ---
-
- Autoback 1 : Cls 0 : Paper 0 : Pen 1
- Print " Needs";T#/50;" seconds for";NL;" loops."
- Print " ( =";T#/NL;" VBLs )"
- Print
- Print " Press mouse key to end"
- Repeat
- Multi Wait
- Until Mouse Key or(Inkey$<>"")
- End