handle touch input from Touches struct

This commit is contained in:
emmaus 2018-02-26 13:11:57 +00:00
parent dd103176fe
commit fdf1b42aae
3 changed files with 12 additions and 7 deletions

View file

@ -206,9 +206,6 @@ namespace Ryujinx.Core
+ (uint)((uint)(TouchScreenHeader.LatestEntry) * Marshal.SizeOf(typeof(HidTouchScreenEntry)));
HidPtr = new IntPtr(Ns.Ram.ToInt64() + (uint)SharedMemOffset + InnerOffset);
//Truncate number of touches
TouchPoints.NumberOfTouches = TouchPoints.NumberOfTouches > 16 ? 16 : TouchPoints.NumberOfTouches;
HidTouchScreenEntry hidTouchScreenEntry = new HidTouchScreenEntry()
{
Header = new HidTouchScreenEntryHeader()

View file

@ -56,8 +56,18 @@ namespace Ryujinx.Core
{
public uint[] XTouches;
public uint[] YTouches;
public uint NumberOfTouches;
public uint NumberOfTouches { get; private set; }
public const uint Hid_Max_Num_Touches = 16;
public void AddTouch(uint X, uint Y)
{
if (NumberOfTouches < Hid_Max_Num_Touches)
{
XTouches[NumberOfTouches] = X;
YTouches[NumberOfTouches] = Y;
NumberOfTouches++;
}
}
}
}

View file

@ -98,9 +98,7 @@ namespace Ryujinx
{
if (Mouse.GetState().LeftButton == OpenTK.Input.ButtonState.Pressed && Focused)
{
CurrentTouchPoints.XTouches[CurrentTouchPoints.NumberOfTouches] = (uint)Mouse.X;
CurrentTouchPoints.YTouches[CurrentTouchPoints.NumberOfTouches] = (uint)Mouse.Y;
CurrentTouchPoints.NumberOfTouches++;
CurrentTouchPoints.AddTouch((uint)Mouse.X, (uint)Mouse.Y);
}
}