Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

Get Image from file(/data/data/com.sgcraft/files/headSelf.jpg) failed!

$
0
0

@q734809128 写道:

android里在上面路径保存了一张图片,然后使用这个图片创建sprite失败,报Get Image from file(/data/data/com.sgcraft/files/headSelf.jpg) failed!错误
使用下面代码创建的

CCImage* img = new CCImage();
img->initWithImageFile(fullpath.c_str());
CCTexture2D* texture = new CCTexture2D();
texture->initWithImage(img);

CCSprite *sprite = CCSprite::create();
sprite->initWithTexture(texture);
sprite->setPosition(ccp(10,320));
CCDirector::sharedDirector()->getRunningScene()->addChild(sprite);

fullpath = /data/data/com.sgcraft/files/headSelf.jpg

帖子: 1

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



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