handle touch input from Touches struct
This commit is contained in:
parent
dd103176fe
commit
fdf1b42aae
3 changed files with 12 additions and 7 deletions
|
@ -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()
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue