Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
lioncash committed Aug 13, 2013
1 parent 0916d07 commit 2015484
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
Expand Up @@ -143,11 +143,9 @@ public void onActivityResult(int requestCode, int resultCode, Intent data)
@Override
public boolean onTouchEvent(MotionEvent event)
{
float X, Y;
int Action;
X = event.getX();
Y = event.getY();
Action = event.getActionMasked();
float X = event.getX();
float Y = event.getY();
int Action = event.getActionMasked();

// Converts button locations 0 - 1 to OGL screen coords -1.0 - 1.0
float ScreenX = ((X / screenWidth) * 2.0f) - 1.0f;
Expand Down Expand Up @@ -207,14 +205,13 @@ public boolean dispatchGenericMotionEvent(MotionEvent event) {

InputDevice input = event.getDevice();
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()));
}

return true;
}

}
}

0 comments on commit 2015484

Please sign in to comment.