1

I see how I can use a statically initialized libgdx table in scrollpane to get a nice short scrolling table.

But I want to be a able to scroll a potentially very large list of items (e.g. pictures with overlayed captions) which needs to load the items at runtime as the scrolling is happening - what is often known as an infinite scroller.

This seems tricky to do because:

  1. There isn't enough GPU memory to store all my items so I need to load/unload dynamically. Not clear how to do this with libgdx. Should I use the asset-manager for this and poll?

  2. Load/unload should happen in a separate thread without interfering with the scrolling animations. For example, some applications show a placeholder image if you scroll too fast.

  3. For performance reasons, it seems I should maintain a single texture of the currently active items. Is there support for runtime packing of this kind?

  4. In iOS, this kind of dynamic scroller is supported by UITableView and dynamic prototypes. Is there something that can simplify this for me for libgdx?

Community
  • 1
  • 1
GroovyDotCom
  • 1,304
  • 2
  • 15
  • 29
  • I understand what you are asking, and I'm not sure how to easily implement it. What kind of items are you storing? Images? Thumbnails? Why is GPU a factor here? The loading/unloading can be done via assetmanager and you can use postRunnable if you need to sync up your content changes with the animation. Why use a single texture for all your items? Seems counter-intuitive as a performance benefit (you'll spend more time/resources building textures on the CPU than rendering a bunch of smaller textures). Some code of what you have done is handy and some images to really clear up the question. – Jyro117 Aug 21 '13 at 19:39
  • My items are large pictures 600x400 pixels with a caption printed over them. So basically I need a long scrolling list of these. My current direction is to implement a new actor called caption-picture and put these into a table in a scrollpane. When draw is called on my captioned-image, I'll check with asset-manager if it is already available and draw it if yes, or draw a place-holder if no. I will also release images that haven't been drawn in a while. Don't think I need postRunnable and can do the AssetManager polling in my draw function as I described. I accept your point on textures. – GroovyDotCom Aug 21 '13 at 21:38
  • 1
    Ah that clears up why you are doing a number of things. Would you know at the start (or shortly after) how many images there would be and the size of them? You might be able to play some tricks with the layout to give the illusion of an infinite scroll. – Jyro117 Aug 21 '13 at 22:16

0 Answers0