Game Development Reference
In-Depth Information
Observe the highlighted code. This code will work in Android,
iOS, and desktop, but might not work in an HTML project and
will show ArrayStoreException . This is due to the GWT
reflection. Alternately, we can substitute this part with the
following code:
Array<CharacterSkin> items = new
Array<CharacterSkin>();
CharacterSkin[] arr = CharacterSkin.values();
for (int i = 0; i < arr.length; i++) {
items.add(arr[i]);
}
selCharSkin.setItems(items);
Next, add the buildOptWinDebug() method to the same class:
private Table buildOptWinDebug () {
Table tbl = new Table();
// + Title: "Debug"
tbl.pad(10, 10, 0, 10);
tbl.add(new Label("Debug", skinLibgdx, "default-font",
Color.RED)).colspan(3);
tbl.row();
tbl.columnDefaults(0).padRight(10);
tbl.columnDefaults(1).padRight(10);
// + Checkbox, "Show FPS Counter" label
chkShowFpsCounter = new CheckBox("", skinLibgdx);
tbl.add(new Label("Show FPS Counter", skinLibgdx));
tbl.add(chkShowFpsCounter);
tbl.row();
return tbl;
}
This method builds a table that contains the debug settings. At the moment, we only
have one checkbox here that allows the player to toggle and checks whether the FPS
Counter is shown or not.
Next, add the buildOptWinButtons() method to the same class:
private Table buildOptWinButtons () {
Table tbl = new Table();
// + Separator
Label lbl = null;
lbl = new Label("", skinLibgdx);
 
Search WWH ::




Custom Search