mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
rawinput: distinguish between circular and linear analog input (#665)
## Link to GitHub Issue or related Pull Request, if one exists n/a ## Description of change Currently, all analogs are treated as circular values that wrap around. This works for knobs and turntables, but can get weird for linear values (like tilt sensors and sliders) especially once analog options are enabled, such as sensitivity. This PR groups analogs into 3 buckets: circular, linear (centered), and linear (positive). Linear types get different algorithms applied to it when options are set (e.g., sensitivity caps out at 0, 1 instead of wrapping around). In linear mode: * Sensitivity value applies an exponential response curve (power curve) to the original value. * Multiplier/divisor serves as a linear cut-off. * Relative mode works as you expect, but of course, values don't wrap around. * Invert and deadzone work as you expect (since they applied to the controller input anyway) * Smoothing is removed from the UI and has no effect. * Delay is unaffected. Also, fix a small bug with -/+ button not working for analog `Delay` option. ## Testing WIP
This commit is contained in:
@@ -165,37 +165,38 @@ std::vector<Analog> &games::nost::get_analogs() {
|
||||
if (analogs.empty()) {
|
||||
analogs = GameAPI::Analogs::getAnalogs("Nostalgia");
|
||||
|
||||
GameAPI::Analogs::sortAnalogs(
|
||||
&analogs,
|
||||
"Key 1",
|
||||
"Key 2",
|
||||
"Key 3",
|
||||
"Key 4",
|
||||
"Key 5",
|
||||
"Key 6",
|
||||
"Key 7",
|
||||
"Key 8",
|
||||
"Key 9",
|
||||
"Key 10",
|
||||
"Key 11",
|
||||
"Key 12",
|
||||
"Key 13",
|
||||
"Key 14",
|
||||
"Key 15",
|
||||
"Key 16",
|
||||
"Key 17",
|
||||
"Key 18",
|
||||
"Key 19",
|
||||
"Key 20",
|
||||
"Key 21",
|
||||
"Key 22",
|
||||
"Key 23",
|
||||
"Key 24",
|
||||
"Key 25",
|
||||
"Key 26",
|
||||
"Key 27",
|
||||
"Key 28"
|
||||
);
|
||||
using namespace GameAPI::Analogs;
|
||||
|
||||
GameAPI::Analogs::sortAnalogsWithType(&analogs, {
|
||||
{ "Key 1", AnalogType::LinearPositive },
|
||||
{ "Key 2", AnalogType::LinearPositive },
|
||||
{ "Key 3", AnalogType::LinearPositive },
|
||||
{ "Key 4", AnalogType::LinearPositive },
|
||||
{ "Key 5", AnalogType::LinearPositive },
|
||||
{ "Key 6", AnalogType::LinearPositive },
|
||||
{ "Key 7", AnalogType::LinearPositive },
|
||||
{ "Key 8", AnalogType::LinearPositive },
|
||||
{ "Key 9", AnalogType::LinearPositive },
|
||||
{ "Key 10", AnalogType::LinearPositive },
|
||||
{ "Key 11", AnalogType::LinearPositive },
|
||||
{ "Key 12", AnalogType::LinearPositive },
|
||||
{ "Key 13", AnalogType::LinearPositive },
|
||||
{ "Key 14", AnalogType::LinearPositive },
|
||||
{ "Key 15", AnalogType::LinearPositive },
|
||||
{ "Key 16", AnalogType::LinearPositive },
|
||||
{ "Key 17", AnalogType::LinearPositive },
|
||||
{ "Key 18", AnalogType::LinearPositive },
|
||||
{ "Key 19", AnalogType::LinearPositive },
|
||||
{ "Key 20", AnalogType::LinearPositive },
|
||||
{ "Key 21", AnalogType::LinearPositive },
|
||||
{ "Key 22", AnalogType::LinearPositive },
|
||||
{ "Key 23", AnalogType::LinearPositive },
|
||||
{ "Key 24", AnalogType::LinearPositive },
|
||||
{ "Key 25", AnalogType::LinearPositive },
|
||||
{ "Key 26", AnalogType::LinearPositive },
|
||||
{ "Key 27", AnalogType::LinearPositive },
|
||||
{ "Key 28", AnalogType::LinearPositive }
|
||||
});
|
||||
}
|
||||
return analogs;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user