During the development of our last game, we found that it would be very useful to have our custom way to locate or get a resource, something like this:
class MyResourceProvider : pulblic CCResourceProvider {
virtual char *getByName(const string &name, OUT int *size) {
……
}
}
>
CCDirector::sharedDirector()->SetResourceProvider(new MyResourceProvider ());
there’re serveral scenarios this can be used:
- resource update mechanism
Our social game need to check and download new resources from server, so a resource file, say “a.png”, might be located in APK/IPA, or in a custom cache dir. - multi-resolution support
so we can have some custom way to support multi-resolution - …