Vertical raster bars

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
angros47
Posts: 1985
Joined: Jun 21, 2005 19:04

Vertical raster bars

Post by angros47 »

A classic old school effect:

Code: Select all

const w=800
const h=600

screenres w,h,32

dim bar(10) as long			'the vertical raster bar itself

bar(0)=rgb(255,255,0)
for i as integer=1 to 9
	bar(i)=rgb(255,0,0)
next
bar(10)=rgb(128,0,0)


screenlock


do

dim source(w) as long			'the line that will be copied along all the screen

dim p as long ptr=screenptr()

dim t as double=timer			'time variable


for y as integer=1 to h

	dim hpos as integer=w/2+y*.45*sin(t)
	t+=.02

	for i as integer=0 to 10	'Plot the bar on the line buffer
		source(i+hpos)=bar(i)
	next



	dim s as long ptr=@source(0)
	for x as integer= 1 to w
		*p=*s
		p+=1
		s+=1
	next
next
screenunlock
screensync
sleep 100
loop until multikey(1)
		
Post Reply