本文整理匯總了Java中com.badlogic.gdx.Preferences.putFloat方法的典型用法代碼示例。如果您正苦於以下問題:Java Preferences.putFloat方法的具體用法?Java Preferences.putFloat怎麽用?Java Preferences.putFloat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.Preferences
的用法示例。
在下文中一共展示了Preferences.putFloat方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setDefaultPrefs
import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void setDefaultPrefs( Preferences prefs )
{
prefs.putBoolean( "pathfindMovement", false );
prefs.putFloat( "musicVolume", 1 );
prefs.putFloat( "ambientVolume", 1 );
prefs.putFloat( "effectVolume", 1 );
prefs.putInteger( "resolutionX", 800 );
prefs.putInteger( "resolutionY", 600 );
prefs.putBoolean( "fullscreen", false );
prefs.putBoolean( "borderless", false );
prefs.putBoolean( "vSync", true );
prefs.putInteger( "fps", 0 );
prefs.putFloat( "animspeed", 1 );
prefs.putInteger( "msaa", 16 );
Global.Controls.defaultArrow();
for ( Controls.Keys key : Controls.Keys.values() )
{
prefs.putInteger( key.toString(), Global.Controls.getKeyCode( key ) );
}
}
示例2: SoundManager
import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
private SoundManager() {
Preferences pref = Gdx.app.getPreferences(GameCore.TITLE);
mEffectsVolume = 1.0f;
mAmbience = AssetHandler.getInstance().getMusic("sound/nature.mp3");
mClicked = AssetHandler.getInstance().getSound("sound/click.wav");
mReleased = AssetHandler.getInstance().getSound("sound/release.wav");
mMove = AssetHandler.getInstance().getSound("sound/move.wav");
if (pref.contains(PreferenceStrings.MUSIC_VOLUME)) {
mAmbience.setVolume(pref.getFloat(PreferenceStrings.MUSIC_VOLUME) / 100.0f);
} else {
pref.putFloat(PreferenceStrings.MUSIC_VOLUME, 1.0f);
}
if (pref.contains(PreferenceStrings.EFFECTS_VOLUME)) {
mEffectsVolume = pref.getFloat(PreferenceStrings.EFFECTS_VOLUME) / 100.0f;
} else {
pref.putFloat(PreferenceStrings.EFFECTS_VOLUME, 1.0f);
}
mAmbience.setLooping(true);
mAmbience.play();
pref.flush();
}
示例3: setDefaultPrefs
import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void setDefaultPrefs( Preferences prefs )
{
prefs.putBoolean( "pathfindMovement", false );
prefs.putFloat( "musicVolume", 1 );
prefs.putFloat( "ambientVolume", 1 );
prefs.putFloat( "effectVolume", 1 );
prefs.putInteger( "resolutionX", 480 );
prefs.putInteger( "resolutionY", 360 );
prefs.putInteger( "fps", 30 );
prefs.putFloat( "animspeed", 1 );
}
示例4: setIn
import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
@Override
public void setIn(final Preferences preferences, final float preferenceValue) {
preferences.putFloat(getName(), preferenceValue);
}
示例5: createAudioOptions
import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void createAudioOptions(ButtonKeyboardHelper keyboardHelper)
{
final Preferences prefs = Global.ApplicationChanger.prefs;
Skin skin = Global.loadSkin();
Table table = new Table();
table.defaults().pad( 5 );
Label musicLabel = new Label("Music Volume", skin);
final Slider musicSlider = new Slider( 0, 100, 1, false, skin );
musicSlider.setValue( Global.MusicVolume * 100 );
keyboardHelper.add( musicSlider, 0, 1 );
Label ambientLabel = new Label("Ambient Volume", skin);
final Slider ambientSlider = new Slider( 0, 100, 1, false, skin );
ambientSlider.setValue( Global.AmbientVolume * 100 );
keyboardHelper.add( ambientSlider );
Label effectLabel = new Label("Effect Volume", skin);
final Slider effectSlider = new Slider( 0, 100, 1, false, skin );
effectSlider.setValue( Global.EffectVolume * 100 );
keyboardHelper.add( effectSlider );
table.add( musicLabel ).expandX().left();
table.row();
table.add( musicSlider ).colspan( 2 ).expandX().fillX();
table.row();
table.add( ambientLabel ).expandX().left();
table.row();
table.add( ambientSlider ).colspan( 2 ).expandX().fillX();
table.row();
table.add( effectLabel ).expandX().left();
table.row();
table.add( effectSlider ).colspan( 2 ).expandX().fillX();
table.row();
saveAudio = new SaveAction() {
@Override
public void save( Preferences prefs )
{
prefs.putFloat( "musicVolume", musicSlider.getValue() / 100.0f );
prefs.putFloat( "ambientVolume", ambientSlider.getValue() / 100.0f );
prefs.putFloat( "effectVolume", effectSlider.getValue() / 100.0f );
}
};
ScrollPane scrollPane = new ScrollPane( table, skin );
scrollPane.setScrollingDisabled( true, false );
scrollPane.setVariableSizeKnobs( true );
scrollPane.setFadeScrollBars( false );
scrollPane.setScrollbarsOnTop( false );
scrollPane.setForceScroll( false, true );
scrollPane.setFlickScroll( false );
keyboardHelper.scrollPane = scrollPane;
tabPanel.addTab( "Audio", scrollPane );
}
示例6: updateVolume
import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
/**
* Adds updated values from the sound settings menu into preferences while
* updating them in-game.
*
* @param musicVolume
* 0 to 100 maximum
* @param effectsVolume
* 0 to 100 maximum
*/
public void updateVolume(float musicVolume, float effectsVolume) {
Preferences pref = Gdx.app.getPreferences(GameCore.TITLE);
pref.putFloat(PreferenceStrings.MUSIC_VOLUME, musicVolume);
pref.putFloat(PreferenceStrings.EFFECTS_VOLUME, effectsVolume);
mAmbience.setVolume(musicVolume / 100.0f);
this.mEffectsVolume = effectsVolume / 100.0f;
}