- move "swap panels" from s-key to S-key
- move "fire starter" from SPACE-key to s-key - move "open property browser" from Shift-SPACE to Shift-Enter (Shift-Return) - implement PTT on SPACE/Shift-SPACE (with the other six SPACE/modifier combinations unused, apart from a popup) - add controls.ptt(v) wrapper function (v can be 1 or 2 for on, and 0 for off) Easter-Egg: - pressing the t-key for at least one second resets the warp delta. This is an experimental feature that most people won't notice. It's meant for investigating if suchlike "unorthodox" key use is acceptable. While modifier-keys are the norm on computer keyboards, modifier-times aren't, although we are used to them from other devices, such as alarm clocks etc.) May later get removed without warning.
This commit is contained in:
parent
b67402f084
commit
3c08f34027
3 changed files with 121 additions and 33 deletions
|
@ -327,25 +327,25 @@ rudderTrimAxis = func { rudderTrim(cmdarg().getNode("value").getValue()); }
|
||||||
##
|
##
|
||||||
# Gear handling.
|
# Gear handling.
|
||||||
#
|
#
|
||||||
gearDown = func {
|
var gearDown = func {
|
||||||
if (arg[0] < 0) {
|
if (arg[0] < 0) {
|
||||||
setprop("/controls/gear/gear-down", 0);
|
setprop("/controls/gear/gear-down", 0);
|
||||||
} elsif (arg[0] > 0) {
|
} elsif (arg[0] > 0) {
|
||||||
setprop("/controls/gear/gear-down", 1);
|
setprop("/controls/gear/gear-down", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gearToggle = func { gearDown(getprop("/controls/gear/gear-down") > 0 ? -1 : 1); }
|
var gearToggle = func { gearDown(getprop("/controls/gear/gear-down") > 0 ? -1 : 1); }
|
||||||
|
|
||||||
##
|
##
|
||||||
# Brake handling.
|
# Brake handling.
|
||||||
#
|
#
|
||||||
fullBrakeTime = 0.5;
|
var fullBrakeTime = 0.5;
|
||||||
applyBrakes = func(v, which = 0) {
|
var applyBrakes = func(v, which = 0) {
|
||||||
if (which <= 0) { interpolate("/controls/gear/brake-left", v, fullBrakeTime); }
|
if (which <= 0) { interpolate("/controls/gear/brake-left", v, fullBrakeTime); }
|
||||||
if (which >= 0) { interpolate("/controls/gear/brake-right", v, fullBrakeTime); }
|
if (which >= 0) { interpolate("/controls/gear/brake-right", v, fullBrakeTime); }
|
||||||
}
|
}
|
||||||
|
|
||||||
applyParkingBrake = func(v) {
|
var applyParkingBrake = func(v) {
|
||||||
if (!v) { return; }
|
if (!v) { return; }
|
||||||
var p = "/controls/gear/brake-parking";
|
var p = "/controls/gear/brake-parking";
|
||||||
setprop(p, var i = !getprop(p));
|
setprop(p, var i = !getprop(p));
|
||||||
|
@ -355,11 +355,16 @@ applyParkingBrake = func(v) {
|
||||||
##
|
##
|
||||||
# Weapon handling.
|
# Weapon handling.
|
||||||
#
|
#
|
||||||
trigger = func(b) { setprop("/controls/armament/trigger", b); }
|
var trigger = func(b) setprop("/controls/armament/trigger", b);
|
||||||
weaponSelect = func(d) {
|
var weaponSelect = func(d) {
|
||||||
var ws = props.globals.getNode("/controls/armament/selected", 1);
|
var ws = props.globals.getNode("/controls/armament/selected", 1);
|
||||||
var n = ws.getValue();
|
var n = ws.getValue();
|
||||||
if (n == nil) { n = 0; }
|
if (n == nil) { n = 0; }
|
||||||
ws.setIntValue(n + d);
|
ws.setIntValue(n + d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# Communication.
|
||||||
|
#
|
||||||
|
var ptt = func(b) setprop("/instrumentation/comm/ptt", b);
|
||||||
|
|
||||||
|
|
|
@ -821,7 +821,7 @@ debug_keys = {
|
||||||
{ name : "Shift-F3", desc : "load panel" },
|
{ name : "Shift-F3", desc : "load panel" },
|
||||||
{ name : "Shift-F4", desc : "reload global preferences" },
|
{ name : "Shift-F4", desc : "reload global preferences" },
|
||||||
{ name : "Shift-F9", desc : "toggle FDM data logging" },
|
{ name : "Shift-F9", desc : "toggle FDM data logging" },
|
||||||
{ name : "Shift-Space", desc : "open property browser" },
|
{ name : "Shift-Enter", desc : "open property browser" },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ common_aircraft_keys = {
|
||||||
{ name : "7/Home", desc : "increase elevator trim" },
|
{ name : "7/Home", desc : "increase elevator trim" },
|
||||||
{ name : "8/Down", desc : "decrease elevator or AP altitude" },
|
{ name : "8/Down", desc : "decrease elevator or AP altitude" },
|
||||||
{ name : "9/PgUp", desc : "incr. throttle or AP autothrottle" },
|
{ name : "9/PgUp", desc : "incr. throttle or AP autothrottle" },
|
||||||
{ name : "Space", desc : "fire starter on selected eng." },
|
{ name : "Space", desc : "PTT - Push To Talk (via VoIP)" },
|
||||||
{ name : "!/@/#/$", desc : "select engine 1/2/3/4" },
|
{ name : "!/@/#/$", desc : "select engine 1/2/3/4" },
|
||||||
{ name : "b", desc : "apply all brakes" },
|
{ name : "b", desc : "apply all brakes" },
|
||||||
{ name : "B", desc : "toggle parking brake" },
|
{ name : "B", desc : "toggle parking brake" },
|
||||||
|
@ -884,7 +884,8 @@ common_aircraft_keys = {
|
||||||
{ name : "m/M", desc : "mixture richer/leaner" },
|
{ name : "m/M", desc : "mixture richer/leaner" },
|
||||||
{ name : "n/N", desc : "propeller finer/coarser" },
|
{ name : "n/N", desc : "propeller finer/coarser" },
|
||||||
{ name : "P", desc : "toggle 2D panel" },
|
{ name : "P", desc : "toggle 2D panel" },
|
||||||
{ name : "s", desc : "swap panels" },
|
{ name : "S", desc : "swap panels" },
|
||||||
|
{ name : "s", desc : "fire starter on selected eng." },
|
||||||
{ name : ", .", desc : "left/right brake (comma, period)" },
|
{ name : ", .", desc : "left/right brake (comma, period)" },
|
||||||
{ name : "~", desc : "select all engines (tilde)" },
|
{ name : "~", desc : "select all engines (tilde)" },
|
||||||
{ name : "[ ]", desc : "flaps up/down" },
|
{ name : "[ ]", desc : "flaps up/down" },
|
||||||
|
|
128
keyboard.xml
128
keyboard.xml
|
@ -2,8 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
Key binding definitions.
|
Key binding definitions.
|
||||||
|
|
||||||
The list here is not yet comprehensive: a few of the bindings are
|
The *-key in fg/osg/osgviewer is handled in the C++ code.
|
||||||
still handled in the C++ code.
|
|
||||||
|
|
||||||
Regular keycodes go up to 255; special keys start at 256, and can be
|
Regular keycodes go up to 255; special keys start at 256, and can be
|
||||||
calculated by adding 256 to the GLUT key value in glut.h.
|
calculated by adding 256 to the GLUT key value in glut.h.
|
||||||
|
@ -11,6 +10,32 @@ calculated by adding 256 to the GLUT key value in glut.h.
|
||||||
|
|
||||||
<PropertyList>
|
<PropertyList>
|
||||||
|
|
||||||
|
<nasal>
|
||||||
|
<script>
|
||||||
|
var kbdshift = props.globals.getNode("/devices/status/keyboard/shift");
|
||||||
|
var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl");
|
||||||
|
var kbdalt = props.globals.getNode("/devices/status/keyboard/alt");
|
||||||
|
|
||||||
|
var get_modifiers = func {
|
||||||
|
kbdshift.getValue() + 2 * kbdctrl.getValue() + 4 * kbdalt.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
var space_release = func {}
|
||||||
|
var space = func(state, mod) {
|
||||||
|
if (!state) {
|
||||||
|
space_release();
|
||||||
|
return space_release = func {}
|
||||||
|
}
|
||||||
|
if (mod == 0 or mod == 1) {
|
||||||
|
controls.ptt(mod + 1);
|
||||||
|
space_release = func { controls.ptt(0) }
|
||||||
|
} else {
|
||||||
|
gui.popupTip("SPACE " ~ mod ~ " " ~ (state ? "press" : "release"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</nasal>
|
||||||
|
|
||||||
<key n="1">
|
<key n="1">
|
||||||
<name>Ctrl-A</name>
|
<name>Ctrl-A</name>
|
||||||
<desc>Toggle autopilot altitude lock.</desc>
|
<desc>Toggle autopilot altitude lock.</desc>
|
||||||
|
@ -95,6 +120,12 @@ calculated by adding 256 to the GLUT key value in glut.h.
|
||||||
<property>/controls/flight/rudder</property>
|
<property>/controls/flight/rudder</property>
|
||||||
<step type="double">0.05</step>
|
<step type="double">0.05</step>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-shift>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>gui.property_browser()</script>
|
||||||
|
</binding>
|
||||||
|
</mod-shift>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
<key n="14">
|
<key n="14">
|
||||||
|
@ -242,22 +273,28 @@ calculated by adding 256 to the GLUT key value in glut.h.
|
||||||
|
|
||||||
<key n="32">
|
<key n="32">
|
||||||
<name>SPACE</name>
|
<name>SPACE</name>
|
||||||
<desc>Fire Starter on Selected Engine(s)</desc>
|
<desc>PTT - Push To Talk (via VoIP)</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>controls.startEngine()</script>
|
<script>space(1, get_modifiers())</script>
|
||||||
</binding>
|
</binding>
|
||||||
<mod-up>
|
<mod-up>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>props.setAll("/controls/engines/engine", "starter", 0)</script>
|
<script>space(0, get_modifiers())</script>
|
||||||
</binding>
|
</binding>
|
||||||
</mod-up>
|
</mod-up>
|
||||||
<mod-shift>
|
<mod-shift>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>gui.property_browser()</script>
|
<script>space(1, get_modifiers())</script>
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>space(0, get_modifiers())</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</mod-shift>
|
</mod-shift>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
@ -619,6 +656,29 @@ calculated by adding 256 to the GLUT key value in glut.h.
|
||||||
</binding>
|
</binding>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
<key n="83">
|
||||||
|
<name>S</name>
|
||||||
|
<desc>Swap panels.</desc>
|
||||||
|
<binding>
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<property>/sim/allow-toggle-cockpit</property>
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
<command>property-swap</command>
|
||||||
|
<property>/sim/panel/path</property>
|
||||||
|
<property>/sim/panel_2/path</property>
|
||||||
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<property>/sim/allow-toggle-cockpit</property>
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
<command>panel-load</command>
|
||||||
|
</binding>
|
||||||
|
</key>
|
||||||
|
|
||||||
<key n="84">
|
<key n="84">
|
||||||
<name>T</name>
|
<name>T</name>
|
||||||
<desc>Decrease warp delta.</desc>
|
<desc>Decrease warp delta.</desc>
|
||||||
|
@ -856,27 +916,31 @@ calculated by adding 256 to the GLUT key value in glut.h.
|
||||||
|
|
||||||
<key n="115">
|
<key n="115">
|
||||||
<name>s</name>
|
<name>s</name>
|
||||||
<desc>Swap panels.</desc>
|
<desc>Fire Starter on Selected Engine(s)</desc>
|
||||||
<binding>
|
<binding>
|
||||||
<condition>
|
<command>nasal</command>
|
||||||
<not>
|
<script>controls.startEngine()</script>
|
||||||
<property>/sim/allow-toggle-cockpit</property>
|
|
||||||
</not>
|
|
||||||
</condition>
|
|
||||||
<command>property-swap</command>
|
|
||||||
<property>/sim/panel/path</property>
|
|
||||||
<property>/sim/panel_2/path</property>
|
|
||||||
</binding>
|
|
||||||
<binding>
|
|
||||||
<condition>
|
|
||||||
<not>
|
|
||||||
<property>/sim/allow-toggle-cockpit</property>
|
|
||||||
</not>
|
|
||||||
</condition>
|
|
||||||
<command>panel-load</command>
|
|
||||||
</binding>
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>props.setAll("/controls/engines/engine", "starter", 0)</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
|
<mod-shift>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>gui.property_browser()</script>
|
||||||
|
</binding>
|
||||||
|
</mod-shift>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
<nasal>
|
||||||
|
<script>
|
||||||
|
t_id = 0;
|
||||||
|
</script>
|
||||||
|
</nasal>
|
||||||
|
|
||||||
<key n="116">
|
<key n="116">
|
||||||
<name>t</name>
|
<name>t</name>
|
||||||
<desc>Increase warp delta.</desc>
|
<desc>Increase warp delta.</desc>
|
||||||
|
@ -885,6 +949,24 @@ calculated by adding 256 to the GLUT key value in glut.h.
|
||||||
<property>/sim/time/warp-delta</property>
|
<property>/sim/time/warp-delta</property>
|
||||||
<step type="int">30</step>
|
<step type="int">30</step>
|
||||||
</binding>
|
</binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>
|
||||||
|
(func(x) {
|
||||||
|
settimer(func {
|
||||||
|
x == t_id or return;
|
||||||
|
gui.popupTip("resetting warp");
|
||||||
|
setprop("/sim/time/warp-delta", 0);
|
||||||
|
}, 1, 1)
|
||||||
|
})(t_id += 1)
|
||||||
|
</script>
|
||||||
|
</binding>
|
||||||
|
<mod-up>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>t_id += 1</script>
|
||||||
|
</binding>
|
||||||
|
</mod-up>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
<key n="118">
|
<key n="118">
|
||||||
|
|
Loading…
Reference in a new issue