I found IDs very tiresome if you're not using an OOP library or something. I know, this is a simple and easy thing to do, but I also understand there are some people like me a week ago. I know, I haven't progressed a whole lot, but to me, it is a lot.
class IDManager
{
public:
int numberofImages;
int numberofObjects;
int numberofMeshes;
int numberofSprites;
void Initiate()
{
numberofImages=0;
numberofObjects=0;
numberofMeshes=0;
numberofSprites=0;
};
int loadImage(char *fileName, int TextureFlag)
{
numberofImages++;
int thisId = numberofImages;
dbLoadImage(fileName, thisId, TextureFlag);
return thisId;
}
int loadObject(char *fileName)
{
numberofObjects++;
int thisId = numberofObjects;
dbLoadObject(fileName, thisId);
return thisId;
}
int loadMesh(char *fileName)
{
numberofMeshes++;
int thisId = numberofMeshes;
dbLoadMesh(fileName, thisId);
return thisId;
}
int createSprite()
{
numberofSprites++;
int thisId = numberofSprites;
return thisId;
}
};
It's incomplete right now, but it works. I'll add more stuff soon. If you use this all the time, you won't have to worry about finding an open ID.
Updates:
* Added Sprite function, renamed class to be more appropriate.
Please don't flame me for this, I'm just trying to help newbies.
If you can do any models for FW, reply to the FleetWars thread.
Click here!