home *** CD-ROM | disk | FTP | other *** search
- ;FX library (C)1994 Reflective Images
- ;Example program
- ;By Stephen McNamara
- ;Please feel free to use any part of the program
- ; in whatever way you feel like
-
- ;newtype for polygon drawing
- NEWTYPE.coord
- x.w : y.w
- End NEWTYPE
-
- ;Dimension some arrays
- Dim sn.q(359)
- Dim cn.q(359)
- Dim polygon.coord(4)
-
- ;Statement that draws a nice pattern!
- Statement DrawTriangles {angg.w,radii1.w,radii2.w,col.w}
- .DrawTri:
- SHARED sn(),cn(),polygon()
- BLITZ
- endang.w=angg+360
- Repeat
- angg+10
- ang=angg : ang=ang MOD 360
-
- polygon(1)\x=160+sn(ang)*radii1
- polygon(1)\y=100+cn(ang)*radii1
-
- ang2.w=ang+5 : If ang2>359 Then ang2-360
- polygon(2)\x=160+sn(ang2)*radii2
- polygon(2)\y=100+cn(ang2)*radii2
-
- ang2.w=ang-5 : If ang2<0 Then ang2+360
- polygon(3)\x=160+sn(ang2)*radii2
- polygon(3)\y=100+cn(ang2)*radii2
-
- Polyf 3,&polygon(1),col
- Until angg=endang
- End Statement
-
- ;=============== Program code here ======================================
-
- QAMIGA
-
- ;Get some bitmaps
- BitMap 0,320,200,1
- BitMap 1,320,200,1
-
- ;Set some colours
- PalRGB 0,0,15,15,15
- PalRGB 0,1,0,0,0
-
- ;Get sin and cos look arrays
- For h.l=0 To 359
- a=(h*Pi)/180
- sn(h)=Sin(a)
- cn(h)=Cos(a)
- Next h
-
- ;Go into Blitz mode!
- BLITZ
-
- ;Position slice in centre of display
- offset.w=0
- If DispHeight=256 Then offset=28
-
- ;And create slice
- Slice 0,44+offset,320,200,$fff8,1,8,2,320,320
-
- ;display bitmap 0 and use palette 0
- Show 0
- Use Palette 0
-
- ;Draw a nice pattern on bitmap 1
- Use BitMap 1 : BitMapOutput 1
- DrawTriangles {0,200,128,1}
- DrawTriangles {360,127,80,1}
- DrawTriangles {0,79,40,1}
- DrawTriangles {360,39,10,1}
-
- ;Bring the whole screen in
- ;Derezes bitmap 1 onto bitmap 0
- For h=156 To 1 Step -1
- Derez 1,0,0,0,h,200
- VWait
- Next h
-
- ;a little wait
- VWait 50
-
- ;Take part of the screen out
- ;Derez lines 50-149
-
- ;Get position to derez from and to (bitmap=1,x=0,y=50)
- ad.l=ADDValue(1,0,50)
-
- ;Do the derez
- For h=1 To 56
- Derez 1,0,ad,ad,h,100
- VWait
- Next h
-
- ;Clear spare bitmap
- Use BitMap 1
- BitMapOutput 1
- Cls
- VWait
-
- ;Print some text
- Colour 1
- Locate 13,8
- Print "The FX Library"
-
- Locate 10,10
- Print "By Reflective Images"
-
- Locate 10,14
- Print "Press a mouse button"
-
- Locate 10,16
- Print "to exit this program"
-
- ;Bring in the text
- For h=56 To 0 Step -1
- Derez 1,0,ad,ad,h,100
- VWait
- Next h
-
- MouseWait
-
- ;Initialise ZoomXY command - source =bitmap 1
- ; dest =bitmap 0
- ; addsource=0
- ; adddest =0
- InitZoomXY 1,0,0,0
-
- ;Copy bitmap 0 to 1
- CopyBitMap 0,1
- VWait 10
-
- ;Do zoom!
- For h=1 To 100
- ZoomXY h,h,200
- VWait
- Next h
-
- ;And end the program
- End
-
-
-