CCScrollView 사용법
Cocos2Dx 2013. 8. 10. 17:25 | CCLayerColor *layer = CCLayerColor::create(ccc4(0,0,255,255));
layer->setContentSize(CCSize(480,1000));
CCScale9Sprite *spr = CCScale9Sprite::create("extensions/green_edit.png");
spr->setContentSize(CCSize(400,50));
spr->setPosition(ccp(240,900));
layer->addChild(spr);
CCScale9Sprite *spr2 = CCScale9Sprite::create("extensions/yellow_edit.png");
spr2->setContentSize(CCSize(400,50));
spr2->setPosition(ccp(240,100));
layer->addChild(spr2);
CCScrollView *scroll = CCScrollView::create(CCSize(480,320));
scroll->setContainer(layer);
scroll->setContentSize(layer->getContentSize());
scroll->setAnchorPoint(CCPointZero);
scroll->setPosition(ccp(0,0));
scroll->setDirection(kCCScrollViewDirectionVertical);
scroll->setContentOffset(ccp(0,-(1000-320))); // 시작위치 설정
// kCCScrollViewDirectionBoth, kCCScrollViewDirectionHorizontal, kCCScrollViewDirectionVertical, kCCScrollViewDirectionNone
scroll->setContentOffsetInDuration(ccp(0,0), 5.0); // 자동 스크롤
scroll->setBounceable(true);
this->addChild(scroll);
'Cocos2Dx' 카테고리의 다른 글
cocos2d-x 빌드 오류 해결 (0) | 2013.11.14 |
---|---|
pugixml cocos2d-x (0) | 2013.10.09 |
(cocos2d-x) 하위 노드 터치 불가 만들기 및 복구하기 (0) | 2013.06.25 |
Sprite 텍스처 교체 (0) | 2013.06.06 |
cocos2dx android 프로젝트 생성 시 오류 해결 법. (0) | 2013.06.01 |