当前位置: 首页>>代码示例>>Java>>正文


Java Preferences.putFloat方法代码示例

本文整理汇总了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 ) );
	}
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:24,代码来源:LwjglApplicationChanger.java

示例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();
	}
 
开发者ID:nkarasch,项目名称:ChessGDX,代码行数:28,代码来源:SoundManager.java

示例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 );
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:14,代码来源:AndroidApplicationChanger.java

示例4: setIn

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
@Override
public void setIn(final Preferences preferences, final float preferenceValue) {
    preferences.putFloat(getName(), preferenceValue);
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:5,代码来源:PreferenceWrapper.java

示例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 );
}
 
开发者ID:infinity8,项目名称:Roguelike,代码行数:62,代码来源:OptionsScreen.java

示例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;
}
 
开发者ID:nkarasch,项目名称:ChessGDX,代码行数:17,代码来源:SoundManager.java


注:本文中的com.badlogic.gdx.Preferences.putFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。