aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.classpath4
-rw-r--r--build.xml4
-rw-r--r--lib/easyogg.jarbin0 -> 9520 bytes
-rw-r--r--lib/jogg-0.0.7.jarbin0 -> 6839 bytes
-rw-r--r--lib/jorbis-0.0.15.jarbin0 -> 58917 bytes
-rw-r--r--lib/startup2.jarbin0 -> 104522 bytes
-rw-r--r--res/res/snd/END.oggbin0 -> 1155224 bytes
-rw-r--r--res/res/snd/FEED_ATHANASE.oggbin0 -> 513150 bytes
-rw-r--r--res/res/snd/FIND_CONSOLE.oggbin0 -> 1627908 bytes
-rw-r--r--res/res/snd/FIND_DISK.oggbin0 -> 969007 bytes
-rw-r--r--res/res/snd/INSTALL_CONSOLE.oggbin0 -> 1719262 bytes
-rw-r--r--res/res/snd/INTRO.oggbin0 -> 923189 bytes
-rw-r--r--res/res/snd/RUN_CONSOLE.oggbin0 -> 121718 bytes
-rw-r--r--res/res/snd/WHAT_HAPPENED.oggbin0 -> 2019139 bytes
-rw-r--r--src/esieequest/view/app/UserInterface.java97
15 files changed, 96 insertions, 9 deletions
diff --git a/.classpath b/.classpath
index e0c30ac..90df3ec 100644
--- a/.classpath
+++ b/.classpath
@@ -7,5 +7,9 @@
7 <classpathentry kind="lib" path="lib/guava-16.0.1.jar"/> 7 <classpathentry kind="lib" path="lib/guava-16.0.1.jar"/>
8 <classpathentry kind="lib" path="lib/guava-gwt-16.0.1.jar"/> 8 <classpathentry kind="lib" path="lib/guava-gwt-16.0.1.jar"/>
9 <classpathentry kind="lib" path="lib/lombok.jar"/> 9 <classpathentry kind="lib" path="lib/lombok.jar"/>
10 <classpathentry kind="lib" path="lib/easyogg.jar"/>
11 <classpathentry kind="lib" path="lib/jogg-0.0.7.jar"/>
12 <classpathentry kind="lib" path="lib/jorbis-0.0.15.jar"/>
13 <classpathentry kind="lib" path="lib/startup2.jar"/>
10 <classpathentry kind="output" path="war/WEB-INF/classes"/> 14 <classpathentry kind="output" path="war/WEB-INF/classes"/>
11</classpath> 15</classpath>
diff --git a/build.xml b/build.xml
index fe7a851..1f76860 100644
--- a/build.xml
+++ b/build.xml
@@ -22,6 +22,10 @@
22 <copy todir="war/WEB-INF/lib" file="lib/guava-16.0.1.jar" /> 22 <copy todir="war/WEB-INF/lib" file="lib/guava-16.0.1.jar" />
23 <copy todir="war/WEB-INF/lib" file="lib/guava-gwt-16.0.1.jar" /> 23 <copy todir="war/WEB-INF/lib" file="lib/guava-gwt-16.0.1.jar" />
24 <copy todir="war/WEB-INF/lib" file="lib/lombok.jar" /> 24 <copy todir="war/WEB-INF/lib" file="lib/lombok.jar" />
25 <copy todir="war/WEB-INF/lib" file="lib/easyogg.jar" />
26 <copy todir="war/WEB-INF/lib" file="lib/jogg-0.0.7.jar" />
27 <copy todir="war/WEB-INF/lib" file="lib/jorbis-0.0.15.jar" />
28 <copy todir="war/WEB-INF/lib" file="lib/startup2.jar" />
25 </target> 29 </target>
26 30
27 <target name="javac" depends="libs" description="Compile java source to bytecode"> 31 <target name="javac" depends="libs" description="Compile java source to bytecode">
diff --git a/lib/easyogg.jar b/lib/easyogg.jar
new file mode 100644
index 0000000..bf70633
--- /dev/null
+++ b/lib/easyogg.jar
Binary files differ
diff --git a/lib/jogg-0.0.7.jar b/lib/jogg-0.0.7.jar
new file mode 100644
index 0000000..1cbd1ad
--- /dev/null
+++ b/lib/jogg-0.0.7.jar
Binary files differ
diff --git a/lib/jorbis-0.0.15.jar b/lib/jorbis-0.0.15.jar
new file mode 100644
index 0000000..4cf51f9
--- /dev/null
+++ b/lib/jorbis-0.0.15.jar
Binary files differ
diff --git a/lib/startup2.jar b/lib/startup2.jar
new file mode 100644
index 0000000..697ed76
--- /dev/null
+++ b/lib/startup2.jar
Binary files differ
diff --git a/res/res/snd/END.ogg b/res/res/snd/END.ogg
new file mode 100644
index 0000000..db2b370
--- /dev/null
+++ b/res/res/snd/END.ogg
Binary files differ
diff --git a/res/res/snd/FEED_ATHANASE.ogg b/res/res/snd/FEED_ATHANASE.ogg
new file mode 100644
index 0000000..94e8668
--- /dev/null
+++ b/res/res/snd/FEED_ATHANASE.ogg
Binary files differ
diff --git a/res/res/snd/FIND_CONSOLE.ogg b/res/res/snd/FIND_CONSOLE.ogg
new file mode 100644
index 0000000..39aee7e
--- /dev/null
+++ b/res/res/snd/FIND_CONSOLE.ogg
Binary files differ
diff --git a/res/res/snd/FIND_DISK.ogg b/res/res/snd/FIND_DISK.ogg
new file mode 100644
index 0000000..b852de2
--- /dev/null
+++ b/res/res/snd/FIND_DISK.ogg
Binary files differ
diff --git a/res/res/snd/INSTALL_CONSOLE.ogg b/res/res/snd/INSTALL_CONSOLE.ogg
new file mode 100644
index 0000000..fe7a296
--- /dev/null
+++ b/res/res/snd/INSTALL_CONSOLE.ogg
Binary files differ
diff --git a/res/res/snd/INTRO.ogg b/res/res/snd/INTRO.ogg
new file mode 100644
index 0000000..da90187
--- /dev/null
+++ b/res/res/snd/INTRO.ogg
Binary files differ
diff --git a/res/res/snd/RUN_CONSOLE.ogg b/res/res/snd/RUN_CONSOLE.ogg
new file mode 100644
index 0000000..8c43dd1
--- /dev/null
+++ b/res/res/snd/RUN_CONSOLE.ogg
Binary files differ
diff --git a/res/res/snd/WHAT_HAPPENED.ogg b/res/res/snd/WHAT_HAPPENED.ogg
new file mode 100644
index 0000000..0aac689
--- /dev/null
+++ b/res/res/snd/WHAT_HAPPENED.ogg
Binary files differ
diff --git a/src/esieequest/view/app/UserInterface.java b/src/esieequest/view/app/UserInterface.java
index facc706..ed8e78f 100644
--- a/src/esieequest/view/app/UserInterface.java
+++ b/src/esieequest/view/app/UserInterface.java
@@ -12,9 +12,12 @@ import java.awt.event.FocusEvent;
12import java.awt.event.FocusListener; 12import java.awt.event.FocusListener;
13import java.awt.event.KeyEvent; 13import java.awt.event.KeyEvent;
14import java.awt.image.BufferedImage; 14import java.awt.image.BufferedImage;
15import java.io.IOException;
15import java.net.URL; 16import java.net.URL;
16import java.util.HashMap; 17import java.util.HashMap;
17import java.util.Map.Entry; 18import java.util.Map.Entry;
19import java.util.Timer;
20import java.util.TimerTask;
18 21
19import javax.swing.AbstractAction; 22import javax.swing.AbstractAction;
20import javax.swing.JButton; 23import javax.swing.JButton;
@@ -28,6 +31,8 @@ import javax.swing.border.EmptyBorder;
28 31
29import lombok.Getter; 32import lombok.Getter;
30 33
34import org.newdawn.easyogg.OggClip;
35
31import com.wordpress.tipsforjava.swing.StretchIcon; 36import com.wordpress.tipsforjava.swing.StretchIcon;
32 37
33import esieequest.controller.GameEngine; 38import esieequest.controller.GameEngine;
@@ -54,7 +59,7 @@ abstract class UserInterface implements Viewable, ActionListener {
54 private static final String ILLUSTRATION_DIR = "res/frame/"; 59 private static final String ILLUSTRATION_DIR = "res/frame/";
55 private static final String ILLUSTRATION_EXT = ".html"; 60 private static final String ILLUSTRATION_EXT = ".html";
56 61
57 private static final String SOUND_DIR = "res/audio/"; 62 private static final String SOUND_DIR = "res/snd/";
58 private static final String SOUND_EXT = ".ogg"; 63 private static final String SOUND_EXT = ".ogg";
59 64
60 private GameEngine gameEngine; 65 private GameEngine gameEngine;
@@ -98,6 +103,12 @@ abstract class UserInterface implements Viewable, ActionListener {
98 private JButton leftButton; 103 private JButton leftButton;
99 private JButton rightButton; 104 private JButton rightButton;
100 105
106 private final Timer timer;
107 private TimerTask timerTask;
108
109 private OggClip audio;
110 private boolean muted;
111
101 /** 112 /**
102 * The default constructor. 113 * The default constructor.
103 */ 114 */
@@ -107,6 +118,8 @@ abstract class UserInterface implements Viewable, ActionListener {
107 this.bindKeys(); 118 this.bindKeys();
108 this.bindFocus(); 119 this.bindFocus();
109 this.setControlsState(false); 120 this.setControlsState(false);
121 this.timer = new Timer();
122 this.muted = false;
110 } 123 }
111 124
112 /** 125 /**
@@ -310,6 +323,20 @@ abstract class UserInterface implements Viewable, ActionListener {
310 }); 323 });
311 } 324 }
312 325
326 this.layout.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
327 KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), KeyEvent.VK_ESCAPE);
328
329 this.layout.getActionMap().put(KeyEvent.VK_ESCAPE, new AbstractAction() {
330
331 private static final long serialVersionUID = 1L;
332
333 @Override
334 public void actionPerformed(final ActionEvent actionEvent) {
335 UserInterface.this.skipScene();
336 }
337
338 });
339
313 } 340 }
314 341
315 /** 342 /**
@@ -388,7 +415,7 @@ abstract class UserInterface implements Viewable, ActionListener {
388 */ 415 */
389 private void setIllustration(final String imageName) { 416 private void setIllustration(final String imageName) {
390 final URL imageURL = this.getClass().getClassLoader().getResource( 417 final URL imageURL = this.getClass().getClassLoader().getResource(
391 imageName + UserInterface.ILLUSTRATION_EXT); 418 UserInterface.ILLUSTRATION_DIR + imageName + UserInterface.ILLUSTRATION_EXT);
392 final StretchIcon imageIcon; 419 final StretchIcon imageIcon;
393 if (imageURL == null) { 420 if (imageURL == null) {
394 imageIcon = new StretchIcon(this.generatePlaceholderImage(imageName), true); 421 imageIcon = new StretchIcon(this.generatePlaceholderImage(imageName), true);
@@ -415,6 +442,14 @@ abstract class UserInterface implements Viewable, ActionListener {
415 } 442 }
416 443
417 /** 444 /**
445 * Skips the currently player Scene.
446 */
447 private void skipScene() {
448 this.timerTask.run();
449 this.timerTask.cancel();
450 }
451
452 /**
418 * Opens the inventory (switches to the inventory tab). 453 * Opens the inventory (switches to the inventory tab).
419 */ 454 */
420 private void openInventory() { 455 private void openInventory() {
@@ -448,16 +483,46 @@ abstract class UserInterface implements Viewable, ActionListener {
448 * the URL of the audio file 483 * the URL of the audio file
449 */ 484 */
450 private void playAudio(final String fileName) { 485 private void playAudio(final String fileName) {
451 // TODO Auto-generated method stub 486 if (this.audio != null) {
452 // this.echo(Text.NOT_IMPLEMENTED.toString()); 487 this.audio.stop();
488 this.audio.close();
489 }
490
491 try {
492 this.audio = new OggClip(UserInterface.SOUND_DIR + fileName + UserInterface.SOUND_EXT);
493 this.setAudioGain();
494 this.audio.play();
495 } catch (final IOException e) {
496 e.printStackTrace();
497 }
453 } 498 }
454 499
455 /** 500 /**
456 * Toggles the sound (music). 501 * Toggles the sound (music).
457 */ 502 */
458 private void toggleAudio() { 503 private void toggleAudio() {
459 // TODO Auto-generated method stub 504 this.muted = !this.muted;
460 this.echo(Text.NOT_IMPLEMENTED.toString()); 505 this.setAudioGain();
506 }
507
508 /**
509 * Sets the gain.
510 *
511 * FIXME: PulseAudio does not comply with the JSAPI
512 */
513 private void setAudioGain() {