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

View file

@ -254,7 +254,7 @@ void Window::logInput(InputConfig* config, Input input)
} }
LOG(LogDebug) << "Window::logInput(" << config->getDeviceName() << "): " << 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) void Window::update(int deltaTime)