diff options
28 files changed, 563 insertions, 509 deletions
@@ -2,6 +2,7 @@ | |||
2 | <classpath> | 2 | <classpath> |
3 | <classpathentry kind="src" path="src"/> | 3 | <classpathentry kind="src" path="src"/> |
4 | <classpathentry kind="src" path="res"/> | 4 | <classpathentry kind="src" path="res"/> |
5 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> | 5 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
6 | <classpathentry kind="output" path="bin"/> | 6 | <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> |
7 | <classpathentry kind="output" path="war/WEB-INF/classes"/> | ||
7 | </classpath> | 8 | </classpath> |
@@ -9,7 +9,7 @@ target/ | |||
9 | *.class | 9 | *.class |
10 | 10 | ||
11 | # Package Files # | 11 | # Package Files # |
12 | *.jar | 12 | #*.jar |
13 | *.war | 13 | *.war |
14 | *.ear | 14 | *.ear |
15 | *.db | 15 | *.db |
@@ -83,4 +83,15 @@ local.properties | |||
83 | ###################### | 83 | ###################### |
84 | 84 | ||
85 | report/out/** | 85 | report/out/** |
86 | report/tmp/** \ No newline at end of file | 86 | report/tmp/** |
87 | |||
88 | ###################### | ||
89 | # GWT | ||
90 | ###################### | ||
91 | |||
92 | .gwt | ||
93 | gwt-unitCache | ||
94 | war/esieequest | ||
95 | war/WEB-INF/classes | ||
96 | war/WEB-INF/deploy | ||
97 | war/WEB-INF/lib | ||
@@ -11,13 +11,30 @@ | |||
11 | </arguments> | 11 | </arguments> |
12 | </buildCommand> | 12 | </buildCommand> |
13 | <buildCommand> | 13 | <buildCommand> |
14 | <name>org.eclipse.wst.common.project.facet.core.builder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
14 | <name>org.eclipse.jdt.core.javabuilder</name> | 19 | <name>org.eclipse.jdt.core.javabuilder</name> |
15 | <arguments> | 20 | <arguments> |
16 | </arguments> | 21 | </arguments> |
17 | </buildCommand> | 22 | </buildCommand> |
23 | <buildCommand> | ||
24 | <name>com.google.gdt.eclipse.core.webAppProjectValidator</name> | ||
25 | <arguments> | ||
26 | </arguments> | ||
27 | </buildCommand> | ||
28 | <buildCommand> | ||
29 | <name>com.google.gwt.eclipse.core.gwtProjectValidator</name> | ||
30 | <arguments> | ||
31 | </arguments> | ||
32 | </buildCommand> | ||
18 | </buildSpec> | 33 | </buildSpec> |
19 | <natures> | 34 | <natures> |
20 | <nature>net.sourceforge.texlipse.builder.TexlipseNature</nature> | 35 | <nature>net.sourceforge.texlipse.builder.TexlipseNature</nature> |
21 | <nature>org.eclipse.jdt.core.javanature</nature> | 36 | <nature>org.eclipse.jdt.core.javanature</nature> |
37 | <nature>com.google.gwt.eclipse.core.gwtNature</nature> | ||
38 | <nature>org.eclipse.wst.common.project.facet.core.nature</nature> | ||
22 | </natures> | 39 | </natures> |
23 | </projectDescription> | 40 | </projectDescription> |
diff --git a/src/esieequest/Main.java b/src/esieequest/Main.java index add0fb1..5a08f1d 100755 --- a/src/esieequest/Main.java +++ b/src/esieequest/Main.java | |||
@@ -1,13 +1,15 @@ | |||
1 | package esieequest; | 1 | package esieequest; |
2 | 2 | ||
3 | import java.util.Arrays; | ||
4 | |||
3 | import javax.swing.JApplet; | 5 | import javax.swing.JApplet; |
4 | 6 | ||
5 | import esieequest.controller.GameEngine; | 7 | import esieequest.controller.GameEngine; |
6 | import esieequest.model.Game; | 8 | import esieequest.model.Game; |
7 | import esieequest.view.Applet; | ||
8 | import esieequest.view.Console; | ||
9 | import esieequest.view.View; | 9 | import esieequest.view.View; |
10 | import esieequest.view.Window; | 10 | import esieequest.view.app.Applet; |
11 | import esieequest.view.app.Window; | ||
12 | import esieequest.view.console.Console; | ||
11 | 13 | ||
12 | /** | 14 | /** |
13 | * This class instantiates the game and makes it possible to run it via the | 15 | * This class instantiates the game and makes it possible to run it via the |
@@ -28,9 +30,8 @@ public class Main extends JApplet { | |||
28 | public void init() { | 30 | public void init() { |
29 | // applet | 31 | // applet |
30 | Game vGame = new Game(); | 32 | Game vGame = new Game(); |
31 | Applet vApplet = new Applet(vGame, this); | 33 | Applet vApplet = new Applet(this); |
32 | vGame.addObserver(vApplet); | 34 | new GameEngine(vGame, vApplet); |
33 | GameEngine vGameEngine = new GameEngine(vGame, vApplet); | ||
34 | } | 35 | } |
35 | 36 | ||
36 | public static void main(final String[] pArgs) { | 37 | public static void main(final String[] pArgs) { |
@@ -38,15 +39,14 @@ public class Main extends JApplet { | |||
38 | Game vGame = new Game(); | 39 | Game vGame = new Game(); |
39 | View vView; | 40 | View vView; |
40 | 41 | ||
41 | if (pArgs.length != 0) { | 42 | if (Arrays.asList(pArgs).contains("--nogui")) { |
42 | vView = new Console(vGame); | 43 | vView = new Console(); |
43 | 44 | ||
44 | } else { | 45 | } else { |
45 | vView = new Window(vGame); | 46 | vView = new Window(); |
46 | } | 47 | } |
47 | 48 | ||
48 | vGame.addObserver(vView); | 49 | new GameEngine(vGame, vView); |
49 | GameEngine vGameEngine = new GameEngine(vGame, vView); | ||
50 | } | 50 | } |
51 | 51 | ||
52 | } | 52 | } |
diff --git a/src/esieequest/controller/GameEngine.java b/src/esieequest/controller/GameEngine.java index 72de63a..3999cd0 100644 --- a/src/esieequest/controller/GameEngine.java +++ b/src/esieequest/controller/GameEngine.java | |||
@@ -1,8 +1,5 @@ | |||
1 | package esieequest.controller; | 1 | package esieequest.controller; |
2 | 2 | ||
3 | import java.awt.event.ActionEvent; | ||
4 | import java.awt.event.ActionListener; | ||
5 | |||
6 | import esieequest.model.Game; | 3 | import esieequest.model.Game; |
7 | import esieequest.view.View; | 4 | import esieequest.view.View; |
8 | 5 | ||
@@ -15,7 +12,7 @@ import esieequest.view.View; | |||
15 | * | 12 | * |
16 | * @version February 2014 | 13 | * @version February 2014 |
17 | */ | 14 | */ |
18 | public class GameEngine implements ActionListener { | 15 | public class GameEngine { |
19 | 16 | ||
20 | private Game aGame; | 17 | private Game aGame; |
21 | private View aView; | 18 | private View aView; |
@@ -26,9 +23,10 @@ public class GameEngine implements ActionListener { | |||
26 | this.aGame = pGame; | 23 | this.aGame = pGame; |
27 | this.aView = pView; | 24 | this.aView = pView; |
28 | 25 | ||
29 | this.aInterpreter = new Interpreter(this.aGame, this.aView); | 26 | this.aView.setModel(pGame); |
27 | this.aView.setController(this); | ||
30 | 28 | ||
31 | this.aView.setActionListener(this); | 29 | this.aInterpreter = new Interpreter(this.aGame, this.aView); |
32 | 30 | ||
33 | this.startGame(); | 31 | this.startGame(); |
34 | this.startView(); | 32 | this.startView(); |
@@ -40,12 +38,11 @@ public class GameEngine implements ActionListener { | |||
40 | } | 38 | } |
41 | 39 | ||
42 | private void startView() { | 40 | private void startView() { |
43 | this.aView.start(); | 41 | this.aView.enable(); |
44 | } | 42 | } |
45 | 43 | ||
46 | @Override | 44 | public void interpret(final String pCommandString) { |
47 | public void actionPerformed(final ActionEvent pActionEvent) { | 45 | this.aInterpreter.interpret(pCommandString); |
48 | this.aInterpreter.interpret(pActionEvent.getActionCommand()); | ||
49 | } | 46 | } |
50 | 47 | ||
51 | } | 48 | } |