Sample code time:
std::vector > vSprites;for(size_t i=0; i<500; ++i){ if((rand()%2 == 0) && (vSprites.size() > 100)) { size_t nOfs = (size_t)rand()%vSprites.size(); vSprites.erase(vSprites.begin()+nOfs); } else { std::string strRes; switch(rand()%6) { case 0: case 1: case 2: strRes = "Data/Test/32.bmp"; ++nCounts[0]; break; case 3: case 4: strRes = "Data/Test/64.bmp"; ++nCounts[1]; break; case 5: strRes = "Data/Test/128.bmp"; ++nCounts[2]; break; } SmartPointer p = NEW SOSprite("foo"); p->SetResource(strRes); vSprites.push_back(p); }}CTextureMgr::Get().Dump();
I have a debug flag to fill all unused / freed texture space with magenta, so I can catch bugs. It'll be slow as shit though, since it locks the texture for every texture deallocation. But anyway, the result of the above code after loading the background map:
![Wootage](http://members.gamedev.net/EvilSteve/JournalStuff/TexmgrDump00.png)
Green dots are "32", red are "64" and the blue things are "128".
Not too shabby. And it works pretty nicely.
I need to have a think about how to do sprites still, I can probably abuse the fact the maps batch sprites anyway, but it still seems pretty expensive to sort them into a multiset prior to rendering.
I'm ill. There's some bug of some sort going around our office, which I've been suffering with for 4 days, but since Beta has been due I decided against taking a day or 2 off. I was considering phoning in sick today, but then I figured I was awake anyway and it wouldn't be too hectic a day so I may as well go in. And similarly, I feel shitty just now but I might as well go in tomorrow since it's the last day of the week and I can sleep most of Saturday before going out to a par-tay at a friends house.
Oh well. Bed.