當前位置: 首頁>>代碼示例>>Java>>正文


Java Preferences.getInteger方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.Preferences.getInteger方法的典型用法代碼示例。如果您正苦於以下問題:Java Preferences.getInteger方法的具體用法?Java Preferences.getInteger怎麽用?Java Preferences.getInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.Preferences的用法示例。


在下文中一共展示了Preferences.getInteger方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fetchHighScores

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static IntArray fetchHighScores() {
    Preferences prefs = Gdx.app.getPreferences(PREFERENCES_NAME);

    IntArray scores = new IntArray();

    for (int i = 0; i < MAX_NR_SCORES; i++) {
        int score = prefs.getInteger(PREFERENCES_SCORE_NAME + i, -1);

        if (score == -1) {
            break;
        }

        scores.add(score);
    }

    return scores;
}
 
開發者ID:tgobbens,項目名稱:fluffybalance,代碼行數:18,代碼來源:HighScoreController.java

示例2: applyPrefs

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void applyPrefs(Preferences prefs) {
    turn = prefs.getInteger("save_turn");
    playersNumber = prefs.getInteger("save_player_number");
    colorNumber = prefs.getInteger("save_color_number");
    if (colorNumber > FieldController.NEUTRAL_LANDS_INDEX) {
        colorNumber = FieldController.NEUTRAL_LANDS_INDEX;
    }
    levelSize = prefs.getInteger("save_level_size");
    difficulty = prefs.getInteger("save_difficulty");
    GameRules.campaignMode = prefs.getBoolean("save_campaign_mode");
    campaignLevelIndex = prefs.getInteger("save_current_level");
    colorOffset = prefs.getInteger("save_color_offset", 0);
    slayRules = prefs.getBoolean("slay_rules", true);
    fogOfWar = prefs.getBoolean("fog_of_war", false);
    diplomacy = prefs.getBoolean("diplomacy", false);
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:17,代碼來源:LoadingParameters.java

示例3: loadSlot

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public void loadSlot() {
    Preferences prefs = Gdx.app.getPreferences(EDITOR_PREFS);
    String fullLevel = prefs.getString(SLOT_NAME + currentSlotNumber, "");

    LoadingParameters instance = LoadingParameters.getInstance();

    if (fullLevel.length() < 3) {
        instance.mode = LoadingParameters.MODE_EDITOR_NEW;
        instance.levelSize = FieldController.SIZE_BIG;
        instance.playersNumber = 1;
        instance.colorNumber = 5;
        instance.colorOffset = 0;
        instance.difficulty = 1;
    } else {
        instance.mode = LoadingParameters.MODE_EDITOR_LOAD;
        instance.applyFullLevel(fullLevel);
        instance.colorOffset = 0;
    }

    LoadingManager.getInstance().startGame(instance);
    GameRules.editorChosenColor = prefs.getInteger("chosen_color" + currentSlotNumber);

    defaultValues();
}
 
開發者ID:yiotro,項目名稱:Antiyoy,代碼行數:25,代碼來源:LevelEditor.java

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

示例5: loadFrameProperties

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void loadFrameProperties(JFrame frame) {
    Preferences prefs = Gdx.app.getPreferences(PREF_NAME);

    DisplayMode displayMode = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode();
    int screenWidth = displayMode.getWidth();
    int screenHeight = displayMode.getHeight();

    int width = MathUtils.clamp(prefs.getInteger("width", frame.getSize().width), 320, screenWidth);
    int height = MathUtils.clamp(prefs.getInteger("height", frame.getSize().height), 320, screenHeight);
    int x = MathUtils.clamp(prefs.getInteger("x", frame.getLocation().x), 0, screenWidth - width);
    int y = MathUtils.clamp(prefs.getInteger("y", frame.getLocation().y), 0, screenHeight - height);
    int extendedState = prefs.getInteger("extendedState", frame.getExtendedState());

    frame.setSize(width, height);
    frame.setLocation(x, y);
    frame.setExtendedState(extendedState);
}
 
開發者ID:crashinvaders,項目名稱:gdx-texture-packer-gui,代碼行數:18,代碼來源:FramePropertiesPersister.java

示例6: loadTempFilePath

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
protected File loadTempFilePath() {
    try {
        Preferences preferences = Gdx.app.getPreferences(PREFERENCES_FILE);
        int revision = preferences.getInteger(prefKeyFileRevision, -1);
        // Check if the revisions are the same
        if (this.fileRevision != revision) return null;

        String absolutePath = preferences.getString(prefKeyFilePath, null);
        if (absolutePath != null) {
            return new File(absolutePath);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:crashinvaders,項目名稱:gdx-texture-packer-gui,代碼行數:17,代碼來源:KTXProcessor.java

示例7: loadConfiguration

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void loadConfiguration() {
    Preferences prefs = Gdx.app.getPreferences("ss_train_config");
    offset = prefs.getInteger("offset", 0);
    inputOffset = prefs.getInteger("input_offset", 0);
    songVolume = prefs.getInteger("song_vol", 100);
    feedbackVolume = prefs.getInteger("feedback_vol", 100);
    pathToBeatmaps = prefs.getString("path_to_beatmaps", Gdx.files.getExternalStoragePath() + "sstrain");
    playHintSounds = prefs.getBoolean("play_hint_sounds", false);
    noteSpeed = prefs.getInteger("note_speed", 6);
    overallDifficulty = prefs.getInteger("overall_difficulty", 7);
    displayLine = prefs.getBoolean("display_line", true);
    // default to song name sorting
    sortMode = prefs.getInteger("sorting_mode", SongUtils.SORTING_MODE_SONG_NAME);
    // default ascending order
    sortOrder = prefs.getInteger("sorting_order", SongUtils.SORTING_MODE_ASCENDING);
    // sync mode
    syncMode = prefs.getInteger("sync_mode", SongUtils.SYNC_MODE_1);

}
 
開發者ID:kbz,項目名稱:SSTrain,代碼行數:20,代碼來源:GlobalConfiguration.java

示例8: UCIEngineInterface

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
UCIEngineInterface(String PATH) {
	mProcessBuilder = new ProcessBuilder(PATH);
	mService = Executors.newFixedThreadPool(1);
	startEngine();
	mTask = null;

	Preferences pref = Gdx.app.getPreferences(GameCore.TITLE);
	if (pref.getBoolean(PreferenceStrings.DEPTH_SEARCH)) {
		mSearchType = "depth";
		mSearchValue = pref.getInteger(PreferenceStrings.SEARCH_VALUE);
	} else {
		mSearchType = "movetime";
		// seconds to milliseconds
		mSearchValue = pref.getInteger(PreferenceStrings.SEARCH_VALUE) * 1000;
	}
}
 
開發者ID:nkarasch,項目名稱:ChessGDX,代碼行數:17,代碼來源:UCIEngineInterface.java

示例9: loadConfiguration

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void loadConfiguration() {
    Preferences prefs = Gdx.app.getPreferences("sif_train_config");
    offset = prefs.getInteger("offset", 0);
    inputOffset = prefs.getInteger("input_offset", 0);
    songVolume = prefs.getInteger("song_vol", 100);
    feedbackVolume = prefs.getInteger("feedback_vol", 100);
    pathToBeatmaps = prefs.getString("path_to_beatmaps", Gdx.files.getExternalStoragePath() + "beatmaps");
    playHintSounds = prefs.getBoolean("play_hint_sounds", false);
    noteSpeed = prefs.getInteger("note_speed", 6);
    overallDifficulty = prefs.getInteger("overall_difficulty", 7);
    // default to song name sorting
    sortMode = prefs.getInteger("sorting_mode", SongUtils.SORTING_MODE_SONG_NAME);
    sortOrder = prefs.getInteger("sorting_order", SongUtils.SORTING_MODE_ASCENDING);
    // default to the new mode
    randomMode = prefs.getInteger("random_mode", SongUtils.RANDOM_MODE_NEW);
    // sync mode
    syncMode = prefs.getInteger("sync_mode", SongUtils.SYNC_MODE_1);

}
 
開發者ID:kbz,項目名稱:SIFTrain,代碼行數:20,代碼來源:GlobalConfiguration.java

示例10: loadData

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public static void loadData() {
	Preferences prefScores = Gdx.app.getPreferences("Pref_Score");
	if (prefScores.contains("name")) {
		PLAYR_NAME = prefScores.getString("name");
		LEVEL = prefScores.getInteger("level");
		SCORE = prefScores.getInteger("score");
		BEST_SCORE = prefScores.getInteger("bestscore");
		BEST_PLAYR_NAME = prefScores.getString("bestplayer");
	} else {
		// if first application launch
		PLAYR_NAME = "Player";
		LEVEL = 1;
		SCORE = 0;
		BEST_SCORE = SCORE;
		BEST_PLAYR_NAME = PLAYR_NAME;
	}
	System.out.println(BEST_SCORE);
}
 
開發者ID:wasimbeniwale,項目名稱:ArxxusGame,代碼行數:19,代碼來源:Data.java

示例11: updateApplication

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
@Override
public void updateApplication( Preferences pref )
{
	int width = pref.getInteger( "resolutionX" );
	int height = pref.getInteger( "resolutionY" );

	Global.TargetResolution[0] = width;
	Global.TargetResolution[1] = height;
	Global.FPS = pref.getInteger( "fps" );
	Global.AnimationSpeed = 1.0f / pref.getFloat( "animspeed" );

	Global.MovementTypePathfind = pref.getBoolean( "pathfindMovement" );
	Global.MusicVolume = pref.getFloat( "musicVolume" );
	Global.AmbientVolume = pref.getFloat( "ambientVolume" );
	Global.EffectVolume = pref.getFloat( "effectVolume" );
	Global.updateVolume();
}
 
開發者ID:infinity8,項目名稱:Roguelike,代碼行數:18,代碼來源:AndroidApplicationChanger.java

示例12: GameManager

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
public GameManager() {
	isPlayerAlive = false;
	topScore = 0;
	currentScore = 0;
	//load top score, etc
	Preferences prefs = Gdx.app.getPreferences(GameSaves);
	topScore = prefs.getInteger("topscore");
	isSoundOn = prefs.getBoolean("sound_on", true);
	totalGamesPlayed = prefs.getInteger("total_games_played", 0);
	totalScoreSum = prefs.getInteger("total_score_sum", 0);
	
	// add all needed assets to queue
	assetManager.load("fonts/arial64.fnt", BitmapFont.class);
	assetManager.load("atlases/game.atlas", TextureAtlas.class);
	assetManager.load("atlases/widgets.atlas", TextureAtlas.class);
	assetManager.load("sounds/coin.wav", Sound.class);
	assetManager.load("sounds/move.wav", Sound.class);
	assetManager.load("sounds/die.wav", Sound.class);
	assetManager.load("sounds/intro.ogg", Music.class);
}
 
開發者ID:igorcrevar,項目名稱:GoingUnder,代碼行數:21,代碼來源:GameManager.java

示例13: initLabels

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
private void initLabels() {
    Label.LabelStyle style = new Label.LabelStyle();
    style.font = titleFont;

    lbTitle = new Label("SPACE INVADERS", style);
    stage.addActor(lbTitle);

    Preferences preferences = Gdx.app.getPreferences("SpaceInvaders");
    int highScore = preferences.getInteger("high_score", 0);


    style = new Label.LabelStyle();
    style.font = buttonFont;
    lbScore = new Label("Pontuação máxima " + highScore, style);
    stage.addActor(lbScore);
}
 
開發者ID:edvaldoszy,項目名稱:Topicos2015-2,代碼行數:17,代碼來源:MenuScreen.java

示例14: resume

import com.badlogic.gdx.Preferences; //導入方法依賴的package包/類
@Override
public void resume() {
    Preferences prefs = Gdx.app.getPreferences("MyPreferences");
    level = prefs.getInteger("level");
    score = prefs.getInteger("score");
    maxscore = prefs.getInteger("maxscore");
    movements = prefs.getInteger("movements");
    maxmovements = prefs.getInteger("maxmovements");
}
 
開發者ID:luarca84,項目名稱:Caramelos,代碼行數:10,代碼來源:CaramelosScreen.java

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


注:本文中的com.badlogic.gdx.Preferences.getInteger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。