[Android] Change how the onTouchEvent native method works. Just pass in the correct Button ID and Action and it'll be pressed or not. Not actually rigged up to the Java code yet. Doesn't support anything with an Axis yet so no C stick, main stick, L and R triggers

This commit is contained in:
Ryan Houdek
2013-10-26 05:36:20 -05:00
parent c3e4aa1f35
commit c24dfe559b
5 changed files with 25 additions and 80 deletions

View File

@ -17,12 +17,11 @@ public final class NativeLibrary
{
/**
* Handles touch events.
*
*
* @param Button Key code identifying which button was pressed.
* @param Action Mask for the action being performed.
* @param X Location on the screen's X-axis that the touch event occurred.
* @param Y Location on the screen's Y-axis that the touch event occurred.
*/
public static native void onTouchEvent(int Action, float X, float Y);
public static native void onTouchEvent(int Button, int Action);
/**
* Handles button press events for a gamepad.

View File

@ -135,22 +135,6 @@ public final class EmulationActivity extends Activity
}
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
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;
float ScreenY = ((Y / screenHeight) * -2.0f) + 1.0f;
NativeLibrary.onTouchEvent(Action, ScreenX, ScreenY);
return false;
}
@Override
public void onBackPressed()
{