[Win8] Reading image from device and creating CCSprite

[Win8] Reading image from device and creating CCSprite
0.0 0


I want to access the device’s library and pick a image/photo file from it and use it as a CCSprite in the app. I got the following to access the files:

CCImage * img = new CCImage;
CCTexture2D* tex = new CCTexture2D;

auto task = create_task(Windows::Storage::KnownFolders::PicturesLibrary->GetFilesAsync(Windows::Storage::Search::CommonFileQuery::OrderBySearchRank));

task.then([img,tex](Windows::Foundation::Collections::IVectorView^ files)
    CCLog("num of files detected %d",files->Size);

    Platform::String^ pathstr = files->GetAt(0)->Path;
    char sstrpath[1024]; 


CCSprite* spr = CCSprite::spriteWithTexture(tex);

when i do this, the CCImage and CCTexture2D could not be created. sstrpath shows to contain something like “C:UsersmyNamePicturesCamera Rollpicture001.jpg”. Can I get some advice? I know its possible to get a filestream an then create a BitmapImage object from it, I still need to know if there’s a way to create a CCImage or CCTexture2d or CCSprite from it…


no advice?