summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android/src/ch/asynk/rustanddust/android/AndroidBackend.java12
-rw-r--r--core/src/ch/asynk/rustanddust/Backend.java5
-rw-r--r--core/src/ch/asynk/rustanddust/RustAndDust.java1
-rw-r--r--desktop/src/ch/asynk/rustanddust/desktop/DesktopBackend.java13
4 files changed, 31 insertions, 0 deletions
diff --git a/android/src/ch/asynk/rustanddust/android/AndroidBackend.java b/android/src/ch/asynk/rustanddust/android/AndroidBackend.java
index c1650ad..6e0c581 100644
--- a/android/src/ch/asynk/rustanddust/android/AndroidBackend.java
+++ b/android/src/ch/asynk/rustanddust/android/AndroidBackend.java
@@ -3,13 +3,25 @@ package ch.asynk.rustanddust.android;
import android.app.Application;
import ch.asynk.rustanddust.Backend;
+import ch.asynk.rustanddust.RustAndDust;
public class AndroidBackend implements Backend
{
+ private int me;
+ private int opponent;
private Application app;
public AndroidBackend(Application app)
{
this.app = app;
}
+
+ public int getMyId() { return me; }
+ public int getOpponentId() { return opponent; }
+
+ public void init(RustAndDust game)
+ {
+ me = game.db.storePlayerGetId("me", "myself", "I");
+ opponent = game.db.storePlayerGetId("opponent", "other", "you");
+ }
}
diff --git a/core/src/ch/asynk/rustanddust/Backend.java b/core/src/ch/asynk/rustanddust/Backend.java
index 357304f..ec23aa3 100644
--- a/core/src/ch/asynk/rustanddust/Backend.java
+++ b/core/src/ch/asynk/rustanddust/Backend.java
@@ -2,4 +2,9 @@ package ch.asynk.rustanddust;
public interface Backend
{
+ public void init(RustAndDust game);
+
+ public int getMyId();
+
+ public int getOpponentId();
}
diff --git a/core/src/ch/asynk/rustanddust/RustAndDust.java b/core/src/ch/asynk/rustanddust/RustAndDust.java
index c675966..8e8a384 100644
--- a/core/src/ch/asynk/rustanddust/RustAndDust.java
+++ b/core/src/ch/asynk/rustanddust/RustAndDust.java
@@ -111,6 +111,7 @@ public class RustAndDust extends Game
manager = new AssetManager();
factory = new Factory(this);
config = new Config();
+ backend.init(this);
state = State.NONE;
loadUiAssets();
diff --git a/desktop/src/ch/asynk/rustanddust/desktop/DesktopBackend.java b/desktop/src/ch/asynk/rustanddust/desktop/DesktopBackend.java
index 4b54056..610ac6d 100644
--- a/desktop/src/ch/asynk/rustanddust/desktop/DesktopBackend.java
+++ b/desktop/src/ch/asynk/rustanddust/desktop/DesktopBackend.java
@@ -1,10 +1,23 @@
package ch.asynk.rustanddust.desktop;
+import ch.asynk.rustanddust.RustAndDust;
import ch.asynk.rustanddust.Backend;
public class DesktopBackend implements Backend
{
+ private int me;
+ private int opponent;
+
public DesktopBackend()
{
}
+
+ public int getMyId() { return me; }
+ public int getOpponentId() { return opponent; }
+
+ public void init(RustAndDust game)
+ {
+ me = game.db.storePlayerGetId("me", "myself", "I");
+ opponent = game.db.storePlayerGetId("opponent", "other", "you");
+ }
}