Original Post
Hi people.
I have here a nice running resource manager, but i need an improvement.
class CSoundFile : public IResource
{
friend class CSoundSystem;
public:
...
void Load()
{
gSoundSystem->Load(this, m_Name);
}
};
bool CSoundSystem::Load(CSoundFile* SoundFile, std::string Filename);
So if i call Load() of a CSoundFile object the CSoundFile will use the gSoundSystem to load itselve.
Ok... nice thing, but i need an way to support different parameters for different resource objects.
Lets have a look at the CSoundFile. So here we can add a paramter for streaming or is3dsound (bool Is3DSound, bool StreamIt).
Every IResource base class has a setup function:
void Setup(String Filename, CacheType CType)
{
// only if the resource is not loaded
if (!m_IsLoaded)
{
m_Name = Filename;
m_CacheType = CType;
m_Id = GetNextID();
}
}
So here is an example from the usage of the ResourceMng.
gSoundSystem->Init(DirectSound);
ResMng.RegisterResource("ding.ogg", RT_MUSIC);
ResMng.RegisterResource("test.ogg", RT_MUSIC);
ResMng.LoadResources();
But now i want that text.ogg is streamed, because it is sooo big.
So how can i support such parameters? I thougt in the function RegisterResource, but the problem is, that every IResource based class can have different numbers of parameters.