سؤال

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();
    }
هل كانت مفيدة؟

المحلول

Preferences should work. Several of the libgdx demo games use Preferences and work fine with the RoboVM iOS backend.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top