Reputation: 658
I'm building a game with Libgdx, and while implementing the save game using Libgdx preferences, I thought I'd ask if this will also work with iOS (using RoboVM). If not I will have to use another way to save game.
I would test it myself, but I do not currently have any iOS device. So, sorry for that :)
Here's my (simple) save code:
public void saveGame()
{
Json json = new Json();
String result = json.toJson(this.playerCharacter);
Preferences prefs = Gdx.app.getPreferences("Shared");
prefs.putString("SaveGame", result);
prefs.flush();
}
Upvotes: 3
Views: 644
Reputation: 1170
Preferences should work. Several of the libgdx demo games use Preferences and work fine with the RoboVM iOS backend.
Upvotes: 6