Back to project page FloppyThreeD.
The source code is released under:
MIT License
If you think the Android project FloppyThreeD listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jtechapps.FloppyThreeD; /*from w ww . j a va 2 s .co m*/ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; public class ScoreManager { /** * Compares the players score and if the new score is higher then it will set the new high score. * @param score score to compare to high score. * @return true if score is a new highscore */ public boolean compareScore(int score){ if(score>getHighScore()){ setHighScore(score); return true; } else { return false; } } public int getHighScore(){ Preferences prefs = Gdx.app.getPreferences("FloppyThreeD"); int highscore = prefs.getInteger("highscore", 0); return highscore; } public void setHighScore(int scoretoset){ Preferences prefs = Gdx.app.getPreferences("FloppyThreeD"); prefs.putInteger("highscore", scoretoset); prefs.flush(); } }