I've been using your Awesomium library for about a day now and am loving it, great work!
To load my HTML pages I'm using the loadHTML function as I load the file from my Resource Manager. The reason for this, is that eventually I'm going to be packing all of my game data, which will mean that:
- Awesomium won't be able to find any external assets that are referenced in the HTML data
- I'll have to leave the assets that Awesomium needs access to outside of the game data pack.
Ideally I'd like to be able to get Awesomium to load from my data pack as its much more optimal and cleaner. This way, any time Awesomium needs to load a resource/assets, i.e. a jpg or a .css, etc it will check to see if a callback has been registered and use that.
Perhaps something like:
In Awesomium:
- Code: Select all
void SetIOHooks( FileOpen, FileRead, FileSize, FileClose );
Each of the arguments above would be function pointers that I could specify.
The function prototypes would look something like:
- Code: Select all
// Here I would ask my resource manager to load the file with this filename.
// I would return to you an object of my liking, most likely a pointer to
// the resource I just loaded.
// Perhaps if I return NULL you can do the default, which is to
// load from disk (If I've turned another option on to allow that?)
void* FileOpen( const TCHAR* filename );
- Code: Select all
// context would contain whatever I returned from FileOpen();
// I'd use it to return the file size of my resource.
int FileSize( void* context );
- Code: Select all
// context would contain whatever I returned from FileOpen();
// buffer is a buffer you've constructed, using the size
// returned from FileSize();
// readSizeBytes would be the amount of bytes you want me
// to copy into buffer (usually FileSize results)
int FileRead( void* context, void* buffer, int readSizeBytes);
- Code: Select all
// Essentially means you are finished with the File Resource
// and I can either close or leave around in my cache.
void FileClose( void* context );
Do you think this would be possible?
Cliff
