text writefile bmax blitz3d

BlitzMax Forums/BlitzMax Programming/text writefile bmax blitz3d

If you are going to all that effort to save it.. why not use a bank ?

SuperStrict

Global pix_r:Byte[2001,2001]
Global pix_g:Byte[2001,2001]
Global pix_b:Byte[2001,2001]

Local te:Int=MilliSecs()

Local maxx:Int=2001

Local bank:TBank = CreateBank(maxx * maxx * 3)

For Local nx:Int=0 Until maxx

	Local nxp:Int = nx * (maxx * 3)

	For Local ny:Int=0 Until maxx

		bank.pokebyte(nxp + ny, pix_r[nx,ny])
		bank.pokebyte(nxp + ny + 1, pix_g[nx,ny])
		bank.pokebyte(nxp + ny + 2, pix_b[nx,ny])

	Next
Next

SaveBank(bank, "bla.txt")
bank = Null

Print (MilliSecs()-te)

Local te1:Int=MilliSecs()

Local bank1:TBank = LoadBank("bla.txt")

For Local nx1:Int=0 Until maxx

	Local nxp:Int = nx1 * (maxx * 3)

	For Local ny1:Int=0 Until maxx

		pix_r[nx1,ny1]= bank1.peekbyte(nxp + ny1)
		pix_g[nx1,ny1]= bank1.peekbyte(nxp + ny1 + 1)
		pix_b[nx1,ny1]= bank1.peekbyte(nxp + ny1 + 2)

	Next
Next

Print (MilliSecs()-te1)