Mouse controller using Arduino Due

Hai everyone.. I have questions about Arduino Due and the programming of the mouse controller. I use arduino due connected to the usb mouse and the output are four LED's. What i am try to do is, my Arduino Due will read the value of my mouse and the LED will be on. The program is like this

#include <MouseController.h>


int led1 = 34;  
int led2 = 32;
int led3 = 30;
int led4 = 28;  


int x;
int y;


// Initialize USB Controller
USBHost usb;

// Attach mouse controller to USB
MouseController mouse(usb);

void mouseDragged() {
  Serial.print("DRAG: ");
  Serial.print(mouse.getXChange());
  Serial.print(", ");
  Serial.println(mouse.getYChange());
  check();
  delay(100);
  check();
}

void setup(){
 
  Serial.begin(9600);
  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT);
  pinMode(led4,OUTPUT);
  Serial.println("Program started");
  delay(200);
}

void loop(){
  usb.Task();
  int x=mouse.getXChange();
  int y=mouse.getYChange();
  check();
}


void check()
{
    if(x>0 && y>0)
  {
    digitalWrite(led1,HIGH);
    digitalWrite(led2,LOW);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);

  }
  else if (x<0&& y<0)
  {
 
    digitalWrite(led1,LOW);
    digitalWrite(led2,HIGH);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);
  
  }
    else if (x>0&& y<0)
  {
    digitalWrite(led2,LOW);
    digitalWrite(led1,LOW);
    digitalWrite(led3,HIGH);
    digitalWrite(led4,LOW);
 
  }
   else if (x<0&& y>0)
  {
    digitalWrite(led2,LOW);
    digitalWrite(led1,LOW);
    digitalWrite(led3,LOW);
    digitalWrite(led4,HIGH);
   
  }
  else
  {
    digitalWrite(led2,LOW);
    digitalWrite(led1,LOW);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);
 
  }
  
}

my serial print can read the value..but the problem is my led do not on.. it suppose to be on because it can read the mouse.XChange() and mouse.YChange()..can someone help me to solve this?thanks a lot

my serial print can read the value.

Impossible. The Serial.print() statement may be showing a value, but it is impossible for it to read anything.

int x;
int y;

Why are these global?

  int x=mouse.getXChange();
  int y=mouse.getYChange();

Why do you then create local variables that are not available to the function that needs the values? Why not read the values in that function?