Fixed some inconsistent signs for the debug logging for analog controller input.

This commit is contained in:
Leon Styhre 2021-05-23 13:01:14 +02:00
parent ecf8e50500
commit d6fab23d46
2 changed files with 17 additions and 7 deletions

View file

@ -72,21 +72,31 @@ public:
{
std::stringstream stream;
switch (type) {
case TYPE_AXIS:
stream << "Axis " << id << (value > 0 ? "+" : "-");
case TYPE_AXIS: {
char signChar = ' ';
if (value > 0)
signChar = '+';
else if (value < 0)
signChar = '-';
stream << "Axis " << id << signChar;
break;
case TYPE_BUTTON:
}
case TYPE_BUTTON: {
stream << "Button " << id;
break;
case TYPE_KEY:
}
case TYPE_KEY: {
stream << "Key " << SDL_GetKeyName((SDL_Keycode)id);
break;
case TYPE_CEC_BUTTON:
}
case TYPE_CEC_BUTTON: {
stream << "CEC-Button " << getCECButtonName(id);
break;
default:
}
default: {
stream << "Input to string error";
break;
}
}
return stream.str();

View file

@ -254,7 +254,7 @@ void Window::logInput(InputConfig* config, Input input)
}
LOG(LogDebug) << "Window::logInput(" << config->getDeviceName() << "): " <<
input.string() << ", isMappedTo=" << mapname << ", value=" << input.value;
input.string() << ", isMappedTo=" << mapname << "value=" << input.value;
}
void Window::update(int deltaTime)