Game Development Reference
In-Depth Information
This definition file describes the type of widget to be used by specifying its
completely qualified name. Inside the block of a widget definition, you can freely
choose a name. Here we use play, options, background, and so on for our names.
These names are then followed by a colon, which is in turn followed by a comma-
separated list of attributes enclosed in curly brackets that correspond exactly to the
field names of the widget's class. For example, the Image widget has a field called
drawable . Some widgets have an inner class, which is denoted in the JSON file by
appending a dollar sign followed by the name of the style class. These style classes
contain widget-specific fields. We are using such a definition type for the Play and
Options buttons. Both these buttons have a down and up image assigned in their
Button widget.
Lastly, add the following lines of code to Constants to finish our preparations:
public static final String TEXTURE_ATLAS_UI =
"images/canyonbunny-ui.pack";
public static final String TEXTURE_ATLAS_LIBGDX_UI =
"images/uiskin.atlas";
// Location of description file for skins
public static final String SKIN_LIBGDX_UI =
"images/uiskin.json";
public static final String SKIN_CANYONBUNNY_UI =
"images/canyonbunny-ui.json";
The uiskin.atlas and uiskin.json will be downloaded later in this chapter.
Building the scene for the menu screen
We will now begin with the actual implementation of the scene for the menu screen.
First, take a look at the following diagram that shows the hierarchy of the UI scene
graph that we are going to build step-by-step:
 
Search WWH ::




Custom Search