Skip to content
Browse files

initial commit

  • Loading branch information...
0 parents commit 6f01ccde0944c0ce58d2a1eafd73f5c80d299167 @trystan committed Mar 10, 2012
7 .classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="lib" path="asciiPanel.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
6 .gitignore
@@ -0,0 +1,6 @@
+# Java class files
+*.class
+*.DS_Store
+
+# generated files
+bin/
17 .project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>iryrwarosh</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
12 .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Sat Mar 10 07:11:40 PST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
0 README
No changes.
BIN asciiPanel.jar
Binary file not shown.
47 src/iryrwarosh/AppletMain.java
@@ -0,0 +1,47 @@
+package iryrwarosh;
+
+import java.applet.Applet;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import asciiPanel.AsciiPanel;
+
+public class AppletMain extends Applet implements KeyListener {
+ private static final long serialVersionUID = 1L;
+
+ private AsciiPanel terminal;
+ private iryrwarosh.screens.Screen screen;
+
+ public AppletMain(){
+ super();
+ terminal = new AsciiPanel();
+ add(terminal);
+ screen = new iryrwarosh.screens.StartScreen();
+ addKeyListener(this);
+ repaint();
+ }
+
+ @Override
+ public void init(){
+ super.init();
+ this.setSize(terminal.getWidth(), terminal.getHeight());
+ }
+
+ @Override
+ public void repaint(){
+ terminal.clear();
+ screen.displayOutput(terminal);
+ super.repaint();
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ screen = screen.respondToUserInput(e);
+ repaint();
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) { }
+
+ @Override
+ public void keyTyped(KeyEvent e) { }
+}
50 src/iryrwarosh/ApplicationMain.java
@@ -0,0 +1,50 @@
+package iryrwarosh;
+
+import iryrwarosh.screens.StartScreen;
+
+import javax.swing.JFrame;
+import asciiPanel.AsciiPanel;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+public class ApplicationMain extends JFrame implements KeyListener {
+ private static final long serialVersionUID = 1L;
+
+ private AsciiPanel terminal;
+ private iryrwarosh.screens.Screen screen;
+
+ public ApplicationMain(){
+ super();
+ terminal = new AsciiPanel();
+ add(terminal);
+ pack();
+ screen = new StartScreen();
+ addKeyListener(this);
+ repaint();
+ }
+
+ @Override
+ public void repaint(){
+ terminal.clear();
+ screen.displayOutput(terminal);
+ super.repaint();
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ screen = screen.respondToUserInput(e);
+ repaint();
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) { }
+
+ @Override
+ public void keyTyped(KeyEvent e) { }
+
+ public static void main(String[] args) {
+ ApplicationMain app = new ApplicationMain();
+ app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ app.setVisible(true);
+ }
+}
19 src/iryrwarosh/screens/PlayScreen.java
@@ -0,0 +1,19 @@
+package iryrwarosh.screens;
+
+import java.awt.event.KeyEvent;
+
+import asciiPanel.AsciiPanel;
+
+public class PlayScreen implements Screen {
+
+ @Override
+ public void displayOutput(AsciiPanel terminal) {
+ terminal.write("You are having fun.", 1, 1);
+ }
+
+ @Override
+ public Screen respondToUserInput(KeyEvent key) {
+
+ return this;
+ }
+}
11 src/iryrwarosh/screens/Screen.java
@@ -0,0 +1,11 @@
+package iryrwarosh.screens;
+
+import java.awt.event.KeyEvent;
+
+import asciiPanel.AsciiPanel;
+
+public interface Screen {
+ public void displayOutput(AsciiPanel terminal);
+
+ public Screen respondToUserInput(KeyEvent key);
+}
20 src/iryrwarosh/screens/StartScreen.java
@@ -0,0 +1,20 @@
+package iryrwarosh.screens;
+
+import java.awt.event.KeyEvent;
+
+import asciiPanel.AsciiPanel;
+
+public class StartScreen implements Screen {
+
+ @Override
+ public void displayOutput(AsciiPanel terminal) {
+ terminal.writeCenter("I rule, you rule, we all rule old-school Hyrule", 1, AsciiPanel.brightWhite);
+ terminal.writeCenter("a 2012 seven day roguelike by Trystan Spangler", 2);
+ terminal.writeCenter("-- press [enter] to start --", 22);
+ }
+
+ @Override
+ public Screen respondToUserInput(KeyEvent key) {
+ return key.getKeyCode() == KeyEvent.VK_ENTER ? new PlayScreen() : this;
+ }
+}

0 comments on commit 6f01ccd

Please sign in to comment.
Something went wrong with that request. Please try again.