#ifndef KEYBOARD_HPP
#define KEYBOARD_HPP

#include "config.h"

#include "input.hpp"

// keyboard
#include <termios.h>
#include "termio/getch2.h"
#include "termio/keycodes.h"

#ifdef use_sdl
#include <SDL/SDL.h>
#endif

class Keyboard : public Input_device 
{
private:
  // delay for input
  int halfdelay_time;

  int tty_mode;
  struct termios orig_tty;
  struct termios new_tty;

#ifdef use_sdl
  std::string getSDLkey();
#endif

  void normal();
  void cbreak();
public:
  void run();
  Keyboard();
  ~Keyboard() { terminate(); /* thread */ normal(); }

  void suspend() {}
  void wake_up() { Input i; input = i; }
};

#endif
