iOS 上 使用CCLabelTTF制作走马灯效果文字狂闪,主要设备是iphone5 iphone5c ipad上。 不知道什么原因。
不好意思 是没描述清楚。
补充 :是2.2.1版本 iphone4 上 是好的 测试机器少无法覆盖更多机型。
iOS 上 使用CCLabelTTF制作走马灯效果文字狂闪,主要设备是iphone5 iphone5c ipad上。 不知道什么原因。
不好意思 是没描述清楚。
补充 :是2.2.1版本 iphone4 上 是好的 测试机器少无法覆盖更多机型。
什么版本 如果是2.1.3的话 是有这个bug 是ccimage里面 initWithXXXX什么的里 w h 是浮点数的原因造成的 强转成int就行了
不好意思 是没描述清楚, 请看我补充回复。
2.2.1版本,楼主麻烦提供下代码。

明早给您测试。
// on “init” you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
this,
menu_selector(HelloWorld::menuCloseCallback));
pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
origin.y + pCloseItem->getContentSize().height/2));
// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 1);
/////////////////////////////
// 3. add your codes below...
// add a label shows "Hello World"
// create and initialize a label
CCLabelTTF* pLabel = CCLabelTTF::create("移动闪屏移动闪屏移动闪屏移动闪屏移动闪屏移动闪屏", "黑体", 24);
// position the label on the center of the screen
pLabel->setPosition(ccp(origin.x + visibleSize.width,
origin.y + visibleSize.height - pLabel->getContentSize().height));
// add the label as a child to this layer
this->addChild(pLabel, 1);
pLabel->runAction(CCMoveTo::create(5, ccp(origin.x, origin.y + visibleSize.height - pLabel->getContentSize().height)));
// // add “HelloWorld” splash screen"
// CCSprite* pSprite = CCSprite::create(“HelloWorld.png”);
//
// // position the sprite on the center of the screen
// pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
//
// // add the sprite as a child to this layer
// this->addChild(pSprite, 0);
return true;
}
// on “init” you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
this,
menu_selector(HelloWorld::menuCloseCallback));
pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
origin.y + pCloseItem->getContentSize().height/2));
// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 1);
/////////////////////////////
// 3. add your codes below...
// add a label shows "Hello World"
// create and initialize a label
CCLabelTTF* pLabel = CCLabelTTF::create("移动闪屏移动闪屏移动闪屏移动闪屏移动闪屏移动闪屏", "黑体", 24);
// position the label on the center of the screen
pLabel->setPosition(ccp(origin.x + visibleSize.width,
origin.y + visibleSize.height - pLabel->getContentSize().height));
// add the label as a child to this layer
this->addChild(pLabel, 1);
pLabel->runAction(CCMoveTo::create(5, ccp(origin.x, origin.y + visibleSize.height - pLabel->getContentSize().height)));
// // add “HelloWorld” splash screen"
// CCSprite* pSprite = CCSprite::create(“HelloWorld.png”);
//
// // position the sprite on the center of the screen
// pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
//
// // add the sprite as a child to this layer
// this->addChild(pSprite, 0);
return true;
}
我用你的代码在3.0 rc1删跑了一下,没有问题啊。
我的开发环境是2.2.1 3.0的还没跑过。