From 85b2d9699a59a95a704bfc39ec89a2e36c4e7898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Thu, 10 May 2012 01:04:14 +0200 Subject: [PATCH] initial commit --- .idea/.name | 1 + .idea/ant.xml | 7 + .idea/compiler.xml | 21 +++ .idea/copyright/profiles_settings.xml | 5 + .idea/dictionaries/lucas.xml | 3 + .idea/encodings.xml | 5 + .idea/inspectionProfiles/Project_Default.xml | 11 ++ .../inspectionProfiles/profiles_settings.xml | 7 + .idea/misc.xml | 31 +++++ .idea/modules.xml | 9 ++ .idea/scopes/scope_settings.xml | 5 + .idea/uiDesigner.xml | 125 ++++++++++++++++++ .idea/vcs.xml | 7 + crashteststeuerung.iml | 12 ++ src/de/ctdo/crashtest/Statemachine.java | 30 +++++ src/de/ctdo/crashtest/Steuerung.java | 110 +++++++++++++++ src/de/ctdo/crashtest/SteuerungFrame.java | 28 ++++ 17 files changed, 417 insertions(+) create mode 100644 .idea/.name create mode 100644 .idea/ant.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/dictionaries/lucas.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 crashteststeuerung.iml create mode 100644 src/de/ctdo/crashtest/Statemachine.java create mode 100644 src/de/ctdo/crashtest/Steuerung.java create mode 100644 src/de/ctdo/crashtest/SteuerungFrame.java diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..cf5df8d --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +crashteststeuerung \ No newline at end of file diff --git a/.idea/ant.xml b/.idea/ant.xml new file mode 100644 index 0000000..2581ca3 --- /dev/null +++ b/.idea/ant.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..a1b41c5 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..3572571 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/.idea/dictionaries/lucas.xml b/.idea/dictionaries/lucas.xml new file mode 100644 index 0000000..6f04b62 --- /dev/null +++ b/.idea/dictionaries/lucas.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..c66df00 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..99b8601 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,31 @@ + + + + + + + + http://www.w3.org/1999/xhtml + + + + + + + + + + 1.6 + + + + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..872a672 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..3b00020 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..275077f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/crashteststeuerung.iml b/crashteststeuerung.iml new file mode 100644 index 0000000..d5c0743 --- /dev/null +++ b/crashteststeuerung.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/de/ctdo/crashtest/Statemachine.java b/src/de/ctdo/crashtest/Statemachine.java new file mode 100644 index 0000000..9028ee3 --- /dev/null +++ b/src/de/ctdo/crashtest/Statemachine.java @@ -0,0 +1,30 @@ +package de.ctdo.crashtest; + +public class Statemachine { + public enum STATES { + IDLE, + ENTERED_ROOM, + TABLE_GAME_ONE, + TABLE_GAME_TWO, + TABLE_GAME_THREE, + TABLE_GAME_FOUR, + TABLE_GAME_FIVE, + TABLE_GAME_SIX, + TABLE_GAME_SEVEN, + TABLE_GAME_EIGHT, + FINISH, + } + + private STATES currentState = STATES.IDLE; + + + public STATES getCurrentState() { + return currentState; + } + + public void handleInput(char input) { + + + + } +} diff --git a/src/de/ctdo/crashtest/Steuerung.java b/src/de/ctdo/crashtest/Steuerung.java new file mode 100644 index 0000000..19c99c9 --- /dev/null +++ b/src/de/ctdo/crashtest/Steuerung.java @@ -0,0 +1,110 @@ +package de.ctdo.crashtest; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.CharBuffer; + +public class Steuerung { + + private static enum STATE { + IDLE, + ROOM_ENTERED, + TABLE_GAME, + } + private STATE current_state = STATE.IDLE; + + + public static void main(String args[]) { + + //new Steuerung().run(); + + new SteuerungFrame(); + + } + + public void FlushInputBuffer() { + int TempValue = 0; + + do { + try { + TempValue = System.in.read(); + } + catch (java.io.IOException e) { + } + } while (TempValue != 10); + } + + public char GetChar() { + int ReadValue = 0; + + try { + ReadValue = System.in.read(); + } + catch (java.io.IOException e) { + } + + this.FlushInputBuffer(); + + return (char) ReadValue; + } + + public void run() { + boolean doRun = true; + //BufferedReader in = new BufferedReader(new InputStreamReader( System.in ) ); + InputStreamReader in = new InputStreamReader(System.in); + + while(doRun) { + char[] buffer = new char[100]; + + try { + + char c = GetChar(); + + System.out.println("char = " + c); + + //if(command.equals("exit") || command.equals("quit")) doRun = false; + + //handleCommand(command); + + + + Thread.sleep(200); + +// } catch (IOException e) { +// e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + + System.out.println("Current state after: " + current_state); + } + } + + private void handleCommand(String command) { + System.out.println("Current state before: " + current_state); + + switch (current_state) { + case IDLE: + + if(command.equals("c")) { + current_state = STATE.ROOM_ENTERED; + } + + break; + case ROOM_ENTERED: + + break; + case TABLE_GAME: + + + break; + } + + + + } + + +} diff --git a/src/de/ctdo/crashtest/SteuerungFrame.java b/src/de/ctdo/crashtest/SteuerungFrame.java new file mode 100644 index 0000000..13f0a6d --- /dev/null +++ b/src/de/ctdo/crashtest/SteuerungFrame.java @@ -0,0 +1,28 @@ +package de.ctdo.crashtest; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +public class SteuerungFrame extends JFrame { + + Statemachine machine = new Statemachine(); + + public SteuerungFrame() { + setType(Type.UTILITY); + setBackground(Color.black); + setBounds(200,200, 200, 200); + + + addKeyListener(new KeyAdapter() { + @Override + public void keyTyped(KeyEvent e) { + System.out.println(e.getKeyChar()); + } + }); + + setDefaultCloseOperation(EXIT_ON_CLOSE); + setVisible(true); + } + +}