Skip to content

Commit 57970fc

Browse files
committed
Remove and refactor xstream
1 parent dcdd33c commit 57970fc

39 files changed

+28
-79
lines changed

AccountConverter.pde

Lines changed: 0 additions & 35 deletions
This file was deleted.

BankApp.pde

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,24 @@ import java.util.*;
22
import java.lang.reflect.Field;
33
import processing.sound.*;
44

5-
import com.thoughtworks.xstream.*;
6-
import com.thoughtworks.xstream.security.*;
75
import controlP5.*;
86

97
String username;
108
String password;
119

12-
// * DB
13-
XStream x = new XStream(new StaxDriver());
14-
PersistenceStrategy strategy;
15-
XmlArrayList l;
10+
ArrayList<Account> accounts = new ArrayList<Account>();
1611

1712
// * Util classes
1813
Assets a = new Assets();
1914
Variables v = new Variables();
20-
TransitionIn transitionIn = new TransitionIn(a, v);
21-
TransitionOut transitionOut = new TransitionOut(a, v);
15+
16+
TransitionIn transitionIn = new TransitionIn(this);
17+
TransitionOut transitionOut = new TransitionOut(this);
2218

2319
// * Game classes
2420
// Table table = new Table(a, v);
25-
Intro intro = new Intro(a, v);
26-
SignIn signIn = new SignIn(a, v);
21+
Intro intro = new Intro(this);
22+
SignIn signIn = new SignIn(this);
2723

2824
void setup() {
2925
size(1000, 1000);
@@ -40,23 +36,10 @@ void setup() {
4036
a._setup(this);
4137
v._setup();
4238

43-
// * SETUP DB
44-
x.addPermission(AnyTypePermission.ANY);
45-
strategy = new FilePersistenceStrategy(new File("/tmp"), x);
46-
47-
l = new XmlArrayList(strategy);
48-
x.alias("account", Account.class);
49-
50-
x.registerConverter(new AccountConverter());
51-
println("Amount of accounts" + l.size());
52-
if (l.size() == 0) {
53-
setupAccounts();
54-
}
55-
5639
// Setup inputs
5740
v.cp5 = new ControlP5(this);
5841
signIn.setup();
59-
42+
setupAccounts();
6043

6144
// * SETUP CLASSES
6245
}
@@ -114,10 +97,10 @@ void setupAccounts() {
11497
Account y = new Account("y", 500, "Yellow");
11598
Account black = new Account("b", 8000, "Black");
11699

117-
l.add(sam);
118-
l.add(r);
119-
l.add(b);
120-
l.add(g);
121-
l.add(y);
122-
l.add(black);
100+
accounts.add(sam);
101+
accounts.add(r);
102+
accounts.add(b);
103+
accounts.add(g);
104+
accounts.add(y);
105+
accounts.add(black);
123106
}

Btn.pde

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public abstract class Btn extends Obj {
3131

3232
public boolean clicked = false;
3333

34-
public Btn(Assets a, Variables v) {
35-
super(a, v);
36-
}
34+
public Btn(BankApp app) { super(app); }
3735

3836
public void setup(){
3937
_setup();

Intro.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ public class Intro extends Obj {
4545
}
4646
}
4747

48-
public Intro(Assets a, Variables v) { super(a, v); }
48+
public Intro(BankApp app) { super(app); }
4949
}

Obj.pde

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
public abstract class Obj {
55
private Assets a;
66
private Variables v;
7+
private BankApp app;
78

8-
public Obj(Assets a, Variables v) {
9-
this.a = a;
10-
this.v = v;
9+
public Obj(BankApp app) {
10+
this.a = app.a;
11+
this.v = app.v;
12+
this.app = app;
1113
}
1214

1315
public void setup() {

SignIn.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ public class SignIn extends Obj {
3535
image(a.signIn, 0, 0);
3636
}
3737

38-
public SignIn(Assets a, Variables v) { super(a, v); }
38+
public SignIn(BankApp app) { super(app); }
3939
}

Table.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ public class Table extends Obj {
1414
rect(0, start, v.w, v.h);
1515
}
1616

17-
public Table(Assets a, Variables v) { super(a, v); }
17+
public Table(BankApp app) { super(app); }
1818
}

Transition.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ public abstract class Transition extends Obj {
7474
beforeDone = false;
7575
}
7676

77-
public Transition(Assets a, Variables v) { super(a, v); }
77+
public Transition(BankApp app) { super(app); }
7878
}

TransitionIn.pde

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* The update method should be called durring each draw for this to work
55
*/
66
public class TransitionIn extends Transition {
7-
public TransitionIn(Assets a, Variables v) {
8-
super(a, v);
7+
public TransitionIn(BankApp app) {
8+
super(app);
99
v.transIn = this;
1010

1111
starting_opacity = 0;
@@ -14,4 +14,5 @@ public class TransitionIn extends Transition {
1414
up = true;
1515
step = 8;
1616
}
17+
1718
}

TransitionOut.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
public class TransitionOut extends Transition {
2-
public TransitionOut(Assets a, Variables v) {
3-
super(a, v);
2+
public TransitionOut(BankApp app) {
3+
super(app);
44
v.transOut = this;
55

66
starting_opacity = 255;

0 commit comments

Comments
 (0)