Adean / Variants Of Power

We need to manage all of the Textures that will be used. Alot of the textures will be used more than once so it would be nice not having to waste the time to reload them all the time. Here's my first attempt at a very basic Texture Manager.
Large Version

Ok, basically this will just accept either a Texture and an ID (of which I think will be a string or a set of numbers) or it will take a String file path and an ID. It'll load the Texture and ID into a SingleTexture class and then store it into an ArrayList for later retrieval. Then when the GetTex method is called it will go through a quick loop to find the ID that's requested and send out the Texture. This way we can keep the memory as low as possible and keep the processing time to load the image over and over out of the picture completely. And one other thing I realized just now is that I didn't write down the removal method, which of course will just remove a SingleTexture class from the ArrayList by ID. I'm not sure if there's a better way of doing this or not, any suggestions would be welcomed.

Print | posted on Tuesday, May 30, 2006 11:10 PM

Comments on this post

# re: Adean / Variants Of Power

Requesting Gravatar...
From the sounds of your usage you would be much better putting the data in a hash table as opposed to an arraylist ..

lookups of O(1) compared to O(N)

Cheers,

Greg Young
Left by Greg Young on May 31, 2006 12:52 AM

Your comment:

 (will show your gravatar)