weixin_38875381
2017-06-25 02:50c++调用了图片,程序编译通过了,运行不了
#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条回答
为你推荐
- c语言编程,程序编译没错,运行弹出debug,问题在排序模块,把主函数的排序注释掉后不会弹出debug
- c语言
- c++
- 1个回答
- WinXP 32位系统运行程序提示“无法定位程序输入点ucrtbase.terminate于动态链接库api-ms-win-crt-runtime-|1-1-0.dll”上,如何解决?
- 小程序
- c++
- visual studio
- 1个回答
- 如何用VS2012把一个exe封装成dll并调用?
- c语言
- c++
- visual studio
- 1个回答
- 如何卸载assembly?或者class
- net
- c#
- 0个回答
- 代码是否会导致死机,卡屏
- c++
- 1个回答