mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-19 21:10:11 -07:00
New deadzone system + auto-grab controller
This commit is contained in:
parent
90aac77ade
commit
4edb0ebe34
3 changed files with 36 additions and 19 deletions
|
|
@ -38,6 +38,8 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
LWJGLGLFWKeycode.GLFW_KEY_4, LWJGLGLFWKeycode.GLFW_KEY_5, LWJGLGLFWKeycode.GLFW_KEY_6,
|
||||
LWJGLGLFWKeycode.GLFW_KEY_7, LWJGLGLFWKeycode.GLFW_KEY_8, LWJGLGLFWKeycode.GLFW_KEY_9};
|
||||
|
||||
private Gamepad gamepad;
|
||||
|
||||
private boolean rightOverride = false;
|
||||
public float scaleFactor = 1;
|
||||
private int fingerStillThreshold = 8;
|
||||
|
|
@ -654,12 +656,16 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
}
|
||||
|
||||
|
||||
private final Gamepad gamepad = new Gamepad(this);
|
||||
|
||||
@Override
|
||||
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
|
||||
int mouseCursorIndex = -1;
|
||||
|
||||
if(Gamepad.isGamepadEvent(ev)){
|
||||
if(gamepad == null){
|
||||
gamepad = new Gamepad(this, Tools.grabFirstGamepad());
|
||||
}
|
||||
|
||||
gamepad.update(ev);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -712,6 +718,10 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
System.out.println(event);
|
||||
|
||||
if(Gamepad.isGamepadEvent(event)){
|
||||
if(gamepad == null){
|
||||
gamepad = new Gamepad(this, Tools.grabFirstGamepad());
|
||||
}
|
||||
|
||||
gamepad.update(event);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue