Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Skin customization


Your current progress on the Scene2D topic allows you to develop a simple UI application without investing a huge effort. However, if you intend to program a more complex game with lots of UI shared assets, you will easily get yourself into a mess.

Skins are the wonderful solution to pack all your UI data into one simple JSON file adding to the aforementioned advantages of using an atlas.

As tends to happen with the data-driven approach, it requires an initial effort that turns into awesome commodities and facilities for the future.

Getting ready

The code for this recipe can be found in the SkinCustomizationSample class within the samples-core project. Please do not forget to visit it in order to run and play with the live example.

How to do it…

Skins can be created in two different ways, but both should make use of a TextureAtlas resource. The first one consists of loading a JSON file with the whole bulk of UI data. To help you to understand the process, an abstract syntax...