Closed mza299 closed 2 years ago
Using the underlying XNA framework works. As in it registers touch input using an android emulator via VS2019. I used the following code:
while (TouchPanel.IsGestureAvailable)
{
GestureSample gesture = TouchPanel.ReadGesture();
if (gesture.GestureType == GestureType.Tap)
{
CalculateInitialHopDistance();
}
}
This is the same code mentioned in the FRB API documentation. However, accessing the gestures through FlatRedBall.Input
still does not work.
I know this bug is old and I apologize for not getting to it yet, but it looked like there was a workaround. Anyway, I'll address the two points:
Regarding Cursor.PrimaryPush
, this has been fixed on Android and it should work just fine on both Android and DesktopGL projects. I don't know which commit this was fixed in, as it was a while ago.
The fix to InputManager.TouchPanel.LastFrameGestures was also added at some point in the past and it works correctly. As a test, I wrote the following code (in CustomActivity):
void CustomActivity(bool firstTimeCalled)
{
foreach (var gesture in InputManager.TouchScreen.LastFrameGestures)
{
if (gesture.GestureType == GestureType.Tap)
{
var position = GuiManager.Cursor.WorldPosition;
var circle = new Circle();
circle.Visible = true;
circle.Radius = 16;
circle.Position = position.ToVector3();
}
}
}
This produced the following behavior:
The issue is concerning a synced (desktop/android) project.
I used the following snippets of code to register a touchscreen "tap" input. This code is written in the CustomActivity method of a Screen/Scene .cs file.
and
The latter worked for the desktop project as expected.
However for both the android emulator and a connected hardware android device, there was no gestures registered and
GuiManager.Cursor.PrimaryPush
did not register as a touchscreen tap as mentioned in the FRB API.The emulator simulates a Google Pixel 2 Pie (API 28, Android 9 Pie) My connected android device (hardware) via USB enabled debugging is a Xiaomi Redmi 3 (API, Android 5.1 Lollipop)