#include "graph.h"
#include "keyboard.h"

int MoveXDir(int ch)
{
  switch (ch) {
  case KEY_UPLEFT:
  case KEY_DOWNLEFT:
  case KEY_LEFT:
    return -1;
  case KEY_UPRIGHT:
  case KEY_RIGHT:
  case KEY_DOWNRIGHT:
    return 1;
  default:
    return 0;
  }
}

int MoveYDir(int ch)
{
  switch (ch) {
  case KEY_UPLEFT:
  case KEY_UP:
  case KEY_UPRIGHT:
    return -1;
  case KEY_DOWNLEFT:
  case KEY_DOWN:
  case KEY_DOWNRIGHT:
    return 1;
  default:
    return 0;
  }
}

int MovementKey(int key)
{
  return key >= 0x100 && key != NO_KEY;
}
