本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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");
}
示例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;
}