I’m trying to create a sprite using an image saved in my application internal data storage, but all i get is a black image.
To clarify I save an image at runtime in the folder /data/data/com.app.packagename/ and try to create a sprite from it by using:
I debugged the code to see what it is happening and I see that the file is found, it reaches the class CCTextureCache passes over this line:
unsigned char* pBuffer = CCFileUtils::sharedFileUtils()->getFileData(fullpath.c_str(), "rb", &nSize);
When I go inside the method getFileData it goes through fopen / fclose and it seems to work correctly because I can see some data in the variable pData and size.
Anyway it completes all the steps from the method CCSprite::create(const char* pFilePath).
Does anyone know if its possible to create an sprite at runtime based on an image from internal storage? Have everyone ever tried?
I don’t know if it is a bug or what I’m doing wrong, the thing is that all I get is a black image and I don’t have any clue where is the error.
I have already checked if the file saved in the /data/data/com.app.packagename/ folder is correct by creating an ImageView and placing it on it and it’s correct. So the problem is not in the file itseft but in the way cocos2d-x is creating the sprite.
Thanks in advance. Any help will be appreciated.