wondering if anyone knows how to implement a scroll view in cocos2d-x 3.6 (C++). All the tutorials I have found are for earlier cocos2d-x versions.
Thanks
I added my code below, I can get the grey scrollview box to show but it cant be scrolled and the buttons don't appear on it:
header files: "CocosGUI.h" and "cocos-ext.h"
//add scroll view
Size scollFrameSize = Size(visibleSize.width, visibleSize.height/4);
auto scrollView = cocos2d::ui::ScrollView::create();
scrollView->setContentSize(scollFrameSize);
scrollView->setBackGroundColorType(cocos2d::ui::Layout::BackGroundColorType::SOLID);
scrollView->setBackGroundColor(Color3B(200, 200, 200));
scrollView->setPosition(Point(0, visibleSize.height/1.5));
scrollView->setDirection(cocos2d::ui::ScrollView::Direction::HORIZONTAL);
scrollView->setBounceEnabled(true);
scrollView->setTouchEnabled(true);
auto containerSize = Size(scollFrameSize.width*2, scollFrameSize.height*2);
scrollView->setInnerContainerSize(containerSize);
this->addChild(scrollView);
auto button1 = cocos2d::ui::Button::create();
button1->setColor(Color3B(250, 200, 50));
button1->setTouchEnabled(true);
button1->setContentSize(Size(100, 100));
button1->setPosition(Point(containerSize.width / 4, containerSize.height / 2));
scrollView->addChild(button1);
auto button2 = cocos2d::ui::Button::create();
button2->setColor(Color3B(250, 200, 50));
button1->setContentSize(Size(100, 100));
button2->setTouchEnabled(true);
button2->setPosition(Point(containerSize.width / 8, containerSize.height / 2));
scrollView->addChild(button2);
I figured it out, It was scrolling but I added my buttons wrong. For anyone who is interested add a button like this
auto button1 = ui::Button::create();
button1->setTouchEnabled(true);
button1->ignoreContentAdaptWithSize(false);
button1->setContentSize(Size(100, 100));
button1->loadTextures("pic1.png", "pic2.png");
button1->setPosition(Point(containerSize.width / 8, containerSize.height / 2));
scrollView->addChild(button1);