mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 12:03:02 +00:00
Add Moga controller support.
This commit is contained in:
parent
aa4e07ea2f
commit
ae65bbe3ca
@ -345,15 +345,27 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi
|
|||||||
|
|
||||||
float RS_X, RS_Y, L2, R2;
|
float RS_X, RS_Y, L2, R2;
|
||||||
|
|
||||||
InputDevice.MotionRange l2Range = dev.getMotionRange(MotionEvent.AXIS_LTRIGGER);
|
InputDevice.MotionRange leftTriggerRange = dev.getMotionRange(MotionEvent.AXIS_LTRIGGER);
|
||||||
InputDevice.MotionRange r2Range = dev.getMotionRange(MotionEvent.AXIS_RTRIGGER);
|
InputDevice.MotionRange rightTriggerRange = dev.getMotionRange(MotionEvent.AXIS_RTRIGGER);
|
||||||
if (l2Range != null && r2Range != null)
|
if (leftTriggerRange != null && rightTriggerRange != null)
|
||||||
{
|
{
|
||||||
// Ouya controller
|
// Ouya controller
|
||||||
RS_X = event.getAxisValue(MotionEvent.AXIS_Z);
|
|
||||||
RS_Y = event.getAxisValue(MotionEvent.AXIS_RZ);
|
|
||||||
L2 = event.getAxisValue(MotionEvent.AXIS_LTRIGGER);
|
L2 = event.getAxisValue(MotionEvent.AXIS_LTRIGGER);
|
||||||
R2 = event.getAxisValue(MotionEvent.AXIS_RTRIGGER);
|
R2 = event.getAxisValue(MotionEvent.AXIS_RTRIGGER);
|
||||||
|
RS_X = event.getAxisValue(MotionEvent.AXIS_Z);
|
||||||
|
RS_Y = event.getAxisValue(MotionEvent.AXIS_RZ);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InputDevice.MotionRange brakeRange = dev.getMotionRange(MotionEvent.AXIS_BRAKE);
|
||||||
|
InputDevice.MotionRange gasRange = dev.getMotionRange(MotionEvent.AXIS_GAS);
|
||||||
|
if (brakeRange != null && gasRange != null)
|
||||||
|
{
|
||||||
|
// Moga controller
|
||||||
|
RS_X = event.getAxisValue(MotionEvent.AXIS_Z);
|
||||||
|
RS_Y = event.getAxisValue(MotionEvent.AXIS_RZ);
|
||||||
|
L2 = event.getAxisValue(MotionEvent.AXIS_BRAKE);
|
||||||
|
R2 = event.getAxisValue(MotionEvent.AXIS_GAS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -363,6 +375,8 @@ public class Game extends Activity implements OnGenericMotionListener, OnTouchLi
|
|||||||
L2 = (event.getAxisValue(MotionEvent.AXIS_Z) + 1) / 2;
|
L2 = (event.getAxisValue(MotionEvent.AXIS_Z) + 1) / 2;
|
||||||
R2 = (event.getAxisValue(MotionEvent.AXIS_RZ) + 1) / 2;
|
R2 = (event.getAxisValue(MotionEvent.AXIS_RZ) + 1) / 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
InputDevice.MotionRange hatXRange = dev.getMotionRange(MotionEvent.AXIS_HAT_X);
|
InputDevice.MotionRange hatXRange = dev.getMotionRange(MotionEvent.AXIS_HAT_X);
|
||||||
InputDevice.MotionRange hatYRange = dev.getMotionRange(MotionEvent.AXIS_HAT_Y);
|
InputDevice.MotionRange hatYRange = dev.getMotionRange(MotionEvent.AXIS_HAT_Y);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user