feat: start adding keybinds
This commit is contained in:
parent
090c71b44d
commit
65612c3ed3
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue