Remove return value from axis functions in API

This commit is contained in:
Henrik Rydgård committed 2023-01-10 10:12:37 +01:00
1 parent a3a949f5e6
commit 07114c6aaf
18 files changed
+52 -72

No files matched your search

+10 -14
View File
@@ -407,11 +407,11 @@ static bool IgnoreAxisForMapping(int axis) {
}
bool KeyMappingNewKeyDialog::axis(const AxisInput &axis) {
void KeyMappingNewKeyDialog::axis(const AxisInput &axis) {
if (mapped_ || time_now_d() < delayUntil_)
return false;
return;
if (IgnoreAxisForMapping(axis.axisId))
return false;
return;
if (axis.value > AXIS_BIND_THRESHOLD) {
mapped_ = true;
@@ -428,14 +428,13 @@ bool KeyMappingNewKeyDialog::axis(const AxisInput &axis) {
if (callback_)
callback_(kdf);
}
return true;
}
bool KeyMappingNewMouseKeyDialog::axis(const AxisInput &axis) {
void KeyMappingNewMouseKeyDialog::axis(const AxisInput &axis) {
if (mapped_)
return false;
return;
if (IgnoreAxisForMapping(axis.axisId))
return false;
return;
if (axis.value > AXIS_BIND_THRESHOLD) {
mapped_ = true;
@@ -452,7 +451,6 @@ bool KeyMappingNewMouseKeyDialog::axis(const AxisInput &axis) {
if (callback_)
callback_(kdf);
}
return true;
}
enum class StickHistoryViewType {
@@ -619,12 +617,12 @@ bool AnalogSetupScreen::key(const KeyInput &key) {
return retval;
}
bool AnalogSetupScreen::axis(const AxisInput &axis) {
void AnalogSetupScreen::axis(const AxisInput &axis) {
// We DON'T call UIScreen::Axis here! Otherwise it'll try to move the UI focus around.
// UIScreen::axis(axis);
// Instead we just send the input directly to the mapper, that we'll visualize.
return mapper_.Axis(axis);
mapper_.Axis(axis);
}
void AnalogSetupScreen::CreateViews() {
@@ -778,13 +776,12 @@ bool TouchTestScreen::key(const KeyInput &key) {
return true;
}
bool TouchTestScreen::axis(const AxisInput &axis) {
void TouchTestScreen::axis(const AxisInput &axis) {
// This is mainly to catch axis events that would otherwise get translated
// into arrow keys, since seeing keyboard arrow key events appear when using
// a controller would be confusing for the user.
if (IgnoreAxisForMapping(axis.axisId))
return false;
return;
const float AXIS_LOG_THRESHOLD = AXIS_BIND_THRESHOLD * 0.5f;
if (axis.value > AXIS_LOG_THRESHOLD || axis.value < -AXIS_LOG_THRESHOLD) {
@@ -797,7 +794,6 @@ bool TouchTestScreen::axis(const AxisInput &axis) {
lastKeyEvent_->SetText(buf);
}
}
return true;
}
void TouchTestScreen::render() {