As I read here: https://github.com/libgdx/libgdx/wiki/Preferences
Preferences files will be saved to ~/.prefs/
(I'm on linux).
When I run desktop app, it works fine, and preferences file is saved to the right place. But with html5, it doesn't save that file! I'm sure it was saved somewhere, because the game still can read it (it contains scores).
My code is really simple, just:
Preferences score = Gdx.app.getPreferences("Highscore");
score.putInteger("score", _points);
score.flush();
I built the game by running
./gradlew html:dist
and run it on localhost created by python
python -m SimpleHTTPServer
then go to http://localhost:8000
on Firefox.
Anyone could help? Thanks for reading, have a nice day.
I found my .prefs in my libgdx html game by running the game in Chrome, right clicking and choosing Inspect Element, clicking on the Resources tab, expanding the Local Storage tab, and examining the entry https://myAppName . This is where the .prefs are kept...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.