DataBanks

Blitz3D Forums/Blitz3D Beginners Area/DataBanks

A databank can be used for everything infact.
You can use a bank to store player info (name, current position in the 3D world, score, ...), you can use it to store vertex-data if you want to create meshes yourself throughout your code, you can even use it to store images (the references to them or the data itself):
; Set graphics mode
Graphics 800, 600, 0, 2
; Create a bank of 4 bytes
testbank = CreateBank(4)

; Load an image and store it's handle in the bank at offset 0
PokeInt testbank, 0, LoadImage("Image.bmp")

; Draw the image onto the screen using the handle stored in the bank
DrawImage (PeekInt(testbank, 0)), 10, 10
; Wait for a keypress before ending the program
WaitKey()
End


You can use it to store level-data, enemy-data, ...

You can also use it to read an entire datafile and store it's contents byte per byte into the bank.

The code above shows you how to use a bank by storing the imagehandle into the bank and later on, reading it from the bank to do something (draw it onto the screen).