feat: start adding keybinds

This commit is contained in:
Anna 2024-02-18 16:17:08 -05:00
parent 090c71b44d
commit 65612c3ed3
Signed by: anna
GPG Key ID: D0943384CD9F87D1
2 changed files with 24 additions and 0 deletions

View File

@ -34,6 +34,9 @@ public sealed class Plugin : IDalamudPlugin {
[PluginService]
internal IGameGui GameGui { get; init; }
[PluginService]
internal IGamepadState GamepadState { get; init; }
[PluginService]
internal IObjectTable ObjectTable { get; init; }

View File

@ -1,5 +1,7 @@
using System.Diagnostics;
using System.Numerics;
using System.Text;
using Dalamud.Game.ClientState.GamePad;
using Dalamud.Interface;
using Dalamud.Interface.Components;
using Dalamud.Interface.ImGuiFileDialog;
@ -19,6 +21,8 @@ internal class SettingsTab : ITab {
private const int RefreshSeconds = 5;
private readonly Stopwatch _metaUpdate = Stopwatch.StartNew();
private GamepadButtons _gamepadKeybind = GamepadButtons.L1 | GamepadButtons.Select;
internal SettingsTab(Plugin plugin) {
this.Plugin = plugin;
this.FileDialogManager = new FileDialogManager();
@ -103,6 +107,23 @@ internal class SettingsTab : ITab {
new Vector2(-1, 1)
);
var currentKeybind = new StringBuilder();
foreach (var button in Enum.GetValues<GamepadButtons>()) {
if ((this._gamepadKeybind & button) > 0) {
if (currentKeybind.Length > 0) {
currentKeybind.Append('+');
}
currentKeybind.Append(Enum.GetName(button));
}
}
ImGui.TextUnformatted($"Gamepad: {currentKeybind}");
if (ImGui.Button("Change")) {
}
if (anyChanged) {
this.Plugin.SaveConfig();
}