Hi, Emilio, here examples of our vertical scroll.
WOW!
Thanks for your quickly answer!
Sure it will help me.
Hi,
I am using cocos2d-x with html5. I have lot of text added to a layer. I want that text to be within layer boundaries and layer should have scrolling option to view other text.I want to use CCScrollLayer class. How can I add this CCScrollLayer.h file in my application? or I can say how can i load this .h file through cocos2d.js file? Please let me know the solution.
Regards,
Aparajita
Hi,
I am using cocos2dx-html5 for my project. I want scrolling option for my layer. Can any of you please suggest me the solution. The above solution will not work for me. becoz of header file i cannot include in my project, As I am developing on only js files. please let me know the solution as fast as posible.
Thanks in advance. Waiting for solution.
hi there.
nice work you did there - but whatās up with the copyright in your headers?
Kind regards
Updated this scroll layer for Cocos2d-x V2.x - cleaned up some stuff too. Enjoy!
Hello
Iām trying to use the CCScrollView, but I donāt understand the way I need to set the content size and the position.
Can you please point me to an example of CCScrollView ?
Thanks!
Adrian
Adi Fly wrote:
Hello
>
Iām trying to use the CCScrollView, but I donāt understand the way I need to set the content size and the position.
Can you please point me to an example of CCScrollView ?
>
Thanks!
Adrian
@ var container = new cc.Layer.create();
var logo = new cc.Sprite.create(āimage file to testā);
logo.setPosition(new cc.Point(winSize.width/2, winSize.height/2));
container.addChild(logo);@
@
var scrollView = new cc.ScrollView.create(new cc.Size(800, 480), container);
scrollView.setContentSize(new cc.Size(800, 480));
scrollView.setPosition(0, 0);
scrollView.setContentOffset(new cc.Point(0,0));
scrollView.setDirection(cc.SCROLLVIEW_DIRECTION_HORIZONTAL);
this.addChild(scrollView);@
Try to increase/decrease parameters (x coordinate) in cc.ScrollView.create(new cc.Size(800, 480), container) and/or scrollView.setContentSize(new cc.Size(800, 480)) and you will see how it easily works.
I added pageIndicators to your work. It works very well with iPhone and Android.
void CCScrollLayer::visit()
{
CCLayer::visit();
CCLog(āvisit() d of dā, currentScreen, totalScreens);
// Prepare Points Array
float n = (float) totalScreens;
float pY = m_tPagesIndicatorPosition.y; // < Point y-coord in parent coord sys.
float d = 32.0f; // < Distance between points.
CCPoint* points = new CCPoint[totalScreens];
for (int i = 0; i < totalScreens; +i)
{
float pX = m_tPagesIndicatorPosition.x d * ((float)i - 0.5f*(n-1.0f));
points[i] = ccp(pX, pY);
}
// Set GL Values
ccGLEnable(CC_GL_ALL);
ccPointSize(12.0f * CC_CONTENT_SCALE_FACTOR());
#define DRAW_4B_FUNC ccDrawColor4B
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Draw Gray Points
DRAW_4B_FUNC(0x96,0x96,0x96,0xFF);
ccDrawPoints( points, totalScreens );
// Draw White Point for Selected Page
DRAW_4B_FUNC(0xFF,0xFF,0xFF,0xFF);
ccDrawPoint(points[currentScreen-1]);
// Restore GL Values
ccPointSize(1.0f);
delete [] points;
}
how to use scrollview in cocos2d v3.9
plz reply fast ā¦ i am out of my mind