Embedded Ressource

Hello,

is there a way to embed ressource into the code ? like xpm picture file format
for the xpm i imagine a way but not sure if this is a godd idea for the opitmisation of draw calls and spriteframes

or is there a way to protect the ressourcs (audio, video, picture ) from unpacking ?

Thanks for your replies :smile:

If you want it as part of the code, you could encode the binary into base64 and then store that as a string.

The HTML5 project actually stores the loading images using this method, for example in frameworks/cocos2d-html5/Base64Images.js:

cc._loadingImage = "data:image/gif;base64,R0lGODlhE[...]";

Obviously it’d be different in CPP, but the idea should be the same.
See here:


and

It sounds like you don’t want to pass in the meta data at the front like you would in JavaScript, though.

Hope that helps.

its a good idea. you can create spriteframe from buffer also ? if yes, it seems to be good. maybe slow at startup.