| 2480 | } |
| 2481 | |
| 2482 | void configInput() |
| 2483 | { |
| 2484 | const u32 window_flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar; |
| 2485 | f32 scroll = ImGui::GetScrollY(); |
| 2486 | f32 yNext = 45.0f; |
| 2487 | |
| 2488 | s_inputConfig = inputMapping_get(); |
| 2489 | |
| 2490 | ImGui::SetNextWindowPos(ImVec2(165.0f*s_uiScale, yNext - scroll)); |
| 2491 | if (ImGui::Button("Reset To Defaults")) |
| 2492 | { |
| 2493 | inputMapping_resetToDefaults(); |
| 2494 | } |
| 2495 | yNext += 32.0f*s_uiScale; |
| 2496 | |
| 2497 | ImGui::SetNextWindowPos(ImVec2(165.0f*s_uiScale, yNext - scroll)); |
| 2498 | ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); |
| 2499 | ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 0.0f, 0.0f }); |
| 2500 | if (ImGui::BeginChild("Controller Options", ImVec2(390.0f*s_uiScale, (s_controllerWinOpen ? 480.0f : 29.0f)*s_uiScale), true, window_flags)) |
| 2501 | { |
| 2502 | if (ImGui::Button("Controller Options", ImVec2(370.0f*s_uiScale, 0.0f))) |
| 2503 | { |
| 2504 | s_controllerWinOpen = !s_controllerWinOpen; |
| 2505 | } |
| 2506 | ImGui::PopStyleVar(); |
| 2507 | |
| 2508 | if (s_controllerWinOpen) |
| 2509 | { |
| 2510 | ImGui::Spacing(); |
| 2511 | bool controllerEnable = (s_inputConfig->controllerFlags & CFLAG_ENABLE) != 0; |
| 2512 | if (ImGui::Checkbox("Enable", &controllerEnable)) |
| 2513 | { |
| 2514 | if (controllerEnable) { s_inputConfig->controllerFlags |= CFLAG_ENABLE; } |
| 2515 | else { s_inputConfig->controllerFlags &= ~CFLAG_ENABLE; } |
| 2516 | } |
| 2517 | |
| 2518 | ImGui::PushFont(s_dialogFont); |
| 2519 | ImGui::LabelText("##ConfigLabel", "Controller Axis"); |
| 2520 | ImGui::PopFont(); |
| 2521 | |
| 2522 | ImGui::LabelText("##ConfigLabel", "Horizontal Turn"); ImGui::SameLine(175*s_uiScale); |
| 2523 | ImGui::SetNextItemWidth(196*s_uiScale); |
| 2524 | ImGui::Combo("##CtrlLookHorz", (s32*)&s_inputConfig->axis[AA_LOOK_HORZ], c_axisBinding, IM_ARRAYSIZE(c_axisBinding)); |
| 2525 | |
| 2526 | ImGui::LabelText("##ConfigLabel", "Vertical Look"); ImGui::SameLine(175*s_uiScale); |
| 2527 | ImGui::SetNextItemWidth(196*s_uiScale); |
| 2528 | ImGui::Combo("##CtrlLookVert", (s32*)&s_inputConfig->axis[AA_LOOK_VERT], c_axisBinding, IM_ARRAYSIZE(c_axisBinding)); |
| 2529 | |
| 2530 | ImGui::LabelText("##ConfigLabel", "Move"); ImGui::SameLine(175*s_uiScale); |
| 2531 | ImGui::SetNextItemWidth(196*s_uiScale); |
| 2532 | ImGui::Combo("##CtrlStrafe", (s32*)&s_inputConfig->axis[AA_STRAFE], c_axisBinding, IM_ARRAYSIZE(c_axisBinding)); |
| 2533 | |
| 2534 | ImGui::LabelText("##ConfigLabel", "Strafe"); ImGui::SameLine(175*s_uiScale); |
| 2535 | ImGui::SetNextItemWidth(196*s_uiScale); |
| 2536 | ImGui::Combo("##CtrlMove", (s32*)&s_inputConfig->axis[AA_MOVE], c_axisBinding, IM_ARRAYSIZE(c_axisBinding)); |
| 2537 | |
| 2538 | ImGui::Separator(); |
| 2539 |
no test coverage detected