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


Java Preferences.putInteger方法代码示例

本文整理汇总了Java中com.badlogic.gdx.Preferences.putInteger方法的典型用法代码示例。如果您正苦于以下问题:Java Preferences.putInteger方法的具体用法?Java Preferences.putInteger怎么用?Java Preferences.putInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.Preferences的用法示例。


在下文中一共展示了Preferences.putInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: data

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
void data()
{
	//get a preferences instance
	Preferences prefs = Gdx.app.getPreferences("My Preferences");
	
	highScore=prefs.getInteger("score", 0);
	
	if(score>highScore)
	{
		//put some Integer
		prefs.putInteger("score", score);
		//persist preferences
		prefs.flush();
	}
	
	//get Integer from preferences, 0 is the default value.
	highScore=prefs.getInteger("score", 0);

}
 
开发者ID:yassir-ouali,项目名称:Freaking-Math,代码行数:20,代码来源:MyGame.java

示例2: saveFrameProperties

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public static void saveFrameProperties(JFrame frame) {
    int extendedState = frame.getExtendedState();
    boolean extendedStateChanged = false;
    if (extendedState != Frame.NORMAL) {
        frame.setExtendedState(Frame.NORMAL);
        extendedStateChanged = true;
    }

    Preferences prefs = Gdx.app.getPreferences(PREF_NAME);
    prefs.putInteger("x", frame.getX());
    prefs.putInteger("y", frame.getY());
    prefs.putInteger("width", frame.getWidth());
    prefs.putInteger("height", frame.getHeight());
    prefs.putInteger("extendedState", extendedState != Frame.ICONIFIED ? extendedState : Frame.NORMAL); // Do not save Frame.ICONIFIED
    prefs.flush();

    if (extendedStateChanged) {
        frame.setExtendedState(extendedState);
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:21,代码来源:FramePropertiesPersister.java

示例3: saveWindowParams

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
private void saveWindowParams() {
    int width = Display.getWidth();
    int height = Display.getHeight();
    int x = Display.getX();
    int y = Display.getY();

    //FIXME by some reason actual window position shifted by 6 pixels on Windows (by 12 at y when maximized)
    if (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS) {
        x += 6;
        y += 6;
    }

    Preferences prefs = Gdx.app.getPreferences("window_params.xml");
    prefs.putInteger("x", x);
    prefs.putInteger("y", y);
    prefs.putInteger("width", width);
    prefs.putInteger("height", height);
    prefs.flush();
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:20,代码来源:WindowParamsPersistingApplicationWrapper.java

示例4: storeConfiguration

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public static void storeConfiguration() {
    Preferences prefs = Gdx.app.getPreferences("ss_train_config");
    prefs.putInteger("offset", offset);
    prefs.putInteger("input_offset", inputOffset);
    prefs.putInteger("song_vol", songVolume);
    prefs.putInteger("feedback_vol", feedbackVolume);
    prefs.putString("path_to_beatmaps", pathToBeatmaps);
    prefs.putBoolean("play_hint_sounds", playHintSounds);
    prefs.putInteger("note_speed", noteSpeed);
    prefs.putInteger("overall_difficulty", overallDifficulty);
    prefs.putBoolean("display_line", displayLine);
    prefs.putInteger("sorting_mode", sortMode);
    prefs.putInteger("sorting_order", sortOrder);
    prefs.putInteger("sync_mode", syncMode);
    prefs.flush();
}
 
开发者ID:kbz,项目名称:SSTrain,代码行数:17,代码来源:GlobalConfiguration.java

示例5: storeConfiguration

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public static void storeConfiguration() {
    Preferences prefs = Gdx.app.getPreferences("sif_train_config");
    prefs.putInteger("offset", offset);
    prefs.putInteger("input_offset", inputOffset);
    prefs.putInteger("song_vol", songVolume);
    prefs.putInteger("feedback_vol", feedbackVolume);
    prefs.putString("path_to_beatmaps", pathToBeatmaps);
    prefs.putBoolean("play_hint_sounds", playHintSounds);
    prefs.putInteger("note_speed", noteSpeed);
    prefs.putInteger("overall_difficulty", overallDifficulty);
    prefs.putInteger("sorting_mode", sortMode);
    prefs.putInteger("random_mode", randomMode);
    prefs.putInteger("sorting_order", sortOrder);
    prefs.putInteger("sync_mode", syncMode);
    prefs.flush();
}
 
开发者ID:kbz,项目名称:SIFTrain,代码行数:17,代码来源:GlobalConfiguration.java

示例6: 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

示例7: saveScoreEtc

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public void saveScoreEtc() {
	Preferences prefs = Gdx.app.getPreferences(GameSaves);
	// sum of all scores ever
	totalScoreSum += currentScore;
	prefs.putInteger("total_score_sum", totalScoreSum);
	// games played by player
	++totalGamesPlayed;
	prefs.putInteger("total_games_played", totalGamesPlayed);
	// save top score
	if (topScore < currentScore) {
		topScore = currentScore;
		// Save top score!!!!
		prefs.putInteger("topscore", topScore);
	}
	
	// hack / dont want to kill my ssd
	if (Gdx.app.getType() != ApplicationType.Desktop) {
		prefs.flush();
	}
}
 
开发者ID:igorcrevar,项目名称:GoingUnder,代码行数:21,代码来源:GameManager.java

示例8: saveConfiguration

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public void saveConfiguration() {
    Preferences buttonIndexToKeyCodePreferences = Gdx.app.getPreferences(BUTTON_INDEX_TO_KEY_CODE_PREFERENCES);
    Preferences buttonIndexToButtonPreferences = Gdx.app.getPreferences(BUTTON_INDEX_TO_BUTTON_PREFERENCES);
    buttonIndexToKeyCodePreferences.clear();
    buttonIndexToButtonPreferences.clear();

    for(com.gradualgames.ggvm.Controller.Buttons button: com.gradualgames.ggvm.Controller.Buttons.values()) {
        if (button.isConfigurable()) {
            if (buttonIndexToKeyCode.containsKey(button)) {
                buttonIndexToKeyCodePreferences.putInteger(button.name(), buttonIndexToKeyCode.get(button));
            }
            if (buttonIndexToButton.containsKey(button)) {
                buttonIndexToButtonPreferences.putInteger(button.name(), buttonIndexToButton.get(button));
            }
        }
    }
    buttonIndexToKeyCodePreferences.flush();
    buttonIndexToButtonPreferences.flush();

    Preferences actualAxisToAxisCodePreferences = Gdx.app.getPreferences(ACTUAL_AXIS_TO_AXIS_CODE_PREFERENCES);
    actualAxisToAxisCodePreferences.clear();
    for(Axis axis: Axis.values()) {
        if (actualAxisToAxisCode.containsKey(axis)) {
            actualAxisToAxisCodePreferences.putInteger(axis.name(), actualAxisToAxisCode.get(axis));
        }
    }
    actualAxisToAxisCodePreferences.flush();
}
 
开发者ID:gradualgames,项目名称:ggvm,代码行数:29,代码来源:KeyboardInputProcessor.java

示例9: pause

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
@Override
public void pause() {
    Preferences prefs = Gdx.app.getPreferences("MyPreferences");
    prefs.putInteger("level", level);
    prefs.putInteger("score", score);
    prefs.putInteger("maxscore", maxscore);
    prefs.putInteger("movements", movements);
    prefs.putInteger("maxmovements", maxmovements);
    prefs.flush();
}
 
开发者ID:luarca84,项目名称:Caramelos,代码行数:11,代码来源:CaramelosScreen.java

示例10: setMaxLevel

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public void setMaxLevel(int section, int newMaxLevel) {
    newMaxLevel = Math.min(newMaxLevel, Constants.LEVEL_LIST[section].length);
    if (maxLevel[section] < newMaxLevel) {
        maxLevel[section] = newMaxLevel;
        Preferences prefs = Gdx.app.getPreferences(Constants.PREFERENCES);
        prefs.putInteger("maxlevel_" + section, newMaxLevel);
        prefs.flush();
    }
}
 
开发者ID:pabloalba,项目名称:savethebunny,代码行数:10,代码来源:MerlinGame.java

示例11: setStars

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public void setStars(int section, int level, int stars) {
    int oldStars = getStars(section, level);
    if (oldStars < stars) {
        Preferences prefs = Gdx.app.getPreferences(Constants.PREFERENCES);
        prefs.putInteger("stars_" + section + "_" + level, stars);
        prefs.flush();

        int treasure = getTreasure();
        setTreasure(treasure + stars - oldStars);
    }
}
 
开发者ID:pabloalba,项目名称:savethebunny,代码行数:12,代码来源:MerlinGame.java

示例12: createFont

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
/**
 * Will load font from file. If that fails, font will be generated and saved
 * to file.
 * 
 * @param fontFile
 *            the actual font (.otf, .ttf)
 * @param fontName
 *            the name of the font, i.e. "arial-small", "arial-large",
 *            "monospace-10" This will be used for creating the font file
 *            names
 * @param fontSize
 *            size of font when screen width equals referenceScreenWidth
 * 
 * @return created bitmap fonts object
 */
public BitmapFont createFont(FileHandle fontFile, String fontName, int fontSize) {
	BitmapFont font = null;
	// if fonts are already generated, just load from file
	Preferences fontPrefs = Gdx.app.getPreferences("org.jrenner.smartfont");
	int displayWidth = fontPrefs.getInteger("display-width", 0);
	int displayHeight = fontPrefs.getInteger("display-height", 0);
	boolean loaded = false;
	if (displayWidth != Gdx.graphics.getWidth() || displayHeight != Gdx.graphics.getHeight()) {
		Gdx.app.debug(TAG, "Screen size change detected, regenerating fonts");
	} else {
		try {
			// try to load from file
			Gdx.app.debug(TAG, "Loading generated font from file cache");
			font = new BitmapFont(getFontFile(fontName + ".fnt"));
			loaded = true;
		} catch (GdxRuntimeException e) {
			Gdx.app.error(TAG, e.getMessage());
			Gdx.app.debug(TAG, "Couldn't load pre-generated fonts. Will generate fonts.");
		}
	}
	if (!loaded || forceGeneration) {
		forceGeneration = false;
		float width = Gdx.graphics.getWidth();
		float ratio = width / referenceScreenWidth; // use 1920x1280 as
													// baseline, arbitrary
		float baseSize = 28f; // for 28 sized fonts at baseline width above

		// store screen width for detecting screen size change
		// on later startups, which will require font regeneration
		fontPrefs.putInteger("display-width", Gdx.graphics.getWidth());
		fontPrefs.putInteger("display-height", Gdx.graphics.getHeight());
		fontPrefs.flush();

		font = generateFontWriteFiles(fontName, fontFile, fontSize, pageSize, pageSize);
	}
	return font;
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:53,代码来源:SmartFontGenerator.java

示例13: saveSettings

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
/**
 * Save the settings for this profile
 */
public final void saveSettings() {
	int myCRC=0;
	
	Preferences prefsEditor = Gdx.app.getPreferences(fileName);
	
	// save settings and preferences
	prefsEditor.putBoolean("usemusic", useMusic);
	prefsEditor.putBoolean("usesfx", useSFX);
	prefsEditor.putBoolean("useFullscreen",useFullscreen);
	prefsEditor.putInteger("storedWindowedModeID",storedWindowedModeID);
	
	prefsEditor.putInteger("musicvolume",musicVolume);
	prefsEditor.putInteger("soundvolume",soundVolume);


	for (int i=6; --i>=0;) {
		prefsEditor.putInteger("stickx"+i,stickX[i]);
		prefsEditor.putInteger("sticky"+i,stickY[i]);
	}		
	
	for (int i=16; --i>=0;) {
		prefsEditor.putInteger("keyboardSettings"+i,keyboardSettings[i]);
	}
	
	
	for (int i=12; --i>=0;) {
		prefsEditor.putInteger("controller1"+i,controller1[i]);
		prefsEditor.putInteger("controller2"+i,controller2[i]);
	}
	
	prefsEditor.putInteger("LastMinuteEvent", myCRC);
	
	prefsEditor.flush();
	
	prefsEditor=null;
}
 
开发者ID:orangepascal,项目名称:planetbusters,代码行数:40,代码来源:PlayerProfile.java

示例14: save

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
private void save() {
    Preferences preferences = getPreferences();

    preferences.putInteger("accept_early_game_end", acceptedEarlyGameEnd);
    preferences.putInteger("refuse_early_game_end", refusedEarlyGameEnd);

    preferences.flush();
}
 
开发者ID:yiotro,项目名称:Antiyoy,代码行数:9,代码来源:RefuseStatistics.java

示例15: save

import com.badlogic.gdx.Preferences; //导入方法依赖的package包/类
public void save() {
    Preferences preferences = Gdx.app.getPreferences(key);

    preferences.putBoolean("campaign", campaignMode);
    preferences.putInteger("players", numberOfHumans);
    preferences.putString("date", date);
    preferences.putInteger("level_index", levelIndex);

    replay.setTempSlayRules(GameRules.slayRules);
    replay.setTempColorOffset(gameController.colorIndexViewOffset);
    preferences.flush();

    replay.saveToPreferences(key);
}
 
开发者ID:yiotro,项目名称:Antiyoy,代码行数:15,代码来源:RepSlot.java


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