Add Direct Mouse Support (#2374)
* and direct mouse support * and direct mouse support * hide cursor if mouse enabled * add config * update docs * sorted usings
This commit is contained in:
parent
a10b2c5ff2
commit
77aab9aca3
16 changed files with 200 additions and 32 deletions
|
@ -23,6 +23,11 @@ namespace Ryujinx.Input
|
|||
/// </summary>
|
||||
Vector2 GetPosition();
|
||||
|
||||
/// <summary>
|
||||
/// Get the mouse scroll delta.
|
||||
/// </summary>
|
||||
Vector2 GetScroll();
|
||||
|
||||
/// <summary>
|
||||
/// Get the client size.
|
||||
/// </summary>
|
||||
|
@ -40,22 +45,21 @@ namespace Ryujinx.Input
|
|||
/// <returns>A snaphost of the state of the mouse.</returns>
|
||||
public static MouseStateSnapshot GetMouseStateSnapshot(IMouse mouse)
|
||||
{
|
||||
var position = mouse.GetPosition();
|
||||
bool[] buttons = new bool[(int)MouseButton.Count];
|
||||
|
||||
mouse.Buttons.CopyTo(buttons, 0);
|
||||
|
||||
return new MouseStateSnapshot(buttons, position);
|
||||
return new MouseStateSnapshot(buttons, mouse.GetPosition(), mouse.GetScroll());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the touch position of a mouse position relative to the app's view
|
||||
/// Get the position of a mouse on screen relative to the app's view
|
||||
/// </summary>
|
||||
/// <param name="mousePosition">The position of the mouse in the client</param>
|
||||
/// <param name="clientSize">The size of the client</param>
|
||||
/// <param name="aspectRatio">The aspect ratio of the view</param>
|
||||
/// <returns>A snaphost of the state of the mouse.</returns>
|
||||
public static Vector2 GetTouchPosition(Vector2 mousePosition, Size clientSize, float aspectRatio)
|
||||
public static Vector2 GetScreenPosition(Vector2 mousePosition, Size clientSize, float aspectRatio)
|
||||
{
|
||||
float mouseX = mousePosition.X;
|
||||
float mouseY = mousePosition.Y;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue