mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-10 13:38:08 -05:00
Add Controller Navigation (#429)
* Add Controller Navigation - Apply Rainbow patch - Add Controller Navigation - Controller "Back" button opens F1 Menu - Controller Rumble/Gyro settings at the bottom of the controller menu * Restore changes from PR #306 Add back update from https://github.com/HarbourMasters/Shipwright/pull/306 * Add Tooltip of new functionality Tooltip: Allows controller navigation of the menu bar D-pad to move between items, A to select, and X to grab focus on the menu bar * set & save check * Fixes for switch port
This commit is contained in:
parent
3d24f3f595
commit
f29fb01887
@ -50,6 +50,7 @@ bool oldCursorState = true;
|
||||
ImGui::PopStyleColor(); \
|
||||
ImGui::Separator();
|
||||
#define TOGGLE_BTN ImGuiKey_F1
|
||||
#define TOGGLE_PAD_BTN ImGuiKey_GamepadBack
|
||||
#define HOOK(b) if(b) needs_save = true;
|
||||
OSContPad* pads;
|
||||
|
||||
@ -698,7 +699,7 @@ namespace SohImGui {
|
||||
const std::shared_ptr<Window> wnd = GlobalCtx2::GetInstance()->GetWindow();
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoBackground |
|
||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus | ImGuiWindowFlags_NoResize;
|
||||
ImGuiWindowFlags_NoResize;
|
||||
if (CVar_GetS32("gOpenMenuBar", 0)) window_flags |= ImGuiWindowFlags_MenuBar;
|
||||
|
||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||
@ -726,7 +727,9 @@ namespace SohImGui {
|
||||
|
||||
ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None);
|
||||
|
||||
if (ImGui::IsKeyPressed(TOGGLE_BTN)) {
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad;
|
||||
if ((ImGui::IsKeyPressed(TOGGLE_BTN)) || (ImGui::IsKeyDown(TOGGLE_PAD_BTN))) {
|
||||
bool menu_bar = CVar_GetS32("gOpenMenuBar", 0);
|
||||
CVar_SetS32("gOpenMenuBar", !menu_bar);
|
||||
needs_save = true;
|
||||
@ -756,7 +759,22 @@ namespace SohImGui {
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Controller"))
|
||||
{
|
||||
{
|
||||
EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName");
|
||||
EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText");
|
||||
EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop");
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
EnhancementCheckbox("Show Inputs", "gInputEnabled");
|
||||
Tooltip("Shows currently pressed inputs on the bottom right of the screen");
|
||||
EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled");
|
||||
|
||||
EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false);
|
||||
Tooltip("Sets the on screen size of the displayed inputs from Show Inputs");
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
for (const auto& [i, controllers] : Ship::Window::Controllers)
|
||||
{
|
||||
bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) {
|
||||
@ -786,19 +804,6 @@ namespace SohImGui {
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
EnhancementCheckbox("Show Inputs", "gInputEnabled");
|
||||
Tooltip("Shows currently pressed inputs on the bottom right of the screen");
|
||||
EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled");
|
||||
|
||||
EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false);
|
||||
Tooltip("Sets the on screen size of the displayed inputs from Show Inputs");
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName");
|
||||
EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText");
|
||||
EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop");
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user