summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2022-08-31 03:13:47 +0600
committerilotterytea <iltsu@alright.party>2022-08-31 03:13:47 +0600
commite53abdfe8ccd11f8589ac4b6aef5ae916cd65901 (patch)
tree7bf65700effb8fb0ff0d04b17f6dc88b749fb69a /core
parent9da7611e250f25463d9ae9474b5932786c32b970 (diff)
initialize the preferences and save&load system
Diffstat (limited to 'core')
-rw-r--r--core/src/com/ilotterytea/maxoning/MaxonGame.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/src/com/ilotterytea/maxoning/MaxonGame.java b/core/src/com/ilotterytea/maxoning/MaxonGame.java
index 84bc6e6..ee59fa9 100644
--- a/core/src/com/ilotterytea/maxoning/MaxonGame.java
+++ b/core/src/com/ilotterytea/maxoning/MaxonGame.java
@@ -1,13 +1,20 @@
package com.ilotterytea.maxoning;
import com.badlogic.gdx.Game;
+import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.Preferences;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
+import com.ilotterytea.maxoning.player.MaxonPlayer;
import com.ilotterytea.maxoning.screens.AssetLoadingScreen;
+import com.ilotterytea.maxoning.utils.serialization.GameDataSystem;
+
+import java.io.IOException;
public class MaxonGame extends Game {
public SpriteBatch batch;
public AssetManager assetManager;
+ public Preferences prefs;
private static MaxonGame instance;
@@ -21,8 +28,18 @@ public class MaxonGame extends Game {
@Override
public void create () {
batch = new SpriteBatch();
+ prefs = Gdx.app.getPreferences("Maxoning");
+
+ if (!GameDataSystem.exists()) {
+ try {
+ GameDataSystem.SaveData(new MaxonPlayer());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
assetManager = new AssetManager();
+
this.setScreen(new AssetLoadingScreen(this));
}
@@ -40,4 +57,8 @@ public class MaxonGame extends Game {
assetManager.dispose();
instance.dispose();
}
+
+ public void registerItems() {
+
+ }
}