Hey all,
My kid just bought DB and I decided to toy with it a bit. Dregged up an algorithm I originally wrote on Apple ][ and VIC-20, just to start putting the language through its paces.
Anyway, I'm rather surprised at just how slow the following line drawing code is (about 12 seconds). Am I not setting something correctly to let it fly at full speed?
Or, does the DB team need to go reread Foley, van Dam, Feiner, and Huges pp. 74, "Midpoint Line Algorithm" so they can implement a Bresenham incremental line scan-conversion because DB is drawing its own lines instead of using Windows GDI calls?
r = screen width()-1
b = screen height()-1
r2 = r/2
b2 = b/2
ytox# = (1.0*r)/b
xtoy# = (1.0*b)/r
for x=0 to r2 step 4
y=x*xtoy#
line x,0,0,b2-y
line x+r2,0,r,y
line r,b2+y,r-x,b
line r2-x,b,0,b-y
next x
suspend for key
end
Anagon
P.S. Not that this is a big deal - looks like the core language is pretty snappy - a normal FOR loop flys through 1000000 iterations. The following happens in about 1 second.
dim a#(1000000)
print "Start"
for x = 0 to 999999
a#(x) = x^2
next x
print "End"