Cocos2D-X ScrollView Tutorial with fixed button

I had my share of problems with CCScrollView, I think there’s still room for improvement but here is a working example with a fixed menu button.
What I do here is scale an image with info’s on it to the full width of the device and then make it scrollable (vertically). Its still not perfect some adjustments have to be made to the boundaries but works as intended 🙂

  • nino

    What is ( scm->Y_ORIGIN ) ?

    • metin

      ah, thanks for pointing that out. scm is just my scenemanager, a class where I put some global variables, Y_ORIGIN is the visible y point where y begins. normally it would be 0 but in some screen sizes its not.
      you can get the visible screen size and the position of lower left corner from director as long as I can remember.

  • Weng Fu

    Is it risk my CPU to make heavy use scrollview? I was told that it puts strong pull on the graphics chip which make it run hot. If run very hot for time then will make the dragon breath.

    How to make scrollview with small pull on graphics chip but good running? I think this problem is because of language use for job. May be that C++ scrollview has excursion to wrong place frequently.

    The same thing happen if make row of object in scrollview and try to hit them. Often object hit does not bounce up to hit root but instead makes excrement inside the std::vector. After the excrement be deposited, not possible to work the array well. I think this is C++ issue or perhaps compiler trouble.

    You seem to know much about Cocos2D-X ScrollView. Do you think this is C++ problem or problem with design of ScrollView?

    • metin

      c++ is just fine lets focus on ScrollView. I think ScrollView can be better but haven’t heard any memory or resource problems.
      What you can do is do some tests, create an empty ScrollView with no objects and see if your phone heats up, if not then you might be adding too many objects to the ScrollView. About bouncing, yes there is some weird behavior but I must say I haven’t used it in a while so it might be better now in v3. You can also try the new ListView if you haven’t already

Recent Posts

Recent Comments