| 291 | } |
| 292 | |
| 293 | void InputManager::createTriggerGroups(Triggers::TriggerManager& triggers) |
| 294 | { |
| 295 | t_inputs = triggers.createTriggerGroup("Event", "Keys"); |
| 296 | for (auto const& [key, val] : m_inputs) |
| 297 | { |
| 298 | Input::InputButton* button = val.get(); |
| 299 | t_inputs->add(button->getName()); |
| 300 | t_inputs->onRegister( |
| 301 | button->getName(), [button, this](const Triggers::TriggerEnv& env) { |
| 302 | m_key_monitors.push_back(this->monitor(*button)); |
| 303 | }); |
| 304 | t_inputs->onUnregister( |
| 305 | button->getName(), [button, this](const Triggers::TriggerEnv& env) { |
| 306 | const auto position = std::find_if(m_key_monitors.begin(), |
| 307 | m_key_monitors.end(), [button](const auto& monitor) { |
| 308 | return &monitor->getButton() == button; |
| 309 | }); |
| 310 | if (position != m_key_monitors.end()) |
| 311 | m_key_monitors.erase(position); |
| 312 | }); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | std::vector<std::string> InputManager::getAllInputButtonNames() const |
| 317 | { |
no test coverage detected