| 1011 | } |
| 1012 | |
| 1013 | bool Input::IsKeyDown(const char* name) { |
| 1014 | if (strlen(name) <= 5 || memcmp(name, "mouse", 5) != 0) { |
| 1015 | return keyboard_.isScancodeDown(StringToSDLScancode(name), KIMF_PLAYING); |
| 1016 | } else if (strcmp(name, "mousescrollup") == 0) { |
| 1017 | return mouse_.wheel_delta_y_ > 0; |
| 1018 | } else if (strcmp(name, "mousescrolldown") == 0) { |
| 1019 | return mouse_.wheel_delta_y_ < 0; |
| 1020 | } else if (strcmp(name, "mousescrollleft") == 0) { |
| 1021 | return mouse_.wheel_delta_x_ < 0; |
| 1022 | } else if (strcmp(name, "mousescrollright") == 0) { |
| 1023 | return mouse_.wheel_delta_x_ > 0; |
| 1024 | } else { |
| 1025 | int button = atoi(name + 5); |
| 1026 | if (button >= 0 && button < Mouse::MouseButton::NUM_BUTTONS) |
| 1027 | return mouse_.mouse_down_[button] == Mouse::ClickState::HELD; |
| 1028 | else { |
| 1029 | LOGW << "Unknown mouse button \"" << name << "\"" << std::endl; |
| 1030 | return false; |
| 1031 | } |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | bool Input::IsControllerConnected() { |
| 1036 | return !open_joysticks_.empty(); |
nothing calls this directly
no test coverage detected