Author Topic: BlitzMax : RasterBars [BMAX]  (Read 2343 times)

0 Members and 1 Guest are viewing this topic.

Offline Dad1916

  • Atari ST
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
BlitzMax : RasterBars [BMAX]
« on: July 12, 2006 »

Rasterbars, not sure who wrote them but someone on the Blitzmax forums I think.
Wikipedias info on rasterbars http://en.wikipedia.org/wiki/Raster_bar

Code: [Select]
SetGraphicsDriver GLMax2DDriver()
Graphics 640,480,0
' set randomizer
SeedRnd MilliSecs()

' bar generation And control variables
Global barHeight = 256
Global barHeightHalf = barHeight
Global barSpeed = 2
Global barPosition = 0

' Create Image For Raster Bars
'---------------------------------------------------
For i = 0 To 15
SetColor i * 16, 0, 0
DrawLine 0, i, 640, i
DrawLine 0, 31 - i, 640, 31 - i
Next

SetAlpha 0.75
Local barImage1=CreateImage(640,32,1,DYNAMICIMAGE|ALPHABLEND)

GrabImage barImage1,0,0


For i = 0 To 15
SetColor 0, i * 16, 0
DrawLine 0, i, 640, i
DrawLine 0, 31 - i, 640, 31 - i
Next
Local barImage2=CreateImage(640,32,1,DYNAMICIMAGE|ALPHABLEND)

GrabImage barImage2,0,0

For i = 0 To 15
SetColor 0, 0, i * 16
DrawLine 0, i, 640, i
DrawLine 0, 31 - i, 640, 31 - i
Next

Local barImage3=CreateImage(640,32,1,DYNAMICIMAGE|ALPHABLEND)
GrabImage barImage3,0,0

While Not KeyHit(1)
Cls
j = 0
angletemp = angle
For i = 0 To 7
Select j
Case 0
DrawImage barImage1, 0, 240 + Sin( angletemp ) * 80
Case 1
DrawImage barImage2, 0, 240 + Sin( angletemp ) * 80
Case 2
DrawImage barImage3, 0, 240 + Sin( angletemp ) * 80
End Select
j = j + 1
If j > 2 Then j = 0
angletemp = angletemp + 8
Next
angle = angle + 1
If angle > 359 Then angle = angle - 360

DrawImage barImage1, 0, barPosition
barPosition = barPosition - barSpeed
Flip
Cls
Wend
End
« Last Edit: July 21, 2007 by Shockwave »