Hello folks, I have an issue with touch input on (at least) android devices in landscape mode.
The touchinput location seems to be offset by 40px - so when the Location.X should be 0 it is actually -40. I am testing this on a sony zx1 (which has softbuttons) and I have a feeling that this is somehow related to it. Maybe I am doing it wrong?
this is how I set fullscreen mode and hide all navigation elements in Activity:
this.Window.DecorView.SystemUiVisibility = (StatusBarVisibility)(SystemUiFlags.HideNavigation | SystemUiFlags.ImmersiveSticky | SystemUiFlags.LayoutFullscreen);
and this is how I read touch input:
TouchCollection touches = TouchPanel.GetState();
foreach (TouchLocation touch in touches)
{
if (touch.State == TouchLocationState.Pressed)
{
World.Current.MouseLeftDown((int)touch.Position.X, (int)touch.Position.Y);
}
else if (touch.State == TouchLocationState.Released)
{
World.Current.MouseLeftUp((int)touch.Position.X, (int)touch.Position.Y);
}
}
The TouchLocation.Y seems to be right and the reported Dimensions in .ViewPort looks right also (1200x720 on this device). Any ideas where that offset comes from and how can I fix it?
Another issue may be, that the softbuttons are actually not displayed, but there is still a black bar on the right, where the buttons are used to be … is there any chance to get rid of that? <-- this is solves by NOT setting a prefferedBackbufferWidth/Height in Game1.cs