coco2d-x3.3 ui::scrollview win32/mac 都白屏 为何?

以前是 android 会白屏, 现在不白了,

win32/mac都白了,为何啊,还能快乐的玩耍吗?

有截图吗。

你的问题比较特殊,加我Q,我看下。

截图:

void ShopView::onEnter()
{
Layer::onEnter();

SpriteFrameCache *frameCache = SpriteFrameCache::getInstance();
frameCache->addSpriteFramesWithFile("menu_ui/shop_view.plist","menu_ui/shop_view.png");


auto bg = cocos2d::extension::Scale9Sprite::createWithSpriteFrame(frameCache->getSpriteFrameByName("shop_bg.png"));


bg->setContentSize(Size(800, 480));
bg->setAnchorPoint(Point::ANCHOR_MIDDLE);
bg->setPosition(Point(400,240));

auto top_title_bg =cocos2d::extension::Scale9Sprite::createWithSpriteFrame(frameCache->getSpriteFrameByName("shop_title_bg.png"));
top_title_bg->setContentSize(Size(800, 98));
top_title_bg->setPosition(bg->getContentSize().width/2, bg->getContentSize().height-top_title_bg->getContentSize().height/2);

auto buttom_title_bg = cocos2d::extension::Scale9Sprite::createWithSpriteFrame(frameCache->getSpriteFrameByName("shop_title_bg.png"));
buttom_title_bg->setContentSize(Size(800, 47));
buttom_title_bg->setPosition(bg->getContentSize().width/2, buttom_title_bg->getContentSize().height/2);


auto title = Sprite::createWithSpriteFrame(frameCache->getSpriteFrameByName("shop_title.png"));
title->setPosition(top_title_bg->getContentSize().width/2,top_title_bg->getContentSize().height/2);
top_title_bg->addChild(title);



ui::ScrollView* scrollView = ui::ScrollView::create();
scrollView->setSize(Size(770.0f, 390.0f));
scrollView->setAnchorPoint(Point::ANCHOR_MIDDLE);
scrollView->setPosition(Point(bg->getContentSize().width/2, 210));
scrollView->setInnerContainerSize(Size(770.0f, 594.0f));
scrollView->setBounceEnabled(true);
for (int i = 0; i < 5; i ++) {
    string diamond_name = "shop_it_bg.png";

    Button* button = Button::create(diamond_name,diamond_name,"",UI_TEX_TYPE_PLIST);

    button->setPosition(Point(button->getSize().width/2+19, 594 - button->getSize().height/2*1.15f - button->getSize().height*1.15f*(i)));
    button->setPressedActionEnabled(false);
    button->addTouchEventListener(this, toucheventselector(ShopView::touchEvent));
    button->setTag(i);
    createBt(button,0,i,frameCache);
    scrollView->addChild(button);  


    string soul_name = "shop_it_bg.png";

    Button* button2 = Button::create(soul_name,soul_name,"",UI_TEX_TYPE_PLIST);



    button2->setPosition(Point(751-button->getSize().width/2, 594 - button->getSize().height/2*1.15f - button->getSize().height*1.15f*(i)));
    button2->setPressedActionEnabled(false);
    button2->addTouchEventListener(this, toucheventselector(ShopView::touchEvent));



    button2->setTag(i+10);
    createBt(button2,1,i,frameCache);
    scrollView->addChild(button2);


}





bg->addChild(scrollView);
bg->addChild(top_title_bg);
bg->addChild(buttom_title_bg);

this->addChild(bg);

}

在3.0 上一点问题 都没,

升级到3.3 问题就来了.:12:

参考下这个帖子 http://www.cocoachina.com/bbs/read.php?tid=195955

楼主解决了么?我刚遇到,弄了半天没解决…:6:

这个不适用win32上出现这个问题哦!

解决了。。3.3
AppDelegate 类里面 添加

void AppDelegate::initGLContextAttrs()
{
//set OpenGL context attributions,now can only set six attributions:
//red,green,blue,alpha,depth,stencil
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};

GLView::setGLContextAttrs(glContextAttrs);

}

又可以快乐的玩耍了。:14:

GLContextAttrs怎么添加啊

AppDelegate.h 加
virtual void initGLContextAttrs();

AppDelegate.cpp 加
void AppDelegate::initGLContextAttrs()
{
//set OpenGL context attributions,now can only set six attributions:
//red,green,blue,alpha,depth,stencil
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};

GLView::setGLContextAttrs(glContextAttrs);

}

就ok了

但是会报错啊 显示没有GLContextAttrs这个

会说找不到这个源文件:6:

升到 3.3版本啊,亲!

不需要引入什么库么

对了 我的是截图的时候出现的这个问题,这样也能解决么

你看看 这是我截图的,那块显示出来的是listview 但是把那个listview删掉后就正常了

我的是3.2版本的

:6: :6: :6: :6: :6: :6: 各种抓狂

可以啊, 一样的问题!:14:,速度升到3.3吧!

可以只改部分代码解决么,现在项目差不多了,移植到3.3好麻烦