creating unique image handles

Blitz3D Forums/Blitz3D Programming/creating unique image handles

Chevron(Posted 2005) [#1]
Hi,
Maybe a daft question but is it possible to create unique image handles from within a Blitz program.
i.e I want to load x number of images and assign each with its own image handle, but the total number is not known until the code is run.

Would it be possible to use image+the number of the image loaded as the handle?

i.e
image001,image002.....


poopla(Posted 2005) [#2]
Graphics 800, 600
SetBuffer BackBuffer()

img1 = LoadImage("Monster.png")
img2 = LoadImage("Monster.png")
img3 = LoadImage("Monster.png")

Print img1
Print img2
Print img3

WaitKey()


The handles themselves are non sequeential as you can see so that won't work.

You can't apply a handle to an image as the handle returned IS unique to that image.

Can't you just store them in an array?

A bank would work well.


Chevron(Posted 2005) [#3]
I want to be able to create image buttons within XLint. So each button will need to be given its own handle.

So i wouldn't be able to use banks etc.

I do have a workaround but its real messy and would prefer to be able to do it properly.

Its a shame that you cant assign an image handle from a name held in a string


octothorpe(Posted 2005) [#4]
Its a shame that you cant assign an image handle from a name held in a string


String lookups? You want Hash Tables.

But I don't understand why you can't simply use a basic array, which can be resized dynamically.


Chevron(Posted 2005) [#5]
Thanks octothorpe, i can use an array, must have been having a mind block tonight.