question about banks?

BlitzMax Forums/BlitzMax Beginners Area/question about banks?

Mook(Posted 2011) [#1]
I hope from this example you can see what im trying to do..

Graphics 640,480

Include "inc.bmx"
Global mem:TBank = CreateBank(GraphicsWidth()*GraphicsHeight())

For x = 0 To GraphicsWidth()-1
	y = 10
	PokeByte(mem,x*y,1)
Next

Repeat 
	Cls
	For x = 0 To GraphicsWidth() - 1
		For y = 0 To GraphicsHeight() - 1
			If PeekByte(mem,x*y) = 1
				Plot x,y
			End If
		Next
	Next 
	Flip
	If KeyHit(key_escape) Then End
Forever


If i could get that to actually draw a straight line across the screen, i think i would have a better understanding. But instead i get a very odd pattern that looks more like i started to draw a bunch of weird blocks with a black curve cutting out the rest of the screen.

I know plot is not a very speedy way to do this, but after i understand the banks then i will use a faster method of drawing to the screen.


Mook(Posted 2011) [#2]
grr... sry remove the include statement for the running example


Azathoth(Posted 2011) [#3]
Try indexing the bank with x+y*GraphicsWidth(), as x*y wont work such as 0*10 = 0.

Last edited 2011


Mook(Posted 2011) [#4]
shoot... even when u gave me exactly what i was looking for i still had to draw it out to come up with the same thing, however, if u did not post that i still would have been trying to think of why it wasnt working.. i just had it in my head that was correct lol

thanks :o)