| 127 | }; |
| 128 | |
| 129 | bool GuiController::GuiIsPulsed(ActionID actionID) const |
| 130 | { |
| 131 | constexpr auto DELAY = 0.1f; |
| 132 | constexpr auto INITIAL_DELAY = 0.4f; |
| 133 | |
| 134 | // Action already held prior to entering menu; lock input. |
| 135 | if (GetActionTimeActive(actionID) >= TimeInMenu) |
| 136 | return false; |
| 137 | |
| 138 | // Pulse only directional inputs. |
| 139 | auto oppositeAction = std::optional<ActionID>(std::nullopt); |
| 140 | switch (actionID) |
| 141 | { |
| 142 | case In::Forward: |
| 143 | oppositeAction = In::Back; |
| 144 | break; |
| 145 | |
| 146 | case In::Back: |
| 147 | oppositeAction = In::Forward; |
| 148 | break; |
| 149 | |
| 150 | case In::Left: |
| 151 | oppositeAction = In::Right; |
| 152 | break; |
| 153 | |
| 154 | case In::Right: |
| 155 | oppositeAction = In::Left; |
| 156 | break; |
| 157 | |
| 158 | default: |
| 159 | break; |
| 160 | } |
| 161 | |
| 162 | // Opposite action held; lock input. |
| 163 | bool isActionLocked = oppositeAction.has_value() ? IsHeld(*oppositeAction) : false; |
| 164 | if (isActionLocked) |
| 165 | return false; |
| 166 | |
| 167 | return IsPulsed(actionID, DELAY, INITIAL_DELAY); |
| 168 | } |
| 169 | |
| 170 | bool GuiController::GuiIsSelected(bool onClicked) const |
| 171 | { |
nothing calls this directly
no test coverage detected