Search code examples
svglibgdxscreenstyling

Evaluating LibGDX


I want to evaluate Libgdx for my app. I want the following things to be possible with Libgdx:

  • The dynamic loading of images. (✔ Texture)
  • Cutting images. (✔ TextureRegion)
  • Support of the multiple screens. (✔ Screen)
  • Recognizing swinging to the right, left, up and down in a defined area. (✔ GestureDetector)

Nice to have:

  • Styling of buttons. (?)
  • Standard elements like lists, ScrollViews etc.(?)
  • SVG graphics rendering (?)

I am thinking about the three problems. I read that GestureDetector should be very slow (500ms) and that SVG graphics are not natively supported and rendered with extensions very slow.

My third concern is that I can't just style buttons the way I want them to, for example: enter image description here

I would like to know if my requirements can be solved with the LibGDX functions and if they are good and easy to use. Thanks for your advice!


Solution

  • LibGDX comes with a sublibrary called Scene2D UI, which defines a bunch of standard UI widgets which can be styled with JSON. It comes with different Button classes and ScrollPane which are your ScrollView substitute.

    Docs you might want for Scene2D UI:

    In regards to SVG rendering, best option is to render them to PNG files if you want to use LibGDX alone.

    Also, you may want to look into TextureAtlas for managing all of your TextureRegions, as well as AssetManager for managing all the external resources in your app https://github.com/libgdx/libgdx/wiki/Managing-your-assets.

    It's a good idea to compile all of your texture files into a single texture, so that not many textures have to be bound and unbound in OpenGL, so have a look at this https://github.com/crashinvaders/gdx-texture-packer-gui this will help you produce a TextureAtlas automatically.