Game Development Reference
In-Depth Information
private CharacterSkin (String name, float r, float g, float b) {
this.name = name;
color.set(r, g, b, 1.0f);
}
@Override
public String toString () {
return name;
}
public Color getColor () {
return color;
}
}
This class contains three distinct character skins, namely, White , Gray , and Brown .
All character skins are defined using a name that is used for display and RGB color
values to describe a color that will be used to tint the image of the character player.
Building the Options window
Make the following changes in MenuScreen to add the Options window layer:
import com.packtpub.libgdx.canyonbunny.util.CharacterSkin;
import com.packtpub.libgdx.canyonbunny.util.GamePreferences;
private Skin skinLibgdx;
private void loadSettings() {
GamePreferences prefs = GamePreferences.instance;
prefs.load();
chkSound.setChecked(prefs.sound);
sldSound.setValue(prefs.volSound);
chkMusic.setChecked(prefs.music);
sldMusic.setValue(prefs.volMusic);
selCharSkin.setSelectedIndex(prefs.charSkin);
onCharSkinSelected(prefs.charSkin);
chkShowFpsCounter.setChecked(prefs.showFpsCounter);
}
private void saveSettings() {
GamePreferences prefs = GamePreferences.instance;
 
Search WWH ::




Custom Search