home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / blitzbasic / riblitzlibs.lha / riblitzlibs / fx / Derez_ZoomXY.asc next >
Encoding:
Text File  |  2002-02-02  |  2.5 KB  |  152 lines

  1. ;FX library (C)1994 Reflective Images
  2. ;Example program
  3. ;By Stephen McNamara
  4. ;Please feel free to use any part of the program
  5. ; in whatever way you feel like
  6.  
  7. ;newtype for polygon drawing
  8. NEWTYPE.coord
  9.   x.w : y.w
  10. End NEWTYPE
  11.  
  12. ;Dimension some arrays
  13. Dim sn.q(359)
  14. Dim cn.q(359)
  15. Dim polygon.coord(4)
  16.  
  17. ;Statement that draws a nice pattern!
  18. Statement DrawTriangles {angg.w,radii1.w,radii2.w,col.w}
  19. .DrawTri:
  20.   SHARED sn(),cn(),polygon()
  21.   BLITZ
  22.   endang.w=angg+360
  23.   Repeat
  24.   angg+10
  25.   ang=angg : ang=ang MOD 360
  26.  
  27.   polygon(1)\x=160+sn(ang)*radii1
  28.   polygon(1)\y=100+cn(ang)*radii1
  29.  
  30.   ang2.w=ang+5 : If ang2>359 Then ang2-360
  31.   polygon(2)\x=160+sn(ang2)*radii2
  32.   polygon(2)\y=100+cn(ang2)*radii2
  33.  
  34.   ang2.w=ang-5 : If ang2<0 Then ang2+360
  35.   polygon(3)\x=160+sn(ang2)*radii2
  36.   polygon(3)\y=100+cn(ang2)*radii2
  37.  
  38.   Polyf 3,&polygon(1),col
  39.   Until angg=endang
  40. End Statement
  41.  
  42. ;=============== Program code here ======================================
  43.  
  44. QAMIGA
  45.  
  46. ;Get some bitmaps
  47. BitMap 0,320,200,1
  48. BitMap 1,320,200,1
  49.  
  50. ;Set some colours
  51. PalRGB 0,0,15,15,15
  52. PalRGB 0,1,0,0,0
  53.  
  54. ;Get sin and cos look arrays
  55. For h.l=0 To 359
  56.   a=(h*Pi)/180
  57.   sn(h)=Sin(a)
  58.   cn(h)=Cos(a)
  59. Next h
  60.  
  61. ;Go into Blitz mode!
  62. BLITZ
  63.  
  64. ;Position slice in centre of display
  65. offset.w=0
  66. If DispHeight=256 Then offset=28
  67.  
  68. ;And create slice
  69. Slice 0,44+offset,320,200,$fff8,1,8,2,320,320
  70.  
  71. ;display bitmap 0 and use palette 0
  72. Show 0
  73. Use Palette 0
  74.  
  75. ;Draw a nice pattern on bitmap 1
  76. Use BitMap 1 : BitMapOutput 1
  77. DrawTriangles {0,200,128,1}
  78. DrawTriangles {360,127,80,1}
  79. DrawTriangles {0,79,40,1}
  80. DrawTriangles {360,39,10,1}
  81.  
  82. ;Bring the whole screen in
  83. ;Derezes bitmap 1 onto bitmap 0
  84. For h=156 To 1 Step -1
  85.   Derez 1,0,0,0,h,200
  86.   VWait
  87. Next h
  88.  
  89. ;a little wait
  90. VWait 50
  91.  
  92. ;Take part of the screen out
  93. ;Derez lines 50-149
  94.  
  95. ;Get position to derez from and to (bitmap=1,x=0,y=50)
  96. ad.l=ADDValue(1,0,50)
  97.  
  98. ;Do the derez
  99. For h=1 To 56
  100.   Derez 1,0,ad,ad,h,100
  101.   VWait
  102. Next h
  103.  
  104. ;Clear spare bitmap
  105. Use BitMap 1
  106. BitMapOutput 1
  107. Cls
  108. VWait
  109.  
  110. ;Print some text
  111. Colour 1
  112. Locate 13,8
  113. Print "The FX Library"
  114.  
  115. Locate 10,10
  116. Print "By Reflective Images"
  117.  
  118. Locate 10,14
  119. Print "Press a mouse button"
  120.  
  121. Locate 10,16
  122. Print "to exit this program"
  123.  
  124. ;Bring in the text
  125. For h=56 To 0 Step -1
  126.   Derez 1,0,ad,ad,h,100
  127.   VWait
  128. Next h
  129.  
  130. MouseWait
  131.  
  132. ;Initialise ZoomXY command - source   =bitmap 1
  133. ;                            dest     =bitmap 0
  134. ;                            addsource=0
  135. ;                            adddest  =0
  136. InitZoomXY 1,0,0,0
  137.  
  138. ;Copy bitmap 0 to 1
  139. CopyBitMap 0,1
  140. VWait 10
  141.  
  142. ;Do zoom!
  143. For h=1 To 100
  144.   ZoomXY h,h,200
  145.   VWait
  146. Next h
  147.  
  148. ;And end the program
  149. End
  150.  
  151.  
  152.