mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 05:47:43 +01:00
Add IGamepadState (#1264)
This commit is contained in:
parent
ac74bd5fe0
commit
2f138bb1df
2 changed files with 97 additions and 35 deletions
68
Dalamud/Plugin/Services/IGamepadState.cs
Normal file
68
Dalamud/Plugin/Services/IGamepadState.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using System.Numerics;
|
||||
|
||||
using Dalamud.Game.ClientState.GamePad;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Plugin.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Exposes the game gamepad state to dalamud.
|
||||
///
|
||||
/// Will block game's gamepad input if <see cref="ImGuiConfigFlags.NavEnableGamepad"/> is set.
|
||||
/// </summary>
|
||||
public interface IGamepadState
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the pointer to the current instance of the GamepadInput struct.
|
||||
/// </summary>
|
||||
public nint GamepadInputAddress { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the left analogue sticks tilt vector.
|
||||
/// </summary>
|
||||
public Vector2 LeftStick { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the right analogue sticks tilt vector.
|
||||
/// </summary>
|
||||
public Vector2 RightStick { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether <paramref name="button"/> has been pressed.
|
||||
///
|
||||
/// Only true on first frame of the press.
|
||||
/// If ImGuiConfigFlags.NavEnableGamepad is set, this is unreliable.
|
||||
/// </summary>
|
||||
/// <param name="button">The button to check for.</param>
|
||||
/// <returns>1 if pressed, 0 otherwise.</returns>
|
||||
public float Pressed(GamepadButtons button);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether <paramref name="button"/> is being pressed.
|
||||
///
|
||||
/// True in intervals if button is held down.
|
||||
/// If ImGuiConfigFlags.NavEnableGamepad is set, this is unreliable.
|
||||
/// </summary>
|
||||
/// <param name="button">The button to check for.</param>
|
||||
/// <returns>1 if still pressed during interval, 0 otherwise or in between intervals.</returns>
|
||||
public float Repeat(GamepadButtons button);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether <paramref name="button"/> has been released.
|
||||
///
|
||||
/// Only true the frame after release.
|
||||
/// If ImGuiConfigFlags.NavEnableGamepad is set, this is unreliable.
|
||||
/// </summary>
|
||||
/// <param name="button">The button to check for.</param>
|
||||
/// <returns>1 if released, 0 otherwise.</returns>
|
||||
public float Released(GamepadButtons button);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the raw state of <paramref name="button"/>.
|
||||
///
|
||||
/// Is set the entire time a button is pressed down.
|
||||
/// </summary>
|
||||
/// <param name="button">The button to check for.</param>
|
||||
/// <returns>1 the whole time button is pressed, 0 otherwise.</returns>
|
||||
public float Raw(GamepadButtons button);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue