mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-03 11:11:25 +00:00
Android: Remove return value from touch event functions
This commit is contained in:
parent
e2a9abaf5c
commit
fdfc4cbe40
@ -63,7 +63,7 @@ void NativeUpdate();
|
||||
// Useful for triggering audio events, saving a few ms.
|
||||
// If you don't care about touch latency, just do a no-op implementation of this.
|
||||
// time is not yet implemented. finger can be from 0 to 7, inclusive.
|
||||
bool NativeTouch(const TouchInput &touch);
|
||||
void NativeTouch(const TouchInput &touch);
|
||||
bool NativeKey(const KeyInput &key);
|
||||
bool NativeAxis(const AxisInput &axis);
|
||||
|
||||
|
@ -46,9 +46,9 @@ static bool vrFlatGame = false;
|
||||
static float vrMatrix[VR_MATRIX_COUNT][16];
|
||||
static bool vrMirroring[VR_MIRRORING_COUNT];
|
||||
|
||||
static bool(*NativeAxis)(const AxisInput &axis);
|
||||
static bool(*NativeKey)(const KeyInput &key);
|
||||
static bool(*NativeTouch)(const TouchInput &touch);
|
||||
static bool (*NativeAxis)(const AxisInput &axis);
|
||||
static bool (*NativeKey)(const KeyInput &key);
|
||||
static void (*NativeTouch)(const TouchInput &touch);
|
||||
|
||||
/*
|
||||
================================================================================
|
||||
@ -189,7 +189,7 @@ void GetVRResolutionPerEye(int* width, int* height) {
|
||||
}
|
||||
}
|
||||
|
||||
void SetVRCallbacks(bool(*axis)(const AxisInput &axis), bool(*key)(const KeyInput &key), bool(*touch)(const TouchInput &touch)) {
|
||||
void SetVRCallbacks(bool(*axis)(const AxisInput &axis), bool(*key)(const KeyInput &key), void (*touch)(const TouchInput &touch)) {
|
||||
NativeAxis = axis;
|
||||
NativeKey = key;
|
||||
NativeTouch = touch;
|
||||
|
@ -29,7 +29,7 @@ bool IsVREnabled();
|
||||
void InitVROnAndroid(void* vm, void* activity, const char* system, int version, const char* name);
|
||||
void EnterVR(bool firstStart, void* vulkanContext);
|
||||
void GetVRResolutionPerEye(int* width, int* height);
|
||||
void SetVRCallbacks(bool(*axis)(const AxisInput &axis), bool(*key)(const KeyInput &key), bool(*touch)(const TouchInput &touch));
|
||||
void SetVRCallbacks(bool(*axis)(const AxisInput &axis), bool(*key)(const KeyInput &key), void(*touch)(const TouchInput &touch));
|
||||
|
||||
// VR input integration
|
||||
void SetVRAppMode(VRAppMode mode);
|
||||
|
@ -1315,17 +1315,17 @@ bool NativeIsAtTopLevel() {
|
||||
}
|
||||
}
|
||||
|
||||
bool NativeTouch(const TouchInput &touch) {
|
||||
if (screenManager) {
|
||||
// Brute force prevent NaNs from getting into the UI system
|
||||
if (my_isnan(touch.x) || my_isnan(touch.y)) {
|
||||
return false;
|
||||
}
|
||||
screenManager->touch(touch);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
void NativeTouch(const TouchInput &touch) {
|
||||
if (!screenManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Brute force prevent NaNs from getting into the UI system.
|
||||
// Don't think this is actually necessary in practice.
|
||||
if (my_isnan(touch.x) || my_isnan(touch.y)) {
|
||||
return;
|
||||
}
|
||||
screenManager->touch(touch);
|
||||
}
|
||||
|
||||
bool NativeKey(const KeyInput &key) {
|
||||
|
@ -1113,7 +1113,7 @@ PermissionStatus System_GetPermissionStatus(SystemPermission permission) {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" jboolean JNICALL Java_org_ppsspp_ppsspp_NativeApp_touch
|
||||
extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_touch
|
||||
(JNIEnv *, jclass, float x, float y, int code, int pointerId) {
|
||||
|
||||
float scaledX = x * g_dpi_scale_x;
|
||||
@ -1125,8 +1125,7 @@ extern "C" jboolean JNICALL Java_org_ppsspp_ppsspp_NativeApp_touch
|
||||
touch.y = scaledY;
|
||||
touch.flags = code;
|
||||
|
||||
bool retval = NativeTouch(touch);
|
||||
return retval;
|
||||
NativeTouch(touch);
|
||||
}
|
||||
|
||||
extern "C" jboolean Java_org_ppsspp_ppsspp_NativeApp_keyDown(JNIEnv *, jclass, jint deviceId, jint key, jboolean isRepeat) {
|
||||
|
@ -46,7 +46,7 @@ public class NativeApp {
|
||||
public static native boolean mouseWheelEvent(float x, float y);
|
||||
|
||||
// Sensor/input data. These are asynchronous, beware!
|
||||
public static native boolean touch(float x, float y, int data, int pointerId);
|
||||
public static native void touch(float x, float y, int data, int pointerId);
|
||||
|
||||
public static native boolean accelerometer(float x, float y, float z);
|
||||
|
||||
|
@ -62,7 +62,6 @@ public class NativeGLView extends GLSurfaceView implements SensorEventListener,
|
||||
public boolean onTouchEvent(final MotionEvent ev) {
|
||||
boolean canReadToolType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
||||
|
||||
int numTouchesHandled = 0;
|
||||
for (int i = 0; i < ev.getPointerCount(); i++) {
|
||||
int pid = ev.getPointerId(i);
|
||||
int code = 0;
|
||||
@ -94,10 +93,10 @@ public class NativeGLView extends GLSurfaceView implements SensorEventListener,
|
||||
code |= tool << 10; // We use the Android tool type codes
|
||||
}
|
||||
// Can't use || due to short circuit evaluation
|
||||
numTouchesHandled += NativeApp.touch(ev.getX(i), ev.getY(i), code, pid) ? 1 : 0;
|
||||
NativeApp.touch(ev.getX(i), ev.getY(i), code, pid);
|
||||
}
|
||||
}
|
||||
return numTouchesHandled > 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Sensor management
|
||||
|
@ -63,7 +63,6 @@ public class NativeSurfaceView extends SurfaceView implements SensorEventListene
|
||||
public boolean onTouchEvent(final MotionEvent ev) {
|
||||
boolean canReadToolType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
|
||||
|
||||
int numTouchesHandled = 0;
|
||||
for (int i = 0; i < ev.getPointerCount(); i++) {
|
||||
int pid = ev.getPointerId(i);
|
||||
int code = 0;
|
||||
@ -95,10 +94,10 @@ public class NativeSurfaceView extends SurfaceView implements SensorEventListene
|
||||
code |= tool << 10; // We use the Android tool type codes
|
||||
}
|
||||
// Can't use || due to short circuit evaluation
|
||||
numTouchesHandled += NativeApp.touch(ev.getX(i), ev.getY(i), code, pid) ? 1 : 0;
|
||||
NativeApp.touch(ev.getX(i), ev.getY(i), code, pid);
|
||||
}
|
||||
}
|
||||
return numTouchesHandled > 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Sensor management
|
||||
|
Loading…
Reference in New Issue
Block a user