cocos2d-x3.2 scrollView

前端之家收集整理的这篇文章主要介绍了cocos2d-x3.2 scrollView前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

头部引用.h页面

include “extensions/cocos-ext.h”

include “ui/CocosGUI.h”

USING_NS_CC;
USING_NS_CC_EXT;
using namespace ui;

.cpp页面

ui::ScrollView* scrollView = ui::ScrollView::create();
    scrollView->setContentSize(Size(500,150));
    scrollView->setPosition(Vec2(50,170));
    this->addChild(scrollView);
    scrollView->setInnerContainerSize(Size(500,250));    




auto xs = Label::createWithSystemFont("hello world","Microsoft YaHei",18);
xs->setAnchorPoint(Point(0,0));
xs->setPosition(Point(200,224-i*30));
scrollView->addChild(xs);

这样就可以使用了。这个事我看的官方测试案例里面就有了

猜你在找的Cocos2d-x相关文章