mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
refactor: Use a constant for the gamepad button deletion mask
Add Flags-Attribute to GamepadButtons enums.
This commit is contained in:
parent
66d42a7cfd
commit
d65f2c6cd9
2 changed files with 16 additions and 7 deletions
|
|
@ -1,10 +1,18 @@
|
|||
namespace Dalamud.Game.ClientState
|
||||
using System;
|
||||
|
||||
namespace Dalamud.Game.ClientState
|
||||
{
|
||||
/// <summary>
|
||||
/// Bitmask of the Button ushort used by the game.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum GamepadButtons : ushort
|
||||
{
|
||||
/// <summary>
|
||||
/// No buttons pressed.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Digipad up.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -228,12 +228,13 @@ namespace Dalamud.Game.ClientState
|
|||
// `ButtonPressed` while ImGuiConfigFlags.NavEnableGamepad is set.
|
||||
// This is debatable.
|
||||
// ImGui itself does not care either way as it uses the Raw values and does its own state handling.
|
||||
input->ButtonsRaw &= (ushort)~GamepadButtons.L2;
|
||||
input->ButtonsRaw &= (ushort)~GamepadButtons.R2;
|
||||
input->ButtonsRaw &= (ushort)~GamepadButtons.DpadDown;
|
||||
input->ButtonsRaw &= (ushort)~GamepadButtons.DpadLeft;
|
||||
input->ButtonsRaw &= (ushort)~GamepadButtons.DpadUp;
|
||||
input->ButtonsRaw &= (ushort)~GamepadButtons.DpadRight;
|
||||
const ushort deletionMask = (ushort)(~GamepadButtons.L2
|
||||
& ~GamepadButtons.R2
|
||||
& ~GamepadButtons.DpadDown
|
||||
& ~GamepadButtons.DpadLeft
|
||||
& ~GamepadButtons.DpadUp
|
||||
& ~GamepadButtons.DpadRight);
|
||||
input->ButtonsRaw &= deletionMask;
|
||||
input->ButtonsPressed = 0;
|
||||
input->ButtonsReleased = 0;
|
||||
input->ButtonsRepeat = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue