c172p : 2018.1 Joystick compatibility fixes.
Merge pull request #972 - e74ac3f2ed
This commit is contained in:
parent
91dd762736
commit
a40754de46
1 changed files with 21 additions and 0 deletions
|
@ -316,6 +316,24 @@ controls.throttleMouse = func {
|
|||
setprop("/controls/engines/current-engine/throttle", new_value);
|
||||
};
|
||||
|
||||
# 2018.2 introduces new "all" properties for throttle, mixture and prop pitch.
|
||||
# this is the correct way to interface with the axis based controls - use a listener
|
||||
# on the *-all property
|
||||
setlistener("/controls/engines/throttle-all", func{
|
||||
var value = (1 - getprop("/controls/engines/throttle-all")) / 2;
|
||||
var new_value = std.max(0.0, std.min(value, 1.0));
|
||||
setprop("/controls/engines/current-engine/throttle", new_value);
|
||||
}, 0, 0);
|
||||
|
||||
setlistener("/controls/engines/mixture-all", func{
|
||||
var value = (1 - getprop("/controls/engines/mixture-all")) / 2;
|
||||
var new_value = std.max(0.0, std.min(value, 1.0));
|
||||
setprop("/controls/engines/current-engine/mixture", new_value);
|
||||
}, 0, 0);
|
||||
|
||||
# backwards compatibility only - the controls.throttleAxis should not be overridden like this. The joystick binding Throttle (all) has
|
||||
# been replaced and controls.throttleAxis will not be called from the controls binding - so this is to
|
||||
# maintain compatibility with existing joystick xml files.
|
||||
controls.throttleAxis = func {
|
||||
var value = (1 - cmdarg().getNode("setting").getValue()) / 2;
|
||||
var new_value = std.max(0.0, std.min(value, 1.0));
|
||||
|
@ -329,6 +347,9 @@ controls.adjMixture = func {
|
|||
setprop("/controls/engines/current-engine/mixture", new_value);
|
||||
};
|
||||
|
||||
# backwards compatibility only - the controls.throttleAxis should not be overridden like this. The joystick binding Throttle (all) has
|
||||
# been replaced and controls.throttleAxis will not be called from the controls binding - so this is to
|
||||
# maintain compatibility with existing joystick xml files.
|
||||
controls.mixtureAxis = func {
|
||||
var value = (1 - cmdarg().getNode("setting").getValue()) / 2;
|
||||
var new_value = std.max(0.0, std.min(value, 1.0));
|
||||
|
|
Loading…
Add table
Reference in a new issue