I worked on two primary items, both related. The first was to get the latest nightlies of libgdx which now include some UI interfaces such as buttons, sliders, panes, windows, etc. I need these in order to create my user interface. I spent the earlier part of today working on understanding how all of that stuff goes together. Mario Z. has things set up pretty damn nice in that you can use 'skins' to alter the look of your stuff. You do this by referencing an XML file that in turn references a "ninepatch" .png file. Ninepatch, simply stated, is a set of 9 textures that constitute the area of an expandable button. You've go the four corners, which are typically rounded. Then there are the four orthogonal directions. Finally, you have the center piece. This makes a total of 9 parts. They come together and allow buttons (and related graphical items) to look 'nice' when their overall size changes. I expanded what MZ had by adding a 'transparent' pane background for my level select simply by updating a few lines in the XML file. COOL!
The second item I worked on was getting my level select screen implemented. This utilized Java's 'reflection' ability. First, my LevelSelect screen accepts an array of strings that identify the fully qualified class name for a level... such as "com.mypackage.levels.level1". The elements of this array are then used as the button names created by the UI above. Using reflection, I'm able to take the name of the element and create an instance of that class at run-time, depending on which button the user selected.
The code looks like this:
mGame.setScreen(new PlayScreen(mGame,(Level) Class.forName(button.name).newInstance()));
This spawns a new PlayScreen using a reference to the game instance and creating / referencing the level instance the player has chosen.
One of the neat things I think I'll be able to do with the UI panes is make them slide in and out of view when the player hits the menu button. I can adjust the pane location programmatically and use a state machine to do the animation / determine when the menu should be brought it.