cocos2dx Version=2.2.3
Visual studio=2012
I am including scrollview as #include “GUI\CCScrollView\CCScrollView.h” but whenever I use ScrollView its not defined. Any help will be appreciated.
statement:CCScrollView *c=CCScrollView::create();
error:“identifier CCScrollView is undefined.”
Have you added
#include "cocos-ext.h"
USING_NS_CC_EXT;
@lazydevx thanks for replying but its not working i including them as
1-#include “cocos-ext.h”
2-#include “GUI\CCScrollView\CCScrollView.h”
3-USING_NS_CC;
but still CCScrollView is undefined
use USING_NS_CC_EXT in place of USING_NS_CC.
@lazydevx thanks alot this worked but i have to use both USING_NS_CC and USING_NS_CC_EXT b/c if we don’t used the first one CCMene etc becomes undefined.
dear waahm7,
Can you help me to solve this problem, i face this error in my project in visual 2012,
i see a sample from internet, but it not work:
//Scroll view
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCLayer* scrollContainer = CCLayer::create(); // Container for the scroll view
scrollContainer->setAnchorPoint(CCPointZero); // CCScrollView does this too when it’s set as the container.
// Content for the container
CCSprite tallContentA = CCSprite::create(“NoButton.png”);
tallContentA ->setPosition(ccp(winSize.width0.5f, winSize.height0.9f));
CCSprite tallContentB = CCSprite::create(“NoButtonPressed.png”);
tallContentB ->setPosition(ccp(winSize.width0.5f, winSize.height0.1f));
scrollContainer->addChild(tallContentA, 2);
scrollContainer->addChild(tallContentB, 2);
float scrollContainerHeight = tallContentA->getContentSize().height + tallContentB->getContentSize().height;
scrollContainer->setPosition(CCPointZero);
scrollContainer->setContentSize(CCSizeMake(winSize.width, scrollContainerHeight*1.05f));
// Set up scroll view
CCScrollView * scrollView = CCScrollView::create(winSize, scrollContainer);
scrollView->setPosition(CCPointZero);
scrollView->setDirection(CCScrollViewDirectionVertical);
// ScrollView initializes at the (left, bottom). The container also gets positioned relative to that and goes Y-up.
// Pre-set it to the value CCScrollView::minContainerOffset will return when it’s scrolled to the top
// (note, this is a negative number, indicating the touch moving downwards, i.e. it’s pre-scrolled such that the top of the content is visible when we begin)
//scrollView->setContentOffset(ccp(0.f, (winSize.height-scrollContainerHeight1.05f)), false);
/
// (StackOverflow Post Edit: This hack is not required.)
// Hack: CCScrollView’s maxContainerOffset is (0, 0) and minContainerOffset is (difference between view and content size which is negative)
// It’s designed to be (left, bottom) based and positive scrolling means showing stuff above the top of the screen.
// Since we’re using it in terms of Window coordinates ((left, top) based), we scale the scroll view
// and it’s container’s children by -1 and position the children differently
// (eg. Y position winSize.height0.1f was changed to winSize.height0.9f)
// We can’t just set the scroll view’s Y scale to -1 because CCNode::getScale asserts that X and Y scale must be the same.
scrollView->setScale(-1.f);
tallContentA->setScale(-1.f);
tallContentB->setScale(-1.f);
*/
//addChild(scrollView);