package ethanjones.modularworld.input;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputAdapter;
import ethanjones.modularworld.ModularWorld;

public class GameInputHandler extends InputAdapter {

  @Override
  public boolean keyDown(int keycode) {

    return false;
  }

  @Override
  public boolean keyUp(int keycode) {

    return false;
  }

  int[][] touch = new int[100][2];
  int maxPointer = -1;

  @Override
  public boolean touchDragged(int screenX, int screenY, int pointer) {
    maxPointer = Math.max(pointer, maxPointer);
    int deltaX = screenX - touch[pointer][0];
    int deltaY = screenY - touch[pointer][1];
    ModularWorld.instance.player.movementHandler.updateRotation(deltaX, deltaY);
    touch[pointer][0] = screenX;
    touch[pointer][1] = screenY;
    return true;
  }

  public void updateTouch() {
    for (int i = 0; i <= maxPointer; i++) {
      if (!Gdx.input.isTouched(i)) {
        touch[i] = new int[2];
      }
    }
    maxPointer = -1;
  }

  @Override
  public boolean mouseMoved(int screenX, int screenY) {
    ModularWorld.instance.player.movementHandler.updateRotation();
    return true;
  }

}

@@ -540,16 +540,78 @@
 inter);%0A
+    if (touch%5Bpointer%5D%5B0%5D != 0 && touch%5Bpointer%5D%5B1%5D != 0) %7B%0A  
     int 
@@ -648,24 +648,26 @@
 er%5D%5B0%5D;%0A    
+ 
+ 
 int deltaY =
@@ -696,16 +696,18 @@
 er%5D%5B1%5D;%0A
+  
     Modu
@@ -779,16 +779,22 @@
 eltaY);%0A
+    %7D%0A
     touc
@@ -1004,21 +1004,40 @@
 h%5Bi%5D
- = new int%5B2%5D
+%5B0%5D = 0;%0A        touch%5Bi%5D%5B1%5D = 0
 ;%0A  

Improve Input Handling