为了账号安全,请及时绑定邮箱和手机立即绑定

c++调用了图片,程序编译通过了,运行不了

c++调用了图片,程序编译通过了,运行不了

1325558944 2017-06-24 22:22:43
#include "clockLayer.h"   bool clockLayer::init() {     Size winSize = Director::getInstance()->getWinSize();//获取窗口大小     MenuItemLabel * menuItem = MenuItemLabel::create(Label::createWithSystemFont         ("back","",32),CC_CALLBACK_1(clockLayer::menuCallBack,this));     menuItem->setPosition(Vec2(winSize.width*0.9,winSize.height*0.9));//屏幕右上角     auto menu = Menu::create(menuItem,NULL);     menu->setPosition(Point::ZERO);     this->addChild(menu);       ahour = Sprite::create("resource\shi.png");     ahour->setPosition(Vec2(winSize.width/2,winSize.height/2));     ahour->setScale(0.5);//图片较大,缩放成原来的0.5倍     this->addChild(ahour);       aminute = Sprite::create("resource/fen.jpg");     aminute->setPosition(Vec2(winSize.width/2,winSize.height/2));     aminute->setScale(0.5);//图片较大,缩放成原来的0.5倍     this->addChild(aminute);       asecond = Sprite::create("resource/miao.jpg");     asecond->setPosition(Vec2(winSize.width/2,winSize.height/2));     asecond->setScale(0.5);//图片较大,缩放成原来的0.5倍     this->addChild(asecond);       abackground = Sprite::create("resource\background.jpg"); //  abackground = Sprite::createWithSpriteFrame("resource\background.jpg"); //  abackground = Sprite::create("Mygame\resource\HelloWorld.png");     abackground->setPosition(Vec2(winSize.width*0.5,winSize.height*0.5));     abackground->setScale(0.5);//图片较大,缩放成原来的0.5倍     this->addChild(abackground,1);       return true;   }   void clockLayer::menuCallBack(Ref *pSender) {     } void clockLayer::timeUpdate(float dt) {     }
查看完整描述

1 回答

已采纳
?
MR帽子先生

TA贡献245条经验 获得超106个赞

代码写错了 你图片地址写错了,请仔细检查一下!!!

希望这对你有帮助,祝您学习愉快!

查看完整回答
反对 回复 2017-06-25
  • 1325558944
    1325558944
    图片地址要写源图片地址吗?我看视频老师说添加进来就可以直接使用了
  • 1325558944
    1325558944
    谢谢老师,可以了,是图片没有放到工程里
  • 1 回答
  • 0 关注
  • 1704 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信