Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How do I create a CCSprite from a Local file?

$
0
0

I want to load local photo.png file to CCSprite.
So, I used PCLStorage and file stream.


using PCLStorage;

        IFolder rootFolder = await FileSystem.Current.GetFolderFromPathAsync("/storage/emulated/0/Android/data/MyApp.Android/files/Pictures");
        var file = await rootFolder.GetFileAsync("picture.png");
        Stream stream = await file.OpenAsync(FileAccess.Read);
        CCTexture2D texture = new CCTexture2D(stream, CCSurfaceFormat.Color);
        var sprite = new CCSprite(texture);

I think file steam is ok, but it doesn't work in creating CCTexture2D

How can I do that?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>