dpadDirection property

Direction dpadDirection

Returns the eight-way direction pressed on the d-pad, or center if the dpad is not pressed.


Direction get dpadDirection {
  if (dpadLeft && dpadUp) return Direction.northwest;
  if (dpadLeft && dpadDown) return Direction.southwest;
  if (dpadLeft) return Direction.west;
  if (dpadRight && dpadUp) return Direction.northeast;
  if (dpadRight && dpadDown) return Direction.southeast;
  if (dpadRight) return Direction.east;
  if (dpadUp) return Direction.north;
  if (dpadDown) return Direction.south;
  return Direction.center;