memory indexing

BlitzMax Forums/BlitzMax Beginners Area/memory indexing

Look at how BlitzMax uses pointers.

You create a pointer like:

Local dest:Byte Ptr

Then to access the elements of memory that it points to, you dereference it with [], like:

dest[y*320+x]=col

which actually is very similar to what your C code says.

You can do:

dest[whateveroffset]=something

and also

something=dest[whateveroffset]

See also TBank for a chunk of contiguous memory, or use a one-dimensional array, but avoid 2 dimensional arrays if you want more efficient contiguous memory.