weixin_38875381 2017-06-25 02:50 采纳率: 0%
浏览 871

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

#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)
{

}图片说明

  • 写回答

2条回答

  • threenewbee 2017-06-25 04:11
    关注

    以调试方式运行,看错误发生在哪一行。你的资源一会儿正斜杠一会儿反斜杠,肯定有一个是错的。

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?