I'm doing some work with memblocks in order to fast pixel related graphics...
No matter what, this code runs at 30fps? What have I missed?
Thanks!
sync on
sync rate 50
Width# = screen width()
Height# = screen height()
Depth# = screen depth()/8
LineMem# = Width# * Depth#
make memblock 1, Width# * Height# * Depth#
make memblock 2, Width# * Height# * Depth#
DO
copy memory get memblock ptr(1), get memblock ptr(2), get memblock size(1)
for n=1 to 1000
plot_x=rnd(400) : plot_y=rnd(400) : gosub plot
next
lock pixels
copy memory get pixels pointer(), get memblock ptr(1), get memblock size(1)
unlock pixels
text 0,420,"fps= "+str$(screen fps())+",Sync time="+str$(t1#)
t1#=timer()
Sync
t1#=(timer()-t1#)/1000
Loop
plot:
if (plot_x < 0 or plot_x > Width# or plot_y < 0 or plot_y > Height#) then Return
write memblock dword 1, plot_y*LineMem# + plot_x*Depth#, 16777215
Return