Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  
Evil Steve


While I'm still not happy with my sprite manager, my texture manager is now fearsome. I expanded my tilesheet manager to do any square textures < 256x256 (I.e. every texture my engine supports). It now breaks the master sheet (which is something like 2048x2048) into 256x256 blocks. Each block can be 256x256, 128x128, 64x64 or 32x32.

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();
std::string strRes;
case 0: case 1: case 2:
strRes = "Data/Test/32.bmp"; ++nCounts[0];
case 3: case 4:
strRes = "Data/Test/64.bmp"; ++nCounts[1];

case 5:
strRes = "Data/Test/128.bmp"; ++nCounts[2];

SmartPointer p = NEW SOSprite("foo");

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:
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.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!