package com.haru.input;

import java.io.IOException;
import java.io.InputStreamReader;


// 改行区切りだから使いにくい


public class ConsoleBuffer extends InputBuffer implements Runnable {

	public ConsoleBuffer() {
		new Thread(this).start(); // 投げっぱ
	}


	// 一文字読み取りを繰り返す
	public void run() {
		InputStreamReader in = new InputStreamReader(System.in);

		char[] buf = new char[1];


		while (true) {


			try {
				in.read(buf);
			} catch (IOException e1) {
				e1.printStackTrace();
				continue;
			}


			switch (buf[0]) {
			case 'u':
				isDrop = TRUE;
				break;
			case 'd':
				dir.x = 0;
				dir.y = 1;
				break;
			case 'l':
				dir.x = -1;
				dir.y = 0;
				break;
			case 'r':
				dir.x = 1;
				dir.y = 0;
				break;
			case 't':
				d_t = R_RIGHT;
				break;

			}





			// WAIT
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
