[Android] Some tiny cleanups in DolphinEmulator.java
- Join variable declaration and assignments in function onTouchEvent() - Change a for-loop into a foreach loop in dispatchGenericMotionEvent(). Makes the loop body a single statement.
This commit is contained in:
parent
0916d0797c
commit
2015484c24
|
@ -143,11 +143,9 @@ public class DolphinEmulator<MainActivity> extends Activity
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event)
|
public boolean onTouchEvent(MotionEvent event)
|
||||||
{
|
{
|
||||||
float X, Y;
|
float X = event.getX();
|
||||||
int Action;
|
float Y = event.getY();
|
||||||
X = event.getX();
|
int Action = event.getActionMasked();
|
||||||
Y = event.getY();
|
|
||||||
Action = event.getActionMasked();
|
|
||||||
|
|
||||||
// Converts button locations 0 - 1 to OGL screen coords -1.0 - 1.0
|
// Converts button locations 0 - 1 to OGL screen coords -1.0 - 1.0
|
||||||
float ScreenX = ((X / screenWidth) * 2.0f) - 1.0f;
|
float ScreenX = ((X / screenWidth) * 2.0f) - 1.0f;
|
||||||
|
@ -207,10 +205,9 @@ public class DolphinEmulator<MainActivity> extends Activity
|
||||||
|
|
||||||
InputDevice input = event.getDevice();
|
InputDevice input = event.getDevice();
|
||||||
List<InputDevice.MotionRange> motions = input.getMotionRanges();
|
List<InputDevice.MotionRange> motions = input.getMotionRanges();
|
||||||
for (int a = 0; a < motions.size(); ++a)
|
|
||||||
|
for (InputDevice.MotionRange range : motions)
|
||||||
{
|
{
|
||||||
InputDevice.MotionRange range;
|
|
||||||
range = motions.get(a);
|
|
||||||
NativeLibrary.onGamePadMoveEvent(InputConfigFragment.getInputDesc(input), range.getAxis(), event.getAxisValue(range.getAxis()));
|
NativeLibrary.onGamePadMoveEvent(InputConfigFragment.getInputDesc(input), range.getAxis(), event.getAxisValue(range.getAxis()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue