I may have just got this the wrong way round in my head, but is it possible to have something like this:
-- lua code:
texture_handle = resources.add_texture("t_id", "t_file")
sound_handle = resources.add_sound("s_id", "s_file")
template<class T>
class ResourceManager {
public:
unsigned int add(const std::string& type, const std::string& file);
//...
};
class TextureManager : public ResourceManager<Texture> {
//...
} textureManager;
class SoundManager : public ResourceManager<Sound> {
//...
} soundManager;
luabind::module(state) [
// How to register textureManager.add as resources.add_texture
// and soundManager.add as resources.add_sound?
];
?